Traja

Traja: A Python toolbox for animal trajectory analysis - Published in JOSS (2021)

https://github.com/traja-team/traja

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

animal-behavior python spatial-data-analysis time-series-analysis trajectory-analysis

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 87% confidence
Last synced: 4 months ago · JSON representation ·

Repository

Python tools for spatial trajectory and time-series data analysis

Basic Info
  • Host: GitHub
  • Owner: traja-team
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: master
  • Homepage: https://traja.readthedocs.io
  • Size: 9.74 MB
Statistics
  • Stars: 113
  • Watchers: 9
  • Forks: 25
  • Open Issues: 35
  • Releases: 10
Topics
animal-behavior python spatial-data-analysis time-series-analysis trajectory-analysis
Created almost 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Citation

README.rst

Traja |Python-ver| |Travis| |PyPI| |Conda| |RTD| |Gitter| |Black| |License| |Binder| |Codecov| |DOI| |JOSS|
===========================================================================================================

|Colab|

.. |Python-ver| image:: https://img.shields.io/badge/python-3.6+-blue.svg
    :target: https://www.python.org/downloads/release/python-360/
    :alt: Python 3.6+

.. |Travis| image:: https://travis-ci.org/traja-team/traja.svg?branch=master
    :target: https://travis-ci.org/traja-team/traja

.. |PyPI| image:: https://badge.fury.io/py/traja.svg
    :target: https://badge.fury.io/py/traja

.. |Conda| image:: https://img.shields.io/conda/vn/conda-forge/traja.svg
    :target: https://anaconda.org/conda-forge/traja

.. |Gitter| image:: https://badges.gitter.im/traja-chat/community.svg
    :target: https://gitter.im/traja-chat/community

.. |RTD| image:: https://readthedocs.org/projects/traja/badge/?version=latest
    :target: https://traja.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/ambv/black

.. |License| image:: https://img.shields.io/badge/License-MIT-blue.svg
    :target: https://opensource.org/licenses/MIT
    :alt: License: MIT

.. |Binder| image:: https://mybinder.org/badge_logo.svg
    :target: https://mybinder.org/v2/gh/justinshenk/traja/master?filepath=demo.ipynb

.. |Codecov| image:: https://codecov.io/gh/traja-team/traja/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/traja-team/traja

.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5069231.svg
   :target: https://doi.org/10.5281/zenodo.5069231

.. |Colab| image:: https://colab.research.google.com/assets/colab-badge.svg
   :target: https://colab.research.google.com/github/justinshenk/traja/blob/master/demo.ipynb
   
.. |JOSS| image:: https://joss.theoj.org/papers/0f25dc08671e0ec54714f09597d116cb/status.svg
   :target: https://joss.theoj.org/papers/0f25dc08671e0ec54714f09597d116cb

Traja is a Python library for trajectory analysis. It extends the capability of
pandas DataFrame specific for animal trajectory analysis in 2D, and provides
convenient interfaces to other geometric analysis packages (eg, R and shapely).

Introduction
------------

The traja Python package is a toolkit for the numerical characterization
and analysis of the trajectories of moving animals. Trajectory analysis
is applicable in fields as diverse as optimal foraging theory,
migration, and behavioral mimicry (e.g. for verifying similarities in
locomotion). A trajectory is simply a record of the path followed by a
moving animal. Traja operates on trajectories in the form of a series of
locations (as x, y coordinates) with times. Trajectories may be obtained
by any method which provides this information, including manual
tracking, radio telemetry, GPS tracking, and motion tracking from
videos.

The goal of this package (and this document) is to aid biological
researchers, who may not have extensive experience with Python, to
analyze trajectories without being restricted by a limited knowledge of
Python or programming. However, a basic understanding of Python is
useful.

If you use traja in your publications, please cite the repo 

.. code-block::

    @software{justin_shenk_2019_3237827,
      author       = {Justin Shenk and
                      the Traja development team},
      title        = {justinshenk/traja},
      month        = jun,
      year         = 2019,
      publisher    = {Zenodo},
      version      = {latest},
      doi          = {10.5281/zenodo.3237827},
      url          = {https://doi.org/10.5281/zenodo.3237827}
    }


Installation and setup
----------------------

To install traja with conda, run

``conda install -c conda-forge traja``

or with pip

``pip install traja``.

Import traja into your Python script or via the Python command-line with
``import traja``.

Trajectories with traja
-----------------------

Traja stores trajectories in pandas DataFrames, allowing any pandas
functions to be used.

Load trajectory with x, y and time coordinates:

.. code-block:: python

    import traja

    df = traja.read_file('coords.csv')

Once a DataFrame is loaded, use the ``.traja`` accessor to access the
visualization and analysis methods:

.. code-block:: python

    df.traja.plot(title='Cage trajectory')


Analyze Trajectory
------------------

.. csv-table:: The following functions are available via ``traja.trajectory.[method]``
   :header: "Function", "Description"
   :widths: 30, 80
   
   "``calc_derivatives``", "Calculate derivatives of x, y values "
   "``calc_turn_angles``", "Calculate turn angles with regard to x-axis "
   "``transitions``", "Calculate first-order Markov model for transitions between grid bins"
   "``generate``", "Generate random walk"
   "``resample_time``", "Resample to consistent step_time intervals"
   "``rediscretize_points``", "Rediscretize points to given step length"
   
For up-to-date documentation, see `https://traja.readthedocs.io `_.

Random walk
-----------

Generate random walks with

.. code-block:: python

    df = traja.generate(n=1000, step_length=2)
    df.traja.plot()

.. image:: https://raw.githubusercontent.com/justinshenk/traja/master/docs/source/_static/walk_screenshot.png
   :alt: walk\_screenshot.png


Resample time
-------------
``traja.trajectory.resample_time`` allows resampling trajectories by a ``step_time``.


Flow Plotting
-------------

.. code-block:: python

    df = traja.generate()
    traja.plot_surface(df)

.. image:: https://traja.readthedocs.io/en/latest/_images/sphx_glr_plot_average_direction_001.png
   :alt: 3D plot

.. code-block:: python

    traja.plot_quiver(df, bins=32)

.. image:: https://traja.readthedocs.io/en/latest/_images/sphx_glr_plot_average_direction_002.png
   :alt: quiver plot

.. code-block:: python

    traja.plot_contour(df, filled=False, quiver=False, bins=32)

.. image:: https://traja.readthedocs.io/en/latest/_images/sphx_glr_plot_average_direction_003.png
   :alt: contour plot

.. code-block:: python

    traja.plot_contour(df, filled=False, quiver=False, bins=32)

.. image:: https://traja.readthedocs.io/en/latest/_images/sphx_glr_plot_average_direction_004.png
   :alt: contour plot filled

.. code-block:: python

    traja.plot_contour(df, bins=32, contourfplot_kws={'cmap':'coolwarm'})

.. image:: https://traja.readthedocs.io/en/latest/_images/sphx_glr_plot_average_direction_005.png
   :alt: streamplot

Acknowledgements
----------------

traja code implementation and analytical methods (particularly
``rediscretize_points``) are heavily inspired by Jim McLean's R package
`trajr `__. Many thanks to Jim for his
feedback.

Owner

  • Name: Traja
  • Login: traja-team
  • Kind: organization

Spatial trajectory analysis and modeling

JOSS Publication

Traja: A Python toolbox for animal trajectory analysis
Published
July 18, 2021
Volume 6, Issue 63, Page 3202
Authors
Justin Shenk ORCID
VisioLab, Berlin, Germany, Radboud University, Nijmegen, Netherlands
Wolf Byttner ORCID
Rapid Health, London, England, United Kingdom
Saranraj Nambusubramaniyan ORCID
VisioLab, Berlin, Germany
Alexander Zoeller ORCID
Independent researcher
Editor
Juan Nunez-Iglesias ORCID
Tags
animal behavior trajectory multivariate time series neuroscience

Citation (CITATION)

@software{justin_shenk_2019_3237827,
  author       = {Justin Shenk and
                  the Traja development team},
  title        = {justinshenk/traja},
  month        = jun,
  year         = 2019,
  publisher    = {Zenodo},
  version      = {latest},
  doi          = {10.5281/zenodo.3237827},
  url          = {https://doi.org/10.5281/zenodo.3237827}
}

GitHub Events

Total
  • Watch event: 11
Last Year
  • Watch event: 11

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 946
  • Total Committers: 9
  • Avg Commits per committer: 105.111
  • Development Distribution Score (DDS): 0.384
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Justin Shenk s****n@g****m 583
Wolf Byttner w****f@r****k 181
Saran-nns s****d@g****m 164
Madhav Thakker m****r@M****l 5
Alec Zoeller a****r@g****m 4
Madhav Thakker t****v@g****m 4
JarnoRFB r****e@w****e 3
Alex Liberzon a****n@g****m 1
Jonas Otten j****n@u****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 60
  • Total pull requests: 42
  • Average time to close issues: 2 months
  • Average time to close pull requests: 7 days
  • Total issue authors: 13
  • Total pull request authors: 9
  • Average comments per issue: 1.27
  • Average comments per pull request: 1.48
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • justinshenk (23)
  • WolfByttner (13)
  • Saran-nns (8)
  • JarnoRFB (5)
  • a-paxton (3)
  • MaddyThakker (2)
  • miaowangcissy (1)
  • alisonsin (1)
  • rodrigo-j-goncalves (1)
  • dhivya-jayaraman (1)
  • AbigailMcGovern (1)
  • Paddy159 (1)
  • OmegAshEnr01n (1)
Pull Request Authors
  • justinshenk (12)
  • WolfByttner (11)
  • Saran-nns (5)
  • MaddyThakker (5)
  • JarnoRFB (3)
  • dependabot[bot] (2)
  • jootten (2)
  • alexlib (1)
  • aleczoeller (1)
Top Labels
Issue Labels
enhancement (7) good first issue (3) help wanted (2) invalid (2) bug (1) question (1)
Pull Request Labels
dependencies (2)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 90 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 51
  • Total maintainers: 1
pypi.org: traja

Traja is a trajectory analysis and visualization tool

  • Versions: 36
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 90 Last month
Rankings
Stargazers count: 7.5%
Forks count: 8.0%
Dependent packages count: 10.1%
Average: 12.7%
Downloads: 16.4%
Dependent repos count: 21.5%
Maintainers (1)
Last synced: 4 months ago
conda-forge.org: traja
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 32.0%
Dependent repos count: 34.0%
Stargazers count: 34.3%
Average: 37.9%
Dependent packages count: 51.2%
Last synced: 4 months ago

Dependencies

requirements/docs.txt pypi
  • codecov *
  • fastdtw *
  • ipython *
  • matplotlib *
  • networkx *
  • numpy ==1.18.5
  • pandas >=1.2.0
  • pytest *
  • pytest-cov *
  • scikit-learn *
  • scipy *
  • seaborn *
  • shapely *
  • sphinx *
  • sphinx-gallery *
  • sphinx_rtd_theme *
  • torch *
requirements/extra.txt pypi
  • fastdtw *
  • h5py *
  • ipython *
  • networkx *
  • numba >=0.50.0
  • pre-commit *
  • pyDOE2 >=1.3.0
  • pytest *
  • scikit-learn *
  • scipy >=1.4.1
  • seaborn *
  • shapely *
  • torch *
requirements.txt pypi
  • fastdtw *
  • matplotlib *
  • networkx *
  • numpy ==1.18.5
  • pandas >=1.2.0
  • scikit-learn *
  • scipy >=1.4.1
  • seaborn *
  • shapely *
  • statsmodels *
  • torch *
.github/workflows/draft-pdf.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite
.github/workflows/tests.yaml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • conda-incubator/setup-miniconda v2 composite
environment.yml conda
  • ipython
  • matplotlib
  • networkx
  • numba >=0.50.0
  • numpy
  • pandas
  • pillow
  • pip
  • pytest >=8.0.0
  • pytorch
  • scikit-learn
  • scipy
  • seaborn
  • shapely
  • sphinx
  • statsmodels
docs/environment.yml pypi
pyproject.toml pypi
requirements/dev.txt pypi
setup.py pypi