Skip to main content

electromyogram

Teaser

This Python package provides a convenient way to create an Electromyogram (EMG) Intensity plot specifically designed for facial muscles with facial structure. With this tool, you can visualize and analyze the intensity of EMG data collected from various facial muscles.

A small demo is hosted here, together with the tool face-projection for a projection onto the face.

Why use sEMG Intensity Plot?

  • Easy to use: The package provides a straightforward interface, making it accessible for users of all levels of expertise.
  • Visualize muscle activity: The EMG Intensity plot allows you to visualize the intensity of muscle activity over the face, providing insights into patterns and variations.
  • Designed explicitly for facial muscles: The tool focuses on facial muscles, enabling you to study and understand muscle activity in the face, which can be particularly useful in fields like facial expression analysis, neuroscience, and rehabilitation.
  • FACS: Visualize the Facial Action Coding System at the correct anatomical locations for a more intuitive understanding of the data.
  • Blend Shapes: Many existing blend shape models base their movements on the FACS. We provide a location mapping for commonly used blend shapes models and where they are located on the face to the AU muscle.
  • Potential for extension: While the current focus is on facial muscles, this tool could potentially be extended to analyze other muscle groups.
  • Beyond muscles: The tool can also be used to plot additional facial information, such as oxygen saturation, but this is not officially supported yet.

Installation

The package is available on PyPI and can be installed with pip:

pip install electromyogram

If you want to install it locally to add changes, please close the repository and install it with pip in development mode. We assume you already created a virtual environment and activated it :)

git clone <link to this repository>
cd electromyogram
pip install -e .

Quickstart

This tool is intended to simplify the creation of only the spatial intensity map for surface EMG data. All the required preprocessing of the data is not part of this package and is likely project-specific. We assume that the data is given in a dictionary (or pandas table) and the keys are the sensor locations.

Then, the correct physical interpolation between the sensors is done, and the result is a 2D array of the interpolated values on the canonical face model. You can then apply different color maps to the interpolation to create the final plot. We provide detailed examples in examples/.

import electromyogram as emg

# we assume that the data is given in a dictionary and the keys are the sensor locations
data_values = dict(...)

scheme = emg.Fridlund()  # or emg.Kuramoto()
# create the interpolation
powermap = emg.interpolate(scheme, data_values, shape=(1024, 1024))
powermap = emg.colorize(powermap, cmap='viridis')

For the colorization, the users can use any color map from matplotlib or pallettable (e.g., pallettable.scientific.sequential.Imola_20) Colors

Surface EMG Schematics

We currently support the two following schematics for acquiring the EMG data. If you want to have your own, please open an issue or create a pull request, and we will be happy to add it.

Fridlund and Cappacio, 1986 Kuramoto et al., 2019
Locations Locations
Ekman and Friesen - FACS Mediapipe Blendshapes
Locations Locations

If you want to define your custom scheme, create a new class inherited from emg.Schematic and implement the locations member. If you support the mirroring of the face, implement the pairs_L and pairs_R members. Then, use it in the interpolate function, and you are good to go.

Todos

  • Handle if not all values are given for a better schematic
  • Add result images
  • Add a function to draw triangulation onto the 2D canvas
  • Add a function to draw sensor locations onto the 2D canvas
  • Add the option to remove the area outside the canonical face model
  • Make a better interface for the channel names (mapping to defined terms)
  • Add function to create the according colorbar for matplotlib in the correct size

License

MIT License

Citation

If you use our work, please cite us:

under publication, please wait a bit :)

Metadata

Release files for electromyogram 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for electromyogram 1.1.3
File Size Uploaded Provenance Actions
electromyogram-1.1.3.tar.gz 5.2 MB Without provenance Details for electromyogram-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for electromyogram 1.1.3
File Interpreter ABI Platform Actions
electromyogram-1.1.3-py3-none-any.whl Python 3 none any Details for electromyogram-1.1.3-py3-none-any.whl

Total release size: 5.2 MB

Release files / electromyogram-1.1.3.tar.gz

Download URL electromyogram-1.1.3.tar.gz
Size 5.2 MB
Tags Source
SHA-256 checksum
How to use checksums
bb3da2a61374edc2cb41c7371ed15d9e6c930a6ce6ac18467f9beb51e28ad07d
BLAKE2b-256 checksum
How to use checksums
271b92204a9704d8bcb185647fbd0101e5f482b6084842f55fae7b8debbe4ac5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / electromyogram-1.1.3-py3-none-any.whl

Download URL electromyogram-1.1.3-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e67e60ba4795e467dc05d3113f1cb1ef1d1d3f16235ecbfe9dcf065eb4f28d46
BLAKE2b-256 checksum
How to use checksums
0b48d9bb787f4c91e4843b49a700a7f4bb191c472bb7366a80d699448954ab97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for electromyogram 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page