Skip to main content
Ctrl+K
MyoGen 0.1.0 Documentation - Home MyoGen 0.1.0 Documentation - Home
made at the N² Lab
  • API Documentation
  • Examples
  • GitHub
  • API Documentation
  • Examples
  • GitHub

Welcome to logo#

Biophysical Simulation Toolkit for EMG Signal Generation

MyoGen is a biophysical simulation toolkit for generating surface and intramuscular electromyography (EMG) signals. Built on established physiological principles and validated anatomical data, MyoGen provides researchers, engineers, and educators with an accessible platform for EMG signal simulation that spans from motor unit recruitment to surface electrode recordings.

The toolkit implements a complete simulation pipeline: from motor unit recruitment thresholds and spike train generation using the NEURON simulator, through anatomically accurate muscle modeling with realistic fiber distributions, to surface EMG signal synthesis via Motor Unit Action Potentials (MUAPs).


Key features include:

  • Motor Unit Recruitment Modeling: Four validated models (Fuglevand, De Luca, Konstantin, Combined) for physiologically realistic recruitment patterns

  • Biophysical Spike Train Simulation: NEURON-based motor neuron modeling with detailed calcium dynamics and membrane properties

  • Anatomically Accurate Muscle Models: Spatial distribution of motor units and muscle fibers based on anatomical measurements

  • Surface EMG Synthesis: Multi-layered volume conductor modeling for realistic surface EMG signal generation

  • Multi-Electrode Array Support: Simulation of high-density electrode grids with configurable spatial arrangements

  • Flexible Input Current Patterns: Built-in generators for sinusoidal, ramp, step, trapezoid, and sawtooth stimulation waveforms

  • GPU Acceleration: Automatic CuPy integration for fast parallel processing of large-scale simulations

  • Comprehensive Visualization: Built-in plotting tools for recruitment thresholds, spike trains, muscle anatomy, MUAPs, and surface EMG

  • Reproducible Research: Deterministic random number generation and parameter saving for reproducible simulations

Warning

MyoGen is still under development and the API is subject to change.

Installation#

  1. Clone the Repository:

    git clone https://github.com/NsquaredLab/MyoGen.git
    cd MyoGen
    
  2. (Windows only) Install NEURON 8.2.6:

    Warning

    Make sure to install version 8.2.6.

    Download from: neuronsimulator/nrn

  3. Install UV:

    Follow the instructions at https://docs.astral.sh/uv/#highlights

  4. Create Environment:

    uv sync
    
  5. Add CuPy if CUDA is Available:

    uv pip install cupy-cuda12x
    
  6. Activate the Environment:

    source .venv/bin/activate
    
  7. Run Setup to Compile NMODL Files:

    Warning

    This step is required. Please do not skip it.

    python -c "from myogen.utils import setup_myogen; setup_myogen()"
    

Package Structure#

MyoGen/
├── myogen/              # Main package source code
│   ├── simulator/       # Core simulation functionality
│   │   ├── core/        # Core simulation components
│   │   │   ├── emg/     # EMG signal generation
│   │   │   ├── muscle/  # Muscle modeling
│   │   │   └── spike_train/ # Motor neuron simulation
│   │   └── ...
│   ├── utils/           # Utility functions and tools
│   │   ├── plotting/    # Visualization utilities
│   │   ├── currents.py  # Current generation
│   │   └── nmodl.py     # NMODL file handling
│   └── ...
├── examples/            # Example scripts and tutorials
├── docs/                # Documentation source
├── pyproject.toml       # Project metadata and dependencies
└── uv.lock              # Pinned versions of dependencies
On this page
  • Installation
  • Package Structure

This Page

  • Show Source

© Copyright 2025 - 2025, n-squared lab, FAU Erlangen-Nürnberg, Germany.

Created using Sphinx 8.2.3.