Skip to main content

python package to process 3d motion tracking data

Project description

mobi_motion_tracking

A python package for 3D motion tracking data processing.

Build codecov Ruff stability-experimental LGPL--2.1 License pages

Welcome to mobi_motion_tracking, a Python library designed for processing and analyzing captured motion tracking data. This library provides a set of tools to analyze 3D skeletal data against a gold standard and calculate a similarity metric between them. We provide a labelled output file containing all specified, calculated metrics and metadata for post-processing analysis.

Supported formats & devices

The package currently supports the following formats:

Format Manufacturer Device Implementation status
XLSX Microsoft KINECT
XLSX StereoLabs ZED 2i

Special Note This package works off the assumption that all input participant files are named according to their participant ID containing only digits in the correct format i.e. (0000.xlsx). It is also assummed that each participant file contains 1 or more sheets of data per sequence. The sheets are expected to be named based off the string 'seq' and an integer representing the sequence i.e. ('seq1'). The file names can be any length of digits and there can be an unlimited number of sequences. Sequences will only be processed if indicated in the input list.

It is assumed that any gold file contains the string 'gold' or 'Gold' in its basename.

It is also expected that there are no missing data points prior to running the package.

Processing pipeline implementation

The main processing pipeline of the mobi_motion_tracking module can be described as follows:

  • Data loading: Data is loaded per participant, per sequence as a dataframe. If a file is named incorrectly, is not in the right format, or the sequence does not exist for that participant, it is skipped.
  • Data preprocessing: The raw subject and gold standard joint data are centered to the hip for every frame. The average lengths of all skeletal segments of the gold standard data are calculated, and the centered subject joint data is normalized to the average gold lengths.
  • Metrics Calculation: Calculates specified similarity metrics on the preprocessed data, namely DTW (dynamic Time Warping). DTW is the only possible option at this current developmental stage.

Installation

Install this package via :

pip install mobi_motion_tracking

Or get the newest development version via:

pip install git+https://github.com/childmindresearch/mobi-motion-tracking

Quick start

Using mobi_motion_tracking through the command-line:

Run single files:

mobi_motion_tracking -d /subject/file/path/000.xlsx -g /gold/file/path/gold.xlsx -s "1,2,3" -a "dtw"

Run entire directories:

mobi_motion_tracking -d /subject/file/dir -g /gold/file/path/gold.xlsx -s "1,2,3" -a "dtw"

Using mobi_motion_tracking through a python script or notebook:

Running single files:

from mobi_motion_tracking.core import orchestrator
import pathlib

# Define data file path, gold file path, sequence list, and algorithm
# Support for saving as .ndjson
data_path = pathlib.Path("100.xlsx")
gold_path = pathlib.Path("Gold.xlsx")
sequence = [1, 2, 3]
algorithm = "dtw"

# Run the orchestrator
results = orchestrator.run(
    experimental_path=data_path,
    gold_path=gold_path,
    sequence=sequence,
    algorithm=algorithm,
)


# Data available in list of results.
subject1_seq1 = results[0][0]

participant_ID = subject1_seq1["participant_ID"]
sheetname = subject1_seq1["sheetname"]
method = subject1_seq1["method"]
distance = subject1_seq1["distance"]

Running entire directories:

from mobi_motion_tracking.core import orchestrator
import pathlib

# Define data file path, gold file path, sequence list, and algorithm
# Support for saving as .ndjson
data_path = pathlib.Path("")
gold_path = pathlib.Path("Gold.xlsx")
sequence = [1, 2, 3]
algorithm = "dtw"

# Run the orchestrator
results = orchestrator.run(
    experimental_path=data_path,
    gold_path=gold_path,
    sequence=sequence,
    algorithm=algorithm,
)


# Data available in list of results.
subject1_seq1 = results[0][0]

participant_ID = subject1_seq1["participant_ID"]
sheetname = subject1_seq1["sheetname"]
method = subject1_seq1["method"]
distance = subject1_seq1["distance"]

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

mobi_motion_tracking-0.1.2.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

mobi_motion_tracking-0.1.2-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file mobi_motion_tracking-0.1.2.tar.gz.

File metadata

  • Download URL: mobi_motion_tracking-0.1.2.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mobi_motion_tracking-0.1.2.tar.gz
Algorithm Hash digest
SHA256 51cca3ec0377b0b8eb0efe8e8c508ec92a7ab5eb2a544f288dd24be0426522ff
MD5 c28ae1c856d4f4064e19d990c7458a6d
BLAKE2b-256 f493f78bff7fd13ddf4458869d066928561e6e8e5a01a039d3000e869c4a041e

See more details on using hashes here.

File details

Details for the file mobi_motion_tracking-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mobi_motion_tracking-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4477b6c41a2c52c71b9d5f158980489227ae770db5d718828873b9e5b86e6452
MD5 41eac4a78afcdf57850447310055af07
BLAKE2b-256 30721a3d11593d3c6ccf5a3801e2d46e4fe7054486a864bd50344dd3d72b79f2

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