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.5.tar.gz (21.5 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.5-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mobi_motion_tracking-0.1.5.tar.gz
Algorithm Hash digest
SHA256 9e47f13873f05d28948dc64736e4a1b336fc95f6b8e13102be73d96fa93f48f5
MD5 e4fe00804abcb7cee861af6f828bb12f
BLAKE2b-256 f6a3a5dfac594b1a9adf66989b5a2baf25544bedb4c4f4091836a709910c6e91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mobi_motion_tracking-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 75c3314c383f8456423f2e6ba6325b8037c70e014cd10797d4af0a386c58b283
MD5 36455d5cf3c830fa994d5d4e9884bd86
BLAKE2b-256 d34c0a44cef52cf53aba28a2c0e4372a1fab620cf0d7492a04e3569e86e55aea

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