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: Coming soon!

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.

Installing from Github

If you want to install the latest version from Github, you can use the following command:

# For gaitmap
pip install "git+https://github.com/mad-lab-fau/gaitmap.git" --upgrade
# For gaitmap_mad
pip install "git+https://github.com/mad-lab-fau/gaitmap.git#subdirectory=gaitmap_mad"

Note, that we don't guarantee that the latest version on Github is stable.

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. Have a look at our example to get an understanding of what gaitmap can do: Example
  2. Understand the common datatypes we use: Common Datatypes, Coordinate Systems
  3. Learn how to prepare your own data (or play around with example data): Prepare Data
  4. 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).

Contributing

We want to hear from you (and we want your algorithms)!

👍 We are always happy to receive feedback and contributions. If you run into any issues or have any questions, please open an issue on Github or start a discussions.

📚 If you are using gaitmap in your research or project, we would love to hear about it and link your work here! The show and tell section in the discussions is a great place for this.

💻 And most importantly, we want your algorithms! If you have an algorithm that you think would be a good fit for gaitmap, open an issue, and we can discuss how to integrate it. We are happy to help you with the integration process. Even if you are not confident in your Python skills, we can discuss ways to get your algorithm into gaitmap.

For all these topics check out our contributing guide for more details.

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.1.tar.gz (119.6 kB view details)

Uploaded Source

Built Distribution

gaitmap-2.2.1-py3-none-any.whl (149.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gaitmap-2.2.1.tar.gz
Algorithm Hash digest
SHA256 0629bc69248184c93a2ccb6c94d33e879566aab66abed0677dbf98de122ba972
MD5 b5200a6ec8cbb6eec43972bc7aa0cc53
BLAKE2b-256 b5cbc861ea18a28e209d05ea1fd5bf5a86979d5b27355e8a94b3213a6a1e0538

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gaitmap-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce763c85916958b2fa68654382dd4291c5757293058b3045efd4ff84ba0a7e18
MD5 a051bcc5b590a67aae22811ef9307e6a
BLAKE2b-256 112e8007804bf566f5cafc930c671da4cecfd410d328a4948365fc9eacbf044a

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