Electromyography Processing application at Neuro, Nano and Quantum Computing (slo. Nevro, Nano in Kvantno Računalništvo).
Includes PCA analysis script and helper applications for processing conversions and model fitment.
Following are most useful usage patterns and do not describe all patterns of the application. Run with -h
to show all available arguments.
$ emgproc.py
to read raw data at 200 Hz from Myo device.$ emgproc.py -r rec.csv
to playback a CSV recording at 200 Hz.- All arguments support recorded and raw data.
$ emgproc.py --rms
to smooth the data in real-time.$ emgproc.py --s
to put Myo into deep sleep (shut down).
R
to record to a CSV file (using selected processing).P
to pause data reading.Q
to quit the application.
PCA, ICA and SVM fitting and processing is available in real-time (with visualizer) as well as separate command line mode for conversions and fitting. Example training data is located in training/
folder.
All training was performed with the Myo armband positioned on the most dominant arm, just below the elbow, with the Myo logo on the inner side of the arm.
Process data in real-time:
$ emgproc.py --pca *_raw.csv
fit at start using given training data.$ emgproc.py --ica model.ica
given training model.
Fit and save model to a file:
$ emgfit.py --pca *_raw.csv
creates<timestamp>_model.pca
$ emgfit.py --ica model.ica
creates<timestamp>_model.ica
Convert recording to processed recording:
$ emgconvert.py example_raw.csv --pca *_raw.csv
createsexample_pca.csv
Small proof of concept game based on wultes/snapy. It features Myo gesture recognition (extension
and flexion
) to control snake movement.
- Place Myo armband on your most dominant arm, just below the elbow, with the Myo logo on the inner side of the arm.
- Run with
$ python emggame.py
(using 2 PCA components2comp
training models).
Best gesture recognition is achieved by performing extension
and flexion
quickly and slowly returning to the idle position to prevent triggering the opposite gesture on the way back.
Targetted at Python 3.8.
$ python -m venv venv
(virtual environment)$ source venv/bin/activate
$ pip install -r requirements.txt
($ pip freeze > requirements.txt
to update dependencies)- Installs all required packages.
Dependencies:
- jonpas/myo-raw (only
emgproc.py
andemggame.py
) - scikit-learn
- NumPy
- pySerial (only
emgproc.py
andemggame.py
) - PyGame (only
emgproc.py
andemggame.py
)