Skip to main content

MyoGestic

Real-time biosignal experiment GUI builder

PyPI Python versions Tests Docs License: GPL-3.0 Science Advances 2025

Documentation · Playground · Paper · Virtual Hand · Changelog

examples/start_here/pong.py mid-rally: a model trained in the app turns a synthetic wrist's EMG into the paddle command

MyoGestic turns a short Python script into a live experiment with signal viewers, recording, training and prediction. No application subclass, registry or config file is required.

MyoGestic is built at the n-squared lab at Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU) for myocontrol research. Version 2 is a ground-up rewrite of MyoGestic v1 with small, composable APIs and live extensibility.

Try it in your browser

A live MyoGestic app runs entirely in your browser via Pyodide at nsquaredlab.github.io/MyoGestic/playground. It streams synthetic electromyography (EMG), records in memory, trains a scikit-learn linear discriminant classifier and predicts live. No installation is required.

Install

pip install myogestic

Extras add optional parts. examples adds CatBoost, MyoVerse, PyTorch and scikit-learn for the demos; grpc adds the Virtual Hand control plane. Other extras are brainflow, bdi, serial, keyboard, zarrs, docs and dev. Install one with pip install "myogestic[grpc]".

To run the examples, clone the repository and sync it with uv:

git clone https://github.com/NsquaredLab/MyoGestic.git
cd MyoGestic
uv sync --extra examples --extra grpc

Quick start

from myogestic import App, Stream
from myogestic.sources import LSLSource
from myogestic.widgets import RecordingControls, SignalViewer

app = App("Hello EMG")
app.streams(Stream("emg", source=LSLSource("EMG"), window_ms=1000))

viewer = SignalViewer("emg")
recording = RecordingControls(
    ["Rest", "Fist"], on_record=app.start_recording, on_stop=app.stop_recording
)


@app.ui
def ui(ctx):
    viewer.ui(ctx)
    recording.ui(ctx)


app.run()

Add a Pipeline and decorate extract / train / predict for a closed-loop experiment.

Run a session

examples/start_here/ holds complete protocols you can take to a session unmodified. Each picks its hardware from a dropdown, so the same file runs against any supported amplifier or the synthetic amplifier when no hardware is available.

Script Protocol
force_ramps.py Isometric force ramps. Track a trapezoid at a set percentage of maximum voluntary contraction, with the EMG, the force and the target recorded together.
myocontrol.py Record cued Rest/Fist trials, train a classifier or a regressor, and drive the Virtual Hand from the prediction.
pong.py Chase a cursor with the paddle, train one signed [−1, +1] command, and play Pong with your wrist.
uv run --extra examples --extra grpc python examples/start_here/myocontrol.py

WINDOWS.md walks from an empty Windows machine to a recorded force-ramps session, with no programming assumed.

Widgets

Each widget is one public function or class with typed arguments, placed on a Px/Fr grid. Every card can pop out into its own window.

signal_viewer scrolling eight channels of recorded EMG as the hand rests, makes a fist and flexes the thumb
signal_viewer
Recorded EMG, eight channels on one shared range.
recording_controls selecting Fist and recording a timed take after a countdown
recording_controls
Pick a gesture and record a timed take.
prediction_label moving through five gestures with their probabilities
prediction_label
The live prediction and each class's probability.
FollowRun running repetitions of a fist with a progress bar
FollowRun
Repetitions that follow the control hand.

See every widget in the widget gallery.

What MyoGestic provides

MyoGestic provides live Lab Streaming Layer (LSL) ingest, on-disk recording from Zarr to .mg.zip, a machine-learning pipeline with training and prediction on their own threads, Dear ImGui widgets, output filters, and gRPC plus LSL integration with the Virtual Hand Interface.

Write signal processing, features and models with scipy, MyoVerse, CatBoost or PyTorch, or another library that fits the experiment.

More examples

examples/synthetic/ holds runnable demos and templates to copy.

Script Shows
my_session_app.py A session app to copy. Change the classes, features, training and prediction.
emg_classification.py Recommended first read. Binary CatBoost classification with an optional Virtual Hand.
emg_regression.py Continuous regression of five degrees of freedom.
emg_regression_raulnet.py The same flow with a PyTorch Lightning convolutional network.
emg_32ch_multi_model.py A selectable classifier with Save and Load.
electrode_grids.py A 256-channel stream split into four tiled viewers with a shared range.

Documentation

Page Covers
Getting started Install, run a protocol and write your own app.
Tutorials EMG classification, and EMG regression with the Virtual Hand.
How-to guides A custom source, widget or model, the Virtual Hand, and the recipe feature set.
Concepts Architecture, streams, pipeline, threading, recording, the Px/Fr grid and the EdgeTrigger pattern.
API reference Generated from the docstrings.
API cheatsheet The most-used public symbols on one page.

Development

uv sync --extra dev
uv run pytest -q
uv run ruff check .

Some integration tests need a live LSL outlet. To build and serve the docs locally:

uv sync --extra docs
cd website
npm ci
npm run dev

Use Node.js 22 (see website/.nvmrc), then open http://localhost:4321/MyoGestic/. Run npm run build from website/ to build the site.

How to cite

If you use MyoGestic in your research, please cite our Science Advances paper:

Sîmpetru, R. C. et al. MyoGestic: EMG interfacing framework for decoding multiple spared motor dimensions in individuals with neural lesions. Science Advances 11, eads9150 (2025).

BibTeX
@article{Simpetru2025,
    author  = {Raul C. S{\^i}mpetru and Dominik I. Braun and Arndt U. Simon
               and Michael M{\"a}rz and Vlad Cnejevici
               and Daniela Souza de Oliveira and Nico Weber and Jonas Walter
               and J{\"o}rg Franke and Daniel H{\"o}glinger and Cosima Prahm
               and Matthias Ponfick and Alessandro Del Vecchio},
    title   = {MyoGestic: EMG interfacing framework for decoding multiple
               spared motor dimensions in individuals with neural lesions},
    journal = {Science Advances},
    volume  = {11},
    number  = {15},
    pages   = {eads9150},
    year    = {2025},
    doi     = {10.1126/sciadv.ads9150},
    url     = {https://www.science.org/doi/abs/10.1126/sciadv.ads9150},
}

Licence

MyoGestic is licensed under the GNU General Public License v3.0 (GPL-3.0), matching the v1 release. Derivative work must remain open under the same licence.


n-squared lab · Friedrich-Alexander-Universität Erlangen-Nürnberg

Metadata

Release files for myogestic 2.7.0

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

Source distribution (sdist)

Source distribution for myogestic 2.7.0
File Size Uploaded Provenance Actions
myogestic-2.7.0.tar.gz 1.3 MB With provenance Details for myogestic-2.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.1 MB

Release files / myogestic-2.7.0.tar.gz

Download URL myogestic-2.7.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
183115892e96adb44fa50c4c5b22e7157419fb8ab778dc74efbef76938708ee7
BLAKE2b-256 checksum
How to use checksums
13caaf705fd9cdc38d8441f9f3d255ccad189ff7ff15a8964fc50881b3172907
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 Nov 7, 2026.

Transparency log

Release files / myogestic-2.7.0-py3-none-any.whl

Download URL myogestic-2.7.0-py3-none-any.whl
Size 844.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bea50890755b9a55fe9c9ebc2d9deb0c65ba5f9566475fc254921f74185dc423
BLAKE2b-256 checksum
How to use checksums
deb47978243b241d4e2b2bed156fb52c2dfccb4be3c889ecdac69d78e91c66da
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 Nov 7, 2026.

Transparency log

Security for myogestic 2.7.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for myogestic-2.7.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 Nov 7, 2026.

Transparency log

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