Skip to content
GitHub · 2.7.0

Get started

Getting started

Install the package, run a complete protocol against the synthetic amplifier, then write your own app.

Install

Shell
pip install myogestic

Extras add optional parts. Install one with pip install "myogestic[grpc]".

Extra What it adds
examples CatBoost, MyoVerse, PyTorch and scikit-learn for the demos
grpc the Virtual Hand control plane
brainflow BrainFlow devices
serial serial sources and outputs
zarrs the Rust-accelerated Zarr codec pipeline

Run a protocol

The examples live in the repository. Clone it, sync it with uv and start Myocontrol:

Shell
git clone https://github.com/NsquaredLab/MyoGestic.git
cd MyoGestic
uv sync --extra examples --extra grpc
uv run --extra examples --extra grpc python examples/start_here/myocontrol.py

The browser playground follows Connect → Record → Train → Predict with a synthetic EMG source and an LDA classifier. Takes stay in the tab’s temporary filesystem; reloading clears them.

Where your takes go

Each saved take is one .mg.zip, named by participant, start time and the gestures recorded or the run name. Takes started while a model predicts go to predictions/.

Text
data/
└── P-001/
├── recordings/ P-001_20261106-1412_R+F.mg.zip
├── predictions/ P-001_20261106-1430_guided.mg.zip
└── models/ P-001_20261106-1425_catboost.joblib

Write your own

Create a stream with a signal viewer and recording controls. Start an LSL outlet named EMG, then press Connect in the viewer to attach it.

Python
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()