EMG Toolbox
Overview
EMG Toolbox is a Python package to preprocess, analyse and plot electromyography (EMG) signals, including high-density recordings from electrode grids.
The package is composed of the following modules:
tools: rearrange channels between(samples, channels)and grid(rows, cols, samples)formats, and replace bad channels with the mean of their neighbours.prepro: Butterworth bandpass, highpass, lowpass and powerline (bandstop) filters.feats: amplitude features such as the moving-window root mean square (RMS).freq: amplitude spectrum and power spectral density (periodogram or Welch).plots: plot channels over time, PSDs, PSD maps across channels, and spectrograms.
Table of Contents
Installation
Install the latest release from PyPI (Python 3.10 or newer):
pip install emg-tools
The package is imported as emg_tools.
To work on the code itself, see the development setup in CONTRIBUTING.md.
Quick start
EMG data is an array of shape (samples, channels). The example below filters a synthetic 16-channel recording and computes its RMS envelope:
import numpy as np
from emg_tools import feats, prepro
fs = 2048 # sampling frequency (Hz)
timestamps = np.arange(5 * fs) / fs # 5 s recording
rng = np.random.default_rng(0)
emg = rng.standard_normal((timestamps.size, 16)) # (samples, channels)
emg += 0.5 * np.sin(2 * np.pi * 50 * timestamps)[:, None] # powerline noise
emg_filt = prepro.remove_powerline(emg, fs=fs, cutoff=50)
emg_filt = prepro.bandpass_filter(emg_filt, fs=fs, cutoff=[20, 500])
rms, t_win = feats.compute_rms(emg_filt, timestamps, win_len_s=0.25, win_step_s=0.125, fs=fs)
rms.shape # (10240, 16): one RMS value per sample and channel
Documentation
The full documentation, with a worked example and the API reference, is at imendezguerra.github.io/emg-tools.
Contributing
Contributions are welcome! CONTRIBUTING.md explains how to set up a development environment, run the tests, preview the docs, and what the automated checks (pre-commit and CI) do.
License
This project is licensed under the MIT License.
Citation
If you use this code in your research, please cite this repository:
@software{Mendez_Guerra_EMG_Toolbox,
author = {Mendez Guerra, Irene},
title = {{EMG Toolbox}},
url = {https://github.com/imendezguerra/emg-tools},
version = {2.0.0}
}
Contact
For any questions or inquiries, please contact us at:
Irene Mendez Guerra
irene.mendez17@imperial.ac.uk
Metadata
Release files for emg-tools 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| emg_tools-2.0.0.tar.gz | 15.9 kB | With provenance | Details for emg_tools-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| emg_tools-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for emg_tools-2.0.0-py3-none-any.whl |
Total release size: 27.6 kB
Release files / emg_tools-2.0.0.tar.gz
| Download URL | emg_tools-2.0.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afa71131db9d5506c3ef9f73beb31f7d60685dfc01e36a32d669b32a02cf5a6d
|
|
BLAKE2b-256 checksum How to use checksums |
48289e299eb985af772be93375ef8835cefd6207ffa63e188dab5f3439443815
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / emg_tools-2.0.0-py3-none-any.whl
| Download URL | emg_tools-2.0.0-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42ff99310e8346b02522cb1bde3ed06d8aa621f2bef2bb2faf4269266f0c32f4
|
|
BLAKE2b-256 checksum How to use checksums |
ea783c6ac9e16b50aec5d79157fedbd20b408fde2656ed9861a2801560b37256
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for emg-tools 2.0.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for emg_tools-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA 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.