NeuroMotion is an open-source python package for simulating surface EMG signals during voluntary hand, wrist, and forearm movements.
NeuroMotion is comprised of three key modules, including part of the OpenSim API, BioMime, and a motor unit pool model. OpenSim is used to define and visualise movements of an upper-limb musculoskeletal model and to estimate muscle lengths and muscle activations during the movements. BioMime is an AI EMG model that takes in the nonstationary physiological parameters and outputs dynamic motor unit action potentials (MUAPs) on forearm. The motor unit pool model is used to initialise the motor unit properties within each motoneuron pool and to convert the neural drives into spike trains. We provided a classical Fuglevand's model and a leaky fire-and-integrate model adapted from Estimation of the firing behaviour of a complete motoneuron pool by combining EMG signal decomposition and realistic motoneuron modelling.
- Operating System: Linux.
- Python 3.7.11
- PyTorch >= 1.6
- torchvision >= 0.8.0
- CUDA toolkit 10.1 or newer, cuDNN 7.6.3 or newer.
env.yml contains most dependencies required to use NeuroMotion. Create the new environment by:
conda env create --file env.yml
Then install the core module BioMime by:
pip install git+https://github.com/shihan-ma/BioMime.git
Download pretrained models of BioMime from model.pth and put them under ckp/.
Download ARMS_Wrist_Hand_Model_4.3.zip and unzip it under NeuroMotion/MSKlib/models/.
The OpenSim model is Hand_Wrist_Model_for_development.osim
developed by DC McFarland, et al., A musculoskeletal model of the hand and wrist capable of simulating functional tasks. IEEE Transactions on Biomed. Eng. (2022).
Download poses.csv and unzip it under NeuroMotion/MSKlib/models/.
. This file predefines six poses, including open hand ('open' or 'default'), grasp ('grasp'), wrist flexion ('flex'), wrist extension ('ext'), radial deviation ('rdev'), and ulnar deviation ('udev). An example of customising your own movement is shown in NeuroMotion/MSKlib/MSKpose.py
Download the example MUAP data (100 MUAPs labelled with six parameters) from muap_example.pkl and put it under ckp/.
Run scripts/mov2emg.py
to simulate EMG signals during a voluntary movement by sampling the latents from the standard normal distribution:
python scripts/mov2emg.py
Or by morphing the existing MUAPs:
python scripts/mov2emg.py --morph