Introduction

Trajectory classification is a challenging task and fundamental for analysing the movement of nanoparticles, bacteria, cells and active matter in general.

We propose TrajPy as an easy pythonic solution to be applied in studies that demand trajectory classification. It requires little knowledge of programming and physics to be used by nonspecialists.

TrajPy is composed of three main units of code:

  • The training data set is built using a trajectory generator

  • Features are computed for characterizing the trajectories

  • The classifier built on Scikit-Learn.

Our dataset and Machine Learning (ML) model are available for use, as well the generator for building your own database.

Graphical User Interface

A graphical user interface is available as a separate package, trajpy-ui, which can be installed alongside TrajPy:

pip install trajpy-ui

The UI provides an interactive interface for loading trajectories, computing features and visualising results without writing any Python code.

Synthetic Dataset

A pre-built labelled dataset generated with TrajPy is publicly available on Zenodo and can be used directly to train or benchmark trajectory classifiers:

Dataset generated by TrajPy for training a trajectory classifier. https://zenodo.org/records/3627650

For more details: https://trajpy.readthedocs.io

The dataset contains four trajectory classes:

  • Normal diffusion – Fickian Brownian motion

  • Direct motion – ballistic / superdiffusive transport

  • Anomalous diffusion – subdiffusion or superdiffusion characterised by a non-linear MSD

  • Confined diffusion – motion restricted to a bounded spatial region

Each sample is described by the following features:

Column

Description

alpha

Anomalous exponent derived from the mean squared displacement

ratio

Mean squared displacement ratio (short-time vs long-time scaling)

df

Fractal dimension of the trajectory

anisotropy

Anisotropy of the radius of gyration tensor

kurtosis

Kurtosis of the radius of gyration

straightness

Similarity of the trajectory to a straight line

gaussianity

Similarity of the displacement distribution to a Gaussian

trappedness

Probability that the particle is spatially trapped

diffusivity

Short-time diffusion coefficient

efficiency

Efficiency of the particle’s movement