EMGIO
A Python package for EMG data import/export and manipulation. This package provides a unified interface for working with EMG data from various systems (Trigno, EEGLAB, OTB, etc) and exporting to standardized formats like EDF and BDF with harmonized metadata.
The determination of the EDF/BDF format is based on the dynamic range of the data. If the data is within the range of 16-bit integers (~90dB), the EDF format is used. Otherwise, the BDF format is used. This is to ensure that the data is stored in the most efficient format possible. This determination is made automatically using SVD decomposition and/or FFT to determine the dynamic range of the data. (Alternatively, the user can override the format selection by explicitly indicating their desired format).
Documentation
The documentation including installation instructions, examples, and API reference is available at https://neuromechanist.github.io/emgio/.
Features
-
Import EMG data from multiple systems:
- EEGLAB set files (supported)
- Delsys Trigno (supported)
- OTB Systems (supported)
- EDF/BDF(+) (supported, including annotations)
- WFDB (supported, including annotations)
- XDF/Lab Streaming Layer (supported, multi-stream)
- Generic CSV (supported with auto-detection)
- Noraxon (planned)
-
Smart import:
- Automatic file format detection based on extension
- Specialized format detection for CSV files
- Custom importers for system-specific formats
- Automatic annotation loading (WFDB, planned for EDF+/BDF+ and EEGLAB's .set files)
- LSL timestamp preservation for XDF files (for synchronization)
-
Export to standardized formats:
- EDF/BDF(+) with channels.tsv metadata (automatically selects format based on signal properties, preserves annotations)
-
Serialization & serving (see docs):
- Parquet and Arrow/Feather: lossless columnar round-trip (analytics, fast IPC); requires the
arrowextra - Zarr: cloud-native serving store (one store serves viewing, inference, and training), a derived downsampled copy; requires the
zarrextra
- Parquet and Arrow/Feather: lossless columnar round-trip (analytics, fast IPC); requires the
-
Data manipulation:
- Channel selection
- Metadata handling
- Event/Annotation handling (access, add)
- Basic signal visualization
- Raw data access and modification
Installation
EMGIO uses UV for Python environment and package management.
From PyPI (recommended)
uv pip install emgio
(If your own project is uv-managed, use uv add emgio to track it as a dependency.)
From source
git clone https://github.com/neuromechanist/emgio.git
cd emgio
uv pip install .
Usage
Basic Example
from emgio import Recording
# Load data with automatic format detection
emg = Recording.from_file('data.csv') # Format detected from file extension
# Load data with explicit importer
emg = Recording.from_file('data.csv', importer='trigno')
# Plot specific channels
emg.plot_signals(['EMG1', 'EMG2'])
# Export to EDF or BDF (format automatically determined)
emg.to_edf('output.edf')
Generic CSV Import
# Import a generic CSV file
emg = Recording.from_file('data.csv', importer='csv',
sample_frequency=1000, # Required if no time column
has_header=True, # Whether file has header row
channel_names=['EMG_L', 'EMG_R', 'ACC_X'])
Channel Selection
# Select specific channels
subset_emg = emg.select_channels(['EMG1', 'EMG2', 'ACC1'])
# Select all channels of a specific type
emg_only = emg.select_channels(channel_type='EMG')
# Plot selected channels
subset_emg.plot_signals()
Metadata Handling
# Set metadata
emg.set_metadata('subject', 'S001')
emg.set_metadata('condition', 'resting')
# Get metadata
subject = emg.get_metadata('subject')
Development
Setup
- Clone the repository:
git clone https://github.com/neuromechanist/emgio.git
cd emgio
- Install for development (editable install with dev dependencies):
uv sync --extra dev
Running Tests
uv run pytest
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Acknowledgment
This project is partially supported by a Meta Reality Labs gift to @sccn and NIH 5R01NS047293.
Release files for emgio 0.6.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 | |
|---|---|---|---|
| emgio-0.6.0.tar.gz | 140.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| emgio-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 303.1 kB
Release files / emgio-0.6.0.tar.gz
| Download URL | emgio-0.6.0.tar.gz |
|---|---|
| Size | 140.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abd591359a21416308863d24df984f6a40ef2a18936f0d1dbaebc5959c872dd4
|
|
BLAKE2b-256 checksum How to use checksums |
e445370c21853224564e90cb3f4c462c4cd375d9b3b349eb7cc9d89f5ec8b244
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 31, 2026.
Transparency logRelease files / emgio-0.6.0-py3-none-any.whl
| Download URL | emgio-0.6.0-py3-none-any.whl |
|---|---|
| Size | 162.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c87765fef5e71bf5962f06823f126a8b39b1036c21feb09e4cb5de39c6f174d
|
|
BLAKE2b-256 checksum How to use checksums |
b4717b16dc2cd0fcdd8e305701f3799517fda6f1282b9055b6c2a00ae1a1b005
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 31, 2026.
Transparency log