Skip to main content

Traja is a trajectory analysis and visualization tool

Project description

traja

Trajectory Analysis in Python

traja extends the capability of pandas DataFrame specific for animal trajectory analysis in 2D, and provides convenient interfaces to other geometric analysis packages (eg, shapely).

Introduction

The traja Python package is a toolkit for the numerical characterisation and analysis of the trajectories of moving animals. Trajectory analysis is applicable in fields as diverse as optimal foraging theory, migration, and behavioural mimicry (e.g. for verifying similarities in locomotion). A trajectory is simply a record of the path followed by a moving animal. Trajr 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 analyse trajectories without being handicapped 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 [add citation].

Installation and setup

To install traja onto your system, run

pip install traja

or download the zip file and run the graphical user interface [coming soon].

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:: 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:: python

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

.. image:: https://raw.githubusercontent.com/justinshenk/traja/master/docs/source/_static//dvc_screenshot.png :alt: dvc_screenshot

Random walk

Generate random walks with

.. code:: 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

Demo

Coming soon.

Acknowledgements

traja code implementation and analytical methods (particularly rediscretize_points) are heavily inspired by Jim McLean's R package trajr <https://github.com/JimMcL/trajr>__. Many thanks to Jim for his feedback.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traja-0.0.8.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traja-0.0.8-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file traja-0.0.8.tar.gz.

File metadata

  • Download URL: traja-0.0.8.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.2

File hashes

Hashes for traja-0.0.8.tar.gz
Algorithm Hash digest
SHA256 873c671ccb48a79b1e6e48c70ab9b43819f96241bb339aabacc1ed2e6afd3896
MD5 ba2535674bb30eb827da88bce080ae90
BLAKE2b-256 8db1e006e6d25dc41814a2ca4acb18f9dd9caff3ce58fb8bacc4c7219285d7f1

See more details on using hashes here.

File details

Details for the file traja-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: traja-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 46.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.2

File hashes

Hashes for traja-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 7089292cc957967e9bf67a20a8670092fc52f81b60b1f05714e300b3d6979164
MD5 addb454ef410003846c399f3cb00a2b9
BLAKE2b-256 3f1dafff8cf28d1acf228c026abea0888323fc80e5df7b39e3f5f56e24827503

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page