Skip to main content

The Gait and Movement Analysis Package - Your definite guide to reliable IMU based human movement analysis.

Project description

PyPI pipeline status codecov Documentation Status Code style: black PyPI - Downloads

gaitmap - The Gait and Movement Analysis Package

gaitmap provides a set of algorithms to analyze your IMU movement data (with a focus on foot-worn IMUs) without getting into your way.

Documentation: gaitmap.readthedocs.io
Learn More about the gaitmap ecosystem: TODO: Website Link

Installation

Gaitmap is split into two packages: gaitmap and gaitmap_mad (Learn more. To get access to all available algorithms, you need to install both packages.

pip install gaitmap gaitmap_mad --upgrade

Both packages are always released together and have the same version number. We don't recommend mixing different versions of gaitmap and gaitmap_mad.

Note: gaitmap-mad is published under a AGPL-3.0 license, while gaitmap is published under a MIT license. Please, check the License section below for more details.

In case you are sure that AGPL-3.0 is compatible with your project, you can install gaitmap_mad without any downsides. Otherwise, just install gaitmap and check the API-docu page of the individual algorithms if they are available in gaitmap only.

Enabling specific features

Hidden Markov Models

To use the HMM (anything imported from gaitmap.stride_segmentation.hmm) based algorithms make sure you install gaitmap with the hmm extra.

pip install gaitmap_mad "gaitmap[hmm]" --upgrade

This installs the pomegranate package, which is the basis for the HMM implementation. Note, that we only support the pomegranate version >=0.14.2,<=0.14.6 and that pomegrante is not compatible with Python 3.10.

We are working on upgrading to a newer version of pomegranate, but this is not a priority at the moment. You can track the progress in the pull request.

Supported Python versions

gaitmap is tested against Python 3.8 and 3.9 at the moment. We expect most features to work with all Python versions >= 3.8, but because of some known issues (see specific features above) we do not officially support them.

Working with Algorithms

gaitmap is designed to be a toolbox and not a single algorithm. This means, that you are expected to pick and use individual algorithms.

To get started with gaitmap we recommend to follow these steps:

  1. Understand the common datatypes we use: Common Datatypes, Coordinate Systems
  2. Learn how to prepare your own data (or play around with example data): TODO
  3. Check the API docs and examples for available algorithms: API Docs, Examples

Each algorithm is implemented as a class, which is initialized with the required parameters. In many cases the default parameters are sufficient, but to get the best results on your data, you should adapt them.

from gaitmap.stride_segmentation import BarthDtw

stride_segmenter = BarthDtw(max_cost=2.5)

After initialization, you can apply the algorithm to your data (each group of algorithm has a different action method):

my_imu_data = ...
stride_segmenter.segment(my_imu_data, sampling_rate_hz=204.8)

Results are stored as parameters of the algorithm object (with a trailing underscore):

segmented_strides = stride_segmenter.stride_list_

Most algorithms have additional results available to provide further information.

dtw_warping_path = stride_segmenter.paths_

To build a full gait analysis pipeline you can combine multiple algorithms (Example). You can even substitute your own algorithms (Guide) or use the provided tooling to validate and optimize your algorithms using tpcp (General Guide, Example).

Citation

If you use gaitmap in your research we would appreciate a citation. This helps us to justify the time we invest in the development and maintenance of the library.

We currently prepare a paper to describe the gaitmap library in detail. Until then, please simply cite the repository.

If you use a specific algorithm please also make sure you cite the original paper of the algorithm! We recommend the following citation style:

We used the algorithm proposed by Author et al. [paper-citation], implemented by the Gaitmap package [gaitmap-citation].

License

The gaitmap (which includes most algorithms) is published under a MIT license. This is a permissive license, which allows you to use the code in nearly any way you want, as long as you include the original license in you modified version.

gaitmap_mad is published under a AGPL-3.0 license. This only affects algorithms that were developed by the MaD Lab in collaboration with industry partners. The AGPL-3.0 license is a copyleft license, which if you integrate gaitmap_mad into your software and provide it to others (either as a service or as a product), you have to publish your software under a compatible open source license. Please, check the AGPL-3.0 license for more details and make sure you understand the implications.

If you need to use gaitmap_mad in a closed source project, please contact us for a potential commercial license.

For Developers

The Development Guides have detailed information for all new developers.

Here some quick references Install Python >=3.8 and poetry. Then run the commands below to get the latest source and install the dependencies:

git clone https://github.com/mad-lab-fau/gaitmap.git
# For Python 3.8 and 3.9 (and if you need to work on hmm)
poetry install --all-extras
# For Python >=3.10 (you can not work on hmm stuff with this)
poetry install -E stats

Warning: Building the docs currently only works in 3.8 and 3.9 with all extras installed.

Note, that you don't need to care about the gaitmap_mad subpackage. All dependencies are specified in the main pyproject.toml and the gaitmap_mad will be installed in editable mode when running poetry install.

To run any of the tools required for the development workflow, use the poe commands:

poetry run poe
...
CONFIGURED TASKS
  format            
  lint              Lint all files with Prospector.
  check             Check all potential format and linting issues.
  test              Run Pytest with coverage.
  docs              Build the html docs using Sphinx.
  register_jupyter  Register the gaitmap environment as a Jupyter kernel for testing.
  version           Bump version in all relevant places.
  bump_dev          Update all dev dependencies to their @latest version.

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

gaitmap-2.2.0.tar.gz (117.8 kB view details)

Uploaded Source

Built Distribution

gaitmap-2.2.0-py3-none-any.whl (147.6 kB view details)

Uploaded Python 3

File details

Details for the file gaitmap-2.2.0.tar.gz.

File metadata

  • Download URL: gaitmap-2.2.0.tar.gz
  • Upload date:
  • Size: 117.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for gaitmap-2.2.0.tar.gz
Algorithm Hash digest
SHA256 2dcd86c3b59fd7b19c782f7c0338e69abbe5d1c37ee417a42cb8b8ea71195813
MD5 9838373d147328a2c84f58b8689423be
BLAKE2b-256 fd93f01ae5789fad743384c89906dff6c05b78dbde81976367e5655340325904

See more details on using hashes here.

File details

Details for the file gaitmap-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: gaitmap-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 147.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for gaitmap-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f746e584fdb5be9e410c3492fea617992f8cd02b60979f8f452fa396b954afef
MD5 111b60cc98d3a5947fbf88fac2cf4e69
BLAKE2b-256 f957181ba3eb0da0670c44162bf18bf7f244fcba4117435edea8ef8bdc5143a3

See more details on using hashes here.

Supported by

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