myogen.simulator.SurfaceEMG.simulate_muaps#
- SurfaceEMG.simulate_muaps( ) SURFACE_EMG__Block[source]#
Simulate MUAPs for all electrode arrays using the provided muscle model.
This method generates Motor Unit Action Potential (MUAP) templates that represent the electrical signature of each motor unit as recorded by the surface electrodes. The simulation uses the multi-layered cylindrical volume conductor model with parallel processing for improved performance.
- Parameters:
n_jobs (int, optional) – Number of parallel workers for motor unit processing. Default is -2. - n_jobs=-1: Use all CPU cores - n_jobs=-2: Use all cores except one (recommended, keeps system responsive) - n_jobs=-3: Use all cores except two - n_jobs=1: No parallelization - n_jobs=N: Use exactly N cores
verbose (bool, default=True) – If True, display progress bars. Set to False to disable.
use_gpu (bool or None, default=None) –
GPU acceleration control for the per-fiber volume-conductor solve (mirrors
myogen.simulator.MotorUnitSim.calc_sfaps()):None→ auto: use GPU if CuPy is available andMYOGEN_DISABLE_GPUis not set in the environment; CPU otherwise.True→ require GPU; raisesRuntimeErrorif unavailable.False→ force CPU execution.
Note: CuPy only supports NVIDIA GPUs (CUDA). AMD/ROCm is not supported. For typical surface-EMG problem sizes, CPU is often faster than GPU due to host↔device transfer overhead.
- Returns:
neo.Block of generated MUAP templates for each electrode array. Results are stored in the muaps property after execution.
- Return type:
Notes
This method must be called before simulate_surface_emg(). The generated MUAP templates are used as basis functions for EMG signal synthesis.
The motor units are processed in parallel using joblib, with each motor unit’s fibers processed sequentially to maintain optimization efficiency.