Skip to main content

MyoGestic

Python License: GPL v3 Docs

Real-time biosignal experiment GUI builder. A compact Python framework that turns a short script into a live experiment - signal viewers, recording, training, prediction - without classes, registries, or config files.

Built at the n-squared lab at Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU) for the myocontrol research community. v2 is a ground-up rewrite of MyoGestic v1 focused on small, composable API surfaces and live extensibility.

Provides: live LSL ingest, on-disk recording (Zarr → .session.zip), ML pipeline lifecycle (train/predict on their own threads), Dear ImGui widgets, output filters, gRPC + LSL dual-plane integration with the Virtual Hand Interface.

Does not provide: DSP, ML models, feature extraction. You bring scipy, MyoVerse, CatBoost, PyTorch - whatever fits.

Try it in your browser

A live MyoGestic app runs entirely in your browser via Pyodide at https://nsquaredlab.github.io/MyoGestic/playground/. Synthetic EMG, in-memory recording, sklearn LDA training, live prediction. No install.

Install

uv sync                      # core dependencies only
uv sync --extra examples     # + catboost, myoverse, torch, scikit-learn (to run the demos)
uv sync --extra dev          # + pytest, ruff, the examples extras above

Optional extras: [brainflow] [bdi] [serial] [grpc] [zarrs] [docs]. [grpc] pulls in grpcio + grpcio-tools + protobuf for the VHI control plane.

Quick start

from myogestic import App, Stream
from myogestic.sources import LSLSource
from myogestic.widgets import recording_controls, signal_viewer

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

@app.ui
def ui(ctx):
    signal_viewer(ctx, "emg")
    recording_controls(ctx, ["Rest", "Fist"],
                       on_record=app.start_recording,
                       on_stop=app.stop_recording)

app.run()

That's the whole loop. Add a Pipeline, decorate extract / train / predict, and you have a closed-loop experiment.

For a whole protocol rather than a loop to build on, examples/start_here/ holds applications you can take to a session unmodified — they pick their hardware from a dropdown, so the same file runs against any supported amplifier or against the synthetic one when you have none:

  • force_ramps.py - isometric force ramps: track a trapezoid at a set %MVC, with the EMG, the force and the target all 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; the Virtual Hand only mirrors it

Six runnable end-to-end demos live in examples/synthetic/:

  • emg_classification.py - the reference first read (CatBoost binary)
  • emg_classification_grpc.py - adds the VHI gRPC control plane
  • emg_regression.py - continuous 5-DoF regression
  • emg_regression_raulnet.py - same flow with a PyTorch Lightning CNN
  • emg_32ch_multi_model.py - selectable classifier + Save/Load
  • emg_popout_layout.py - the same flow in a dockable tear-off layout

Documentation

The full docs live as a ProperDocs site under docs/ - tutorials, how-to guides, concept explanations, an auto-generated API reference, and the in-browser playground.

Build and serve locally:

uv sync --extra docs --extra grpc --extra serial
uv run properdocs serve

Then open http://127.0.0.1:8000/MyoGestic/.

Quick links into the source:

  • Getting Started - install + run the synthetic-EMG demo.
  • Tutorials - emg-classification, emg-regression-with-vhi.
  • How-to guides - recipes (custom source, custom widget, custom model, integrate the Virtual Hand, install VHI, the recipe feature set, ...).
  • Concepts - architecture, streams, pipeline, threading, recording, the Px/Fr grid, the EdgeTrigger pattern.
  • API reference - auto-generated from docstrings.
  • API cheatsheet - the most-used public symbols on one page.
  • Playground - the in-browser demo (no install).

The docs are deployed to GitHub Pages via .github/workflows/docs.yml on every push to main.

Development

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

Some integration tests need a live LSL outlet (port-bind sensitive in sandboxed CI). A handful of test files lag recent refactors and are scheduled for cleanup.

How to cite

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

@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},
}

License

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 license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myogestic-2.6.0.tar.gz (975.2 kB view details)

Uploaded Source

Built Distribution

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

myogestic-2.6.0-py3-none-any.whl (730.7 kB view details)

Uploaded Python 3

File details

Details for the file myogestic-2.6.0.tar.gz.

File metadata

  • Download URL: myogestic-2.6.0.tar.gz
  • Upload date:
  • Size: 975.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for myogestic-2.6.0.tar.gz
Algorithm Hash digest
SHA256 97cd965a767ebb8468008c59c7dac51a7d21056d38a693538127fa45c054542f
MD5 7f5987f57ebf8b2be8c276a53e6b0944
BLAKE2b-256 98125638b16736116c0aeb204824e086f6d37698a6458975a6c17d82ed68513d

See more details on using hashes here.

Provenance

The following attestation bundles were made for myogestic-2.6.0.tar.gz:

Publisher: publish.yml on NsquaredLab/MyoGestic

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

File details

Details for the file myogestic-2.6.0-py3-none-any.whl.

File metadata

  • Download URL: myogestic-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 730.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for myogestic-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b656c8674f473f61e6f9802bd56cfb8176ffa38da1c4b05eff9b3adde71c08
MD5 3c9ab38e702cac16ca7807757f6a0fce
BLAKE2b-256 368362a2d8d9dfe0ea05e4d0bddf186b650ae49049c957899e7689847a039f83

See more details on using hashes here.

Provenance

The following attestation bundles were made for myogestic-2.6.0-py3-none-any.whl:

Publisher: publish.yml on NsquaredLab/MyoGestic

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

Release history Release notifications | RSS feed

2.6.2

2 files

2.6.1

2 files

This release

2.6.0 This release

2 files

2.5.5

2 files

2.5.4

2 files

2.5.3

2 files

2.5.2

2 files

2.5.1

2 files

2.5.0

2 files

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

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