micromotion
A Python package for measuring human micromotion: the small movement of a body that is standing, sitting or otherwise trying to stay still. It reads optical marker data, body-worn accelerometers, respiration belts and force plates, and reduces all of them to one measure.
That measure is quantity of motion—the average speed of a body part, band-limited to 0.2–5 Hz, in millimetres per second. It can be computed from every sensor family, because the shared abstraction is the frequency band rather than the instrument.
Install
pip install micromotion
Python 3.10 or newer, with numpy, scipy and pandas. There is no computer-vision or audio stack to install.
Quickstart
import micromotion as mm
rec = mm.read("mocap_data/A0001.tsv") # dispatches on content, not on the extension
head = rec.marker("P01") # (n_samples, 3), gaps already NaN
result = mm.qom(head, rec.fs, kind="position", unit=rec.unit)
print(result.median_mm_s, result.mean_mm_s)
Report the median, and say that it is the median. The mean and the median can rank the same recordings differently, so both are returned and neither is chosen for the caller.
Do not name a local variable mm. The conventional alias collides with a mean and with a value
in millimetres, and rebinding it replaces the package for the rest of the file.
Documentation
| Reference documentation | how to use it, every function, the conventions |
| Wiki | traps, worked recipes, design decisions |
| Changelog | what changed between releases |
Read Getting started first, then The three bands, which is the one convention that cannot be skipped. Reading files covers what each reader handles, which axis is vertical in which system, and the traps that produce plausible numbers rather than errors.
What is in it
| Module | Contents |
|---|---|
qom |
quantity of motion from position or acceleration, in three named variants |
filters |
the band definitions—BAND, WIDEBAND, OPTICAL_LEGACY_BAND—with band-pass, low-pass, high-pass and notch |
resample |
rate measurement, downsample-only resampling, irregular-to-regular gridding, gap handling |
io |
one reader per file layout, a content sniffer, and the per-channel rate and resolution checks |
record |
MotionRecord, the common type every reader returns |
validate |
checks that fail loudly on silently-wrong data |
posture, balance |
sway geometry, spatial extent, centre-of-pressure measures |
spectral, physio |
cardiac and respiratory peaks, band power, breathing rate and breath phase |
dynamics |
detrended fluctuation analysis, multifractality, recurrence, entropy, surrogates |
group |
whether several people moved at the same moments |
align |
offsets between instruments that share no clock |
circular |
directional statistics, including the axial tests postural sway needs |
features |
feature_vector, one fixed set of eleven descriptors per recording |
equivalence |
stating that an effect is absent rather than failing to show it is present |
descriptors |
how many independent dimensions a descriptor set holds, and whether a measure is a trait |
Readers: Qualisys and Qualisys-style TSV in all three header shapes, Sverm, Axivity AX3,
Physics Toolbox phone logs, Equivital, Wii balance board, and Artinis fNIRS. read dispatches
on content rather than on extension, because in this field the extension is frequently wrong.
Licence and credit
GPL-3.0-or-later. Built at the fourMs lab, RITMO Centre for Interdisciplinary Studies in Rhythm, Time and Motion, University of Oslo. If you use the package, please cite it—see CITATION.cff—and cite the underlying methods too, since the Methods page gives a reference for each.
Issues and pull requests are welcome at fourMs/micromotion. A case where a default here gives a misleading answer is the most useful kind of issue to file.
Related toolboxes
These come out of the same lab, as separate packages with separate release cycles. They are built to be used together and share several implementations, so a measure computed in one agrees with the same measure computed in another.
- Musical Gestures Toolbox (
musicalgestures)—video and audio: motiongrams, videograms, and motion analysis from ordinary video files - ambiscape—soundscapes: the sonic ambience of a place, across level, spectral, spatial, temporal, ecological and source descriptors
- musiscape—music collections: comparing many tracks and albums held as audio files in folders
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file micromotion-1.9.0.tar.gz.
File metadata
- Download URL: micromotion-1.9.0.tar.gz
- Upload date:
- Size: 331.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03a065a6102ea51aa994f7271f05a5437317193ad5f6b9fcd7fcc4e37e98ec97
|
|
| MD5 |
64f30e7c78f022c30cd20da5d24243d5
|
|
| BLAKE2b-256 |
1997c704a824c377c58d986b72cacddc7baa77f4e1714fec3a4b30a469b91118
|
Provenance
The following attestation bundles were made for micromotion-1.9.0.tar.gz:
Publisher:
publish.yml on fourMs/micromotion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
micromotion-1.9.0.tar.gz -
Subject digest:
03a065a6102ea51aa994f7271f05a5437317193ad5f6b9fcd7fcc4e37e98ec97 - Sigstore transparency entry: 2440125982
- Sigstore integration time:
-
Permalink:
fourMs/micromotion@375dd2699593459d64c9f284bbadcb0573983cb1 -
Branch / Tag:
refs/tags/v1.9.0 - Owner: https://github.com/fourMs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@375dd2699593459d64c9f284bbadcb0573983cb1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file micromotion-1.9.0-py3-none-any.whl.
File metadata
- Download URL: micromotion-1.9.0-py3-none-any.whl
- Upload date:
- Size: 120.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e483293efbd33735ef2268f43d73118d834b081c615fa35256a0f9f22421c9a
|
|
| MD5 |
2abfb54ecf07024818596fdb343f7148
|
|
| BLAKE2b-256 |
ede8d48ac28d47c2bc1d0199dfb50c60531a94e920c0d8006c5d0a056dda7ef8
|
Provenance
The following attestation bundles were made for micromotion-1.9.0-py3-none-any.whl:
Publisher:
publish.yml on fourMs/micromotion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
micromotion-1.9.0-py3-none-any.whl -
Subject digest:
6e483293efbd33735ef2268f43d73118d834b081c615fa35256a0f9f22421c9a - Sigstore transparency entry: 2440126602
- Sigstore integration time:
-
Permalink:
fourMs/micromotion@375dd2699593459d64c9f284bbadcb0573983cb1 -
Branch / Tag:
refs/tags/v1.9.0 - Owner: https://github.com/fourMs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@375dd2699593459d64c9f284bbadcb0573983cb1 -
Trigger Event:
release
-
Statement type: