Skip to main content

pyomeca is a python library allowing to carry out a complete biomechanical analysis; in a simple, logical and concise way

Project description

logo DOI badge Actions Status Coverage Status PyPI Downloads

Pyomeca is a python library allowing you to carry out a complete biomechanical analysis; in a simple, logical and concise way.

Pyomeca documentation

See Pyomeca's documentation site.

Example

Pyomeca implements specialized functionalities commonly used in biomechanics. As an example, let's process the electromyographic data contained in this c3d file.

You can follow along without installing anything by using our binder server: Binder

from pyomeca import Analogs

data_path = "../tests/data/markers_analogs.c3d"
muscles = [
    "Delt_ant",
    "Delt_med",
    "Delt_post",
    "Supra",
    "Infra",
    "Subscap",
]
emg = Analogs.from_c3d(data_path, suffix_delimiter=".", usecols=muscles)
emg.plot(x="time", col="channel", col_wrap=3)

svg

emg_processed = (
    emg.meca.band_pass(order=2, cutoff=[10, 425])
    .meca.center()
    .meca.abs()
    .meca.low_pass(order=4, cutoff=5, freq=emg.rate)
    .meca.normalize()
)

emg_processed.plot(x="time", col="channel", col_wrap=3)

svg

import matplotlib.pyplot as plt

fig, axes = plt.subplots(ncols=2, figsize=(10, 4))

emg_processed.mean("channel").plot(ax=axes[0])
axes[0].set_title("Mean EMG activation")

emg_processed.plot.hist(ax=axes[1], bins=50)
axes[1].set_title("EMG activation distribution")

svg

See the documentation for more details and examples.

Features

  • Signal processing routine commonly used in biomechanics such as filters, normalization, onset detection, outliers detection, derivatives, etc.
  • Common matrix manipulation routines implemented such as getting Euler angles to/from a rototranslation matrix, creating a system of axes, setting a rotation or translation, transpose or inverse, etc.
  • Easy reading and writing interface to common files in biomechanics (c3d, csv, xlsx,mat, trc, sto, mot)
  • All of xarray's awesome features

The following illustration shows all of pyomeca's public API. An interactive version is available in the documentation.

api

Installation

Pyomeca itself is a pure Python package, but its dependencies are not. The easiest way to get everything installed is to use conda.

To install pyomeca with its recommended dependencies using the conda command line tool:

conda install -c conda-forge pyomeca

Now that you have installed pyomeca, you should be able to import it:

import pyomeca

Integration with other modules

Pyomeca is designed to work well with other libraries that we have developed:

  • pyosim: interface between OpenSim and pyomeca to perform batch musculoskeletal analyses
  • ezc3d: Easy to use C3D reader/writer in C++, Python and Matlab
  • biorbd: C++ interface and add-ons to the Rigid Body Dynamics Library, with Python and Matlab binders.

Bug reports & questions

Pyomeca is Apache-licensed and the source code is available on GitHub. If any questions or issues come up as you use pyomeca, please get in touch via GitHub issues. We welcome any input, feedback, bug reports, and contributions.

Citing Pyomeca

DOI

If you use pyomeca in your academic work, please consider citing our paper as:

@article{Martinez2020,
  doi = {10.21105/joss.02431},
  url = {https://doi.org/10.21105/joss.02431},
  year = {2020},
  publisher = {The Open Journal},
  volume = {5},
  number = {53},
  pages = {2431},
  author = {Romain Martinez and Benjamin Michaud and Mickael Begon},
  title = {`pyomeca`: An Open-Source Framework for Biomechanical Analysis},
  journal = {Journal of Open Source Software}
}

Please consider citing the xarray project, which pyomeca is based on:

@article{jors-xarray,
title = {Xarray: N-D labeled arrays and datasets in Python},
author = {Joe Hamman and Stephan Hoyer},
year = {2017},
journal = {Journal of Open Research Software}
}

Contributors

Pyomeca is an open-source project created and supported by the S2M lab.

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

pyomeca-2024.0.2.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

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

pyomeca-2024.0.2-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file pyomeca-2024.0.2.tar.gz.

File metadata

  • Download URL: pyomeca-2024.0.2.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyomeca-2024.0.2.tar.gz
Algorithm Hash digest
SHA256 6adb499327965b86801bca9c1a5ac3a361eb6028d4e5cd2f004dc80df53fb274
MD5 9b4cf830428994fce03c46280ac020da
BLAKE2b-256 d53d96d1590a67b60c9319d1a549c90b6987bba521d827bdad975f729a34c6de

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomeca-2024.0.2.tar.gz:

Publisher: push_to_pypi.yml on pyomeca/pyomeca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyomeca-2024.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyomeca-2024.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyomeca-2024.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dac539d3d1200c049f14941c8b41dbef6ee1bc91eaed400d8f8a59eb23100da5
MD5 d907eded53428bdda854942eea53c0d6
BLAKE2b-256 fd21ee20e819620c0c2ce976a9448d63c5e2c6dbdb92dc5c0b3e49debe628a80

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomeca-2024.0.2-py3-none-any.whl:

Publisher: push_to_pypi.yml on pyomeca/pyomeca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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