Skip to main content
Log in

TAT-HUM: Trajectory analysis toolkit for human movements in Python

  • Original Manuscript
  • Published:
Behavior Research Methods Aims and scope Submit manuscript

Abstract

Human movement trajectories can reveal useful insights regarding the underlying mechanisms of human behaviors. Extracting information from movement trajectories, however, can be challenging because of their complex and dynamic nature. The current paper presents a Python toolkit developed to help users analyze and extract meaningful information from the trajectories of discrete rapid aiming movements executed by humans. This toolkit uses various open-source Python libraries, such as NumPy and SciPy, and offers a collection of common functionalities to analyze movement trajectory data. To ensure flexibility and ease of use, the toolkit offers two approaches: an automated approach that processes raw data and generates relevant measures automatically, and a manual approach that allows users to selectively use different functions based on their specific needs. A behavioral experiment based on the spatial cueing paradigm was conducted to illustrate how one can use this toolkit in practice. Readers are encouraged to access the publicly available data and relevant analysis scripts as an opportunity to learn about kinematic analysis for human movements.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11

Similar content being viewed by others

Open Practices Statement

The data for the experiment in this study are freely available on the Open Science Framework at https://doi.org/10.17605/OSF.IO/24QVM. The corresponding code associated with this toolkit and the analysis script for the accompanying experiment can be found on GitHub at https://github.com/xywang01/TAT-HUM. The experiment reported here was not preregistered.

References

  • Ayala, M. N., & Henriques, D. Y. (2021). Differential contributions of implicit and explicit learning mechanisms to various contextual cues in dual adaptation. PLoS One, 16(7), e0253948.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  • Bartlett, R. (2014). Introduction to sports biomechanics: Analysing human movement patterns. Routledge.

    Book  Google Scholar 

  • Bazarevsky, V., Grishchenko, I., Raveendran, K., Zhu, T., Zhang, F., & Grundmann, M. (2020). BlazePose: On-device Real-time Body Pose tracking. CoRR, abs/2006.10204. Retrieved from https://arxiv.org/abs/2006.10204. Accessed 17 Oct 2022.

  • Bingham, G. P., & Pagano, C. C. (1998). The necessity of a perception–action approach to definite distance perception: Monocular distance perception to guide reaching. Journal of Experimental Psychology: Human Perception and Performance, 24(1), 145.

    CAS  PubMed  Google Scholar 

  • Bingham, G. P., Herth, R. A., Yang, P., Chen, Z., & Wang, X. M. (2022). Investigation of optical texture properties as relative distance information for monocular guidance of reaching. Vision Research, 196, 108029.

    Article  PubMed  Google Scholar 

  • Bingham, G. P., Wang, X. M., & Herth, R. A. (2023). Stable visually guided reaching does not require an internal feedforward model to compensate for internal delay: Data and model. Vision Research, 203, 108152. https://doi.org/10.1016/j.visres.2022.108152

    Article  PubMed  Google Scholar 

  • Bourgaize, S. M., McFadyen, B. J., & Cinelli, M. E. (2021). Collision avoidance behaviours when circumventing people of different sizes in various positions and locations. Journal of Motor Behavior, 53(2), 166–175.

    Article  PubMed  Google Scholar 

  • Brenner, E., & Smeets, J. B. (2019). How can you best measure reaction times? Journal of Motor Behavior, 51(5), 486–495.

    Article  PubMed  Google Scholar 

  • Butterworth, S. (1930). On the theory of filter amplifiers. Wireless Engineer, 7(6), 536–541.

    Google Scholar 

  • Cappello, A., La Palombara, P. F., & Leardini, A. (1996). Optimization and smoothing techniques in movement analysis. International Journal of Bio-Medical Computing, 41(3), 137–151.

    Article  CAS  PubMed  Google Scholar 

  • Chang, E., & Ro, T. (2005). Inhibition of return in perception and action. Visual Cognition, 12(3), 443–472.

    Article  Google Scholar 

  • Cisek, P., & Kalaska, J. F. (2005). Neural correlates of reaching decisions in dorsal premotor cortex: Specification of multiple direction choices and final selection of action. Neuron, 45(5), 801–814.

    Article  CAS  PubMed  Google Scholar 

  • Cisek, P., & Kalaska, J. F. (2010). Neural mechanisms for interacting with a world full of action choices. Annual Review of Neuroscience, 33, 269–298.

    Article  CAS  PubMed  Google Scholar 

  • Donders, F. C. (1969). On the speed of mental processes. Acta Psychologica, 30, 412–431.

    Article  CAS  PubMed  Google Scholar 

  • Elliott, D., Hansen, S., Grierson, L. E., Lyons, J., Bennett, S. J., & Hayes, S. J. (2010). Goal-directed aiming: Two components but multiple processes. Psychological Bulletin, 136(6), 1023.

    Article  PubMed  Google Scholar 

  • Fagioli, S., Hommel, B., & Schubotz, R. I. (2007). Intentional control of attention: Action planning primes action-related stimulus dimensions. Psychological Research, 71, 22–29.

    Article  PubMed  Google Scholar 

  • Faul, F., Erdfelder, E., Lang, A.-G., & Buchner, A. (2007). G*Power 3: A flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods, 39(2), 175–191. https://doi.org/10.3758/BF03193146

    Article  PubMed  Google Scholar 

  • Faul, F., Erdfelder, E., Buchner, A., & Lang, A.-G. (2009). Statistical power analyses using G*Power 3.1: Tests for correlation and regression analyses. Behavior Research Methods, 41(4), 1149–1160. https://doi.org/10.3758/BRM.41.4.1149

    Article  PubMed  Google Scholar 

  • Friesen, C. K., & Kingstone, A. (1998). The eyes have it! Reflexive orienting is triggered by nonpredictive gaze. Psychonomic Bulletin & Review, 5(3), 490–495. https://doi.org/10.3758/BF03208827

    Article  Google Scholar 

  • Frischen, A., Bayliss, A. P., & Tipper, S. P. (2007). Gaze cueing of attention: Visual attention, social cognition, and individual differences. Psychological Bulletin, 133(4), 694–724. https://doi.org/10.1037/0033-2909.133.4.694

    Article  PubMed  PubMed Central  Google Scholar 

  • Gallivan, J. P., Chapman, C. S., Wolpert, D. M., & Flanagan, J. R. (2018). Decision-making in sensorimotor control. Nature Reviews Neuroscience, 19(9), 9. https://doi.org/10.1038/s41583-018-0045-9

    Article  CAS  Google Scholar 

  • Gallivan, J. P., & Chapman, C. S. (2014). Three-dimensional reach trajectories as a probe of real-time decision-making between multiple competing targets. Frontiers in Neuroscience, 8. https://doi.org/10.3389/fnins.2014.00215

  • Ghose, U., Srinivasan, A. A., Boyce, W. P., Xu, H., & Chng, E. S. (2020). PyTrack: An end-to-end analysis toolkit for eye tracking. Behavior Research Methods, 52, 2588–2603.

    Article  PubMed  PubMed Central  Google Scholar 

  • Gram, J. P. (1883). Ueber die Entwickelung reeller Functionen in Reihen mittelst der Methode der kleinsten Quadrate. Journal für die Reine und Angewandte Mathematik, 94, 41–73.

  • Grierson, L. E., Gonzalez, C., & Elliott, D. (2009). Kinematic analysis of early online control of goal-directed reaches: A novel movement perturbation study. Motor Control, 13(3), 280–296.

    Article  PubMed  Google Scholar 

  • Handlovsky, I., Hansen, S., Lee, T. D., & Elliott, D. (2004). The Ebbinghaus illusion affects on-line movement control. Neuroscience Letters, 366(3), 308–311.

    Article  CAS  PubMed  Google Scholar 

  • Heath, M., Westwood, D. A., & Binsted, G. (2004). The control of memory-guided reaching movements in peripersonal space. Motor Control, 8(1), 76–106.

    Article  PubMed  Google Scholar 

  • Heath, M., Rival, C., Neely, K., & Krigolson, O. (2006). Müller-Lyer figures influence the online reorganization of visually guided grasping movements. Experimental Brain Research, 169, 473–481.

    Article  PubMed  Google Scholar 

  • Hommel, B., Müsseler, J., Aschersleben, G., & Prinz, W. (2001). The theory of event coding (TEC): A framework for perception and action planning. Behavioral and Brain Sciences, 24(5), 849–878.

    Article  CAS  PubMed  Google Scholar 

  • Howard, L. A., & Tipper, S. (1997). Hand deviations away from visual cues: Indirect evidence for inhibition. Experimental Brain Research, 113(1), 144–152.

    Article  CAS  PubMed  Google Scholar 

  • Howard, L. A., Lupiáñez, J., & Tipper, S. P. (1999). Inhibition of return in a selective reaching task: An investigation of reference frames. The Journal of General Psychology, 126(4), 421–442.

    Article  CAS  PubMed  Google Scholar 

  • Ishihara, M., Jacquin-Courtois, S., Flory, V., Salemme, R., Imanaka, K., & Rossetti, Y. (2006). Interaction between space and number representations during motor preparation in manual aiming. Neuropsychologia, 44(7), 1009–1016.

    Article  PubMed  Google Scholar 

  • Klein, R. M. (2000). Inhibition of return. Trends in Cognitive Sciences, 4(4), 138–147.

    Article  CAS  PubMed  Google Scholar 

  • Lanshammar, H. (1982). On precision limits for derivatives numerically calculated from noisy data. Journal of Biomechanics, 15(6), 459–470.

    Article  CAS  PubMed  Google Scholar 

  • Larssen, B., Greeley, B., & Boyd, L. (2023). Are bilateral motor planning impairments during reverse visually guided reaching evidence of cognitive-motor impairment or a motor control strategy among stroke survivors and older adults? Journal of Exercise, Movement, and Sport (SCAPPS Refereed Abstracts Repository), 54(1).

  • Lee, D. (1999). Effects of exogenous and endogenous attention on visually guided hand movements. Cognitive Brain Research, 8(2), 143–156.

    Article  CAS  PubMed  Google Scholar 

  • Manzone, D. M., Manzone, J. X., Wang, X. M., Welsh, T. N., & Tremblay, L. (2023). Test Tube: On the Sensorimotor Costs of Virtual Environments. Journal of Exercise, Movement, and Sport (SCAPPS Refereed Abstracts Repository), 54(1).

  • Nashed, J. Y., Crevecoeur, F., & Scott, S. H. (2012). Influence of the behavioral goal and environmental obstacles on rapid feedback responses. Journal of Neurophysiology, 108(4), 999–1009.

    Article  PubMed  Google Scholar 

  • Neyedli, H. F., & Welsh, T. N. (2012). The processes of facilitation and inhibition in a cue–target paradigm: Insight from movement trajectory deviations. Acta Psychologica, 139(1), 159–165. https://doi.org/10.1016/j.actpsy.2011.11.001

    Article  PubMed  Google Scholar 

  • Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., ..., & Cournapeau, D. (2011). Scikit-learn: Machine Learning in Python. Journal of Machine Learning, 12, 2825–2830.

    MathSciNet  Google Scholar 

  • Peirce, J., Gray, J. R., Simpson, S., MacAskill, M., Höchenberger, R., Sogo, H., ..., & Lindeløv, J. K. (2019). PsychoPy2: Experiments in behavior made easy. Behavior Research Methods, 51(1), 195–203.

    Article  PubMed  PubMed Central  Google Scholar 

  • Posner, M. I. (1980). Orienting of Attention. Quarterly Journal of Experimental Psychology, 32(1), 3–25. https://doi.org/10.1080/00335558008248231

    Article  CAS  PubMed  Google Scholar 

  • Posner, M. I., & Cohen, Y. (1984). Components of visual orienting. Attention and Performance X: Control of Language Processes, 32, 531–556.

    Google Scholar 

  • Posner, M. I., Rafal, R. D., Choate, L. S., & Vaughan, J. (1985). Inhibition of return: Neural basis and function. Cognitive Neuropsychology, 2(3), 211–228.

    Article  Google Scholar 

  • Prinz, W. (1997). Perception and action planning. European Journal of Cognitive Psychology, 9(2), 129–154.

    Article  Google Scholar 

  • Ramsay, J. O., & Silverman, B. W. (2005). Functional data analysis (2nd ed.). Springer.

    Book  Google Scholar 

  • Ratcliff, R., & Rouder, J. N. (1998). Modeling response times for two-choice decisions. Psychological Science, 9(5), 347–356.

    Article  Google Scholar 

  • Resulaj, A., Kiani, R., Wolpert, D. M., & Shadlen, M. N. (2009). Changes of mind in decision-making. Nature, 461(7261), 263–266.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  • Rizzolatti, G., Riggio, L., Dascola, I., & Umiltá, C. (1987). Reorienting attention across the horizontal and vertical meridians: Evidence in favor of a premotor theory of attention. Neuropsychologia, 25(1), 31–40.

    Article  CAS  PubMed  Google Scholar 

  • Schmidt, E. (1989). Zur Theorie der linearen und nichtlinearen Integralgleichungen. In D. Hilbert, E. Schmidt, & A. Pietsch (Eds.), Integralgleichungen und Gleichungen mit unendlich vielen Unbekannten (pp. 190–233). Vieweg+Teubner Verlag. https://doi.org/10.1007/978-3-322-84410-1_3

    Chapter  Google Scholar 

  • Schoemann, M., O’Hora, D., Dale, R., & Scherbaum, S. (2021). Using mouse cursor tracking to investigate online cognition: Preserving methodological ingenuity while moving toward reproducible science. Psychonomic Bulletin & Review, 28(3), 766–787.

    Article  Google Scholar 

  • Schreven, S., Beek, P. J., & Smeets, J. B. (2015). Optimising filtering parameters for a 3D motion analysis system. Journal of Electromyography and Kinesiology, 25(5), 808–814.

    Article  PubMed  Google Scholar 

  • Smeets, J. B., & Brenner, E. (1999). A new view on grasping. Motor Control, 3(3), 237–271.

    Article  CAS  PubMed  Google Scholar 

  • Söderkvist, I. (2009). Using SVD for some fitting problems. Retrieved from https://www.ltu.se/cms_fs/1.51590!/svd-fitting.pdf. Accessed 11 Jul 2022.

  • Song, J.-H., & Nakayama, K. (2009). Hidden cognitive states revealed in choice reaching tasks. Trends in Cognitive Sciences, 13(8), 360–366. https://doi.org/10.1016/j.tics.2009.04.009

    Article  PubMed  Google Scholar 

  • Spivey, M. J., Grosjean, M., & Knoblich, G. (2005). Continuous attraction toward phonological competitors. Proceedings of the National Academy of Sciences, 102(29), 10393–10398.

    Article  CAS  Google Scholar 

  • Sternberg, S. (1969). The discovery of processing stages: Extensions of Donders’ method. Acta Psychologica, 30, 276–315.

    Article  Google Scholar 

  • Tipper, S. P., Lortie, C., & Baylis, G. C. (1992). Selective reaching: Evidence for action-centered attention. Journal of Experimental Psychology: Human Perception and Performance, 18(4), 891.

    CAS  PubMed  Google Scholar 

  • Tsay, J. S., Kim, H., Haith, A. M., & Ivry, R. B. (2022). Understanding implicit sensorimotor adaptation as a process of proprioceptive re-alignment. Elife, 11, e76639.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  • Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., ..., & Vázquez-Baeza, Y. (2020). SciPy 1.0: Fundamental algorithms for scientific computing in Python. Nature Methods, 17(3), 261–272. https://doi.org/10.1038/s41592-019-0686-2

  • Wang, X. M., & Bingham, G. P. (2019). Change in effectivity yields recalibration of affordance geometry to preserve functional dynamics. Experimental Brain Research, 237(3), 817–827.

    Article  PubMed  Google Scholar 

  • Wang, X. M., Smith, D., & Zhu, Q. (2023). A webcam-based machine learning approach for the three-dimensional range of motion evaluation. PLoS ONE, 18(10), e0293178. https://doi.org/10.1371/journal.pone.0293178

  • Wang, X. M., Karlinsky, A., Constable, M. D., Gregory, S. E., & Welsh, T. N. (2024). Social gaze cueing elicits facilitatory and inhibitory effects on movement execution when the model might act on an object. Quarterly Journal of Experimental Psychology 77(2), 230–241. https://doi.org/10.1177/17470218231162546

  • Welsh, T. N. (2011). The relationship between attentional capture and deviations in movement trajectories in a selective reaching task. Acta Psychologica, 137(3), 300–308.

    Article  PubMed  Google Scholar 

  • Welsh, T. N., & Elliott, D. (2004). Movement trajectories in the presence of a distracting stimulus: Evidence for a response activation model of selective reaching. The Quarterly Journal of Experimental Psychology Section A, 57(6), 1031–1057. https://doi.org/10.1080/02724980343000666

    Article  Google Scholar 

  • Welsh, T. N., Elliott, D., & Weeks, D. J. (1999). Hand deviations toward distractors Evidence for response competition: Evidence for response competition. Experimental Brain Research, 127, 207–212.

    Article  CAS  PubMed  Google Scholar 

  • Whitwell, R. L., & Goodale, M. A. (2013). Grasping without vision: Time normalizing grip aperture profiles yields spurious grip scaling to target size. Neuropsychologia, 51(10), 1878–1887.

    Article  PubMed  Google Scholar 

  • Wispinski, N. J., Gallivan, J. P., & Chapman, C. S. (2020). Models, movements, and minds: Bridging the gap between decision making and action. Annals of the New York Academy of Sciences, 1464(1), 30–51.

    Article  PubMed  Google Scholar 

  • Wolpert, D. M. (1997). Computational approaches to motor control. Trends in Cognitive Sciences, 1(6), 209–216.

    Article  CAS  PubMed  Google Scholar 

  • Yoxon, E., Constable, M. D., & Welsh, T. N. (2019). Probing the time course of facilitation and inhibition in gaze cueing of attention in an upper-limb reaching task. Attention, Perception, & Psychophysics, 81(7), 2410–2423. https://doi.org/10.3758/s13414-019-01821-5

    Article  Google Scholar 

Download references

Acknowledgments

We would like to thank Craig Chapman and an anonymous reviewer for their constructive feedback that helped to expand the functionalities of this toolkit. We would also like the thank members of the Centre for Motor Control in the Faculty of Kinesiology and Physical Education at the University of Toronto for their assistance that has made this project possible. Finally, we would also like to thank Damian Manzone, Luc Tremblay, and Bev Larssen for providing sample 2D movement data as demos.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Xiaoye Michael Wang.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wang, X.M., Welsh, T.N. TAT-HUM: Trajectory analysis toolkit for human movements in Python. Behav Res (2024). https://doi.org/10.3758/s13428-024-02378-4

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.3758/s13428-024-02378-4

Keywords

Navigation