This repository contains the code to process a set of emg data from Delsys.
Export "y_data", NOT "yt_data". We do not need the time series data as we can easily recreate it
First, you must start/create the python environment. The simplest way to do this is with a virtual environment, the steps are:
- cd to the
emg-processerdirectory - create the venv:
python -m venv venv - start the venv:
- Mac -
source venv/bin/activate - Linux -
source venv/Scripts/activate - Windows Powershell -
.\venv\Scripts\Activate.ps1 - Windows Bash -
venv\Scripts\activate.bat
- Mac -
- install the requirments:
pip install -r requirements.txt
To run the code, there are a few arguments to know. I will list them here, but you can also read details about them with the python main.py --help command
- Required Arguments (Must be in this order)
filepath: Name of file (including ".csv"), and path leading to itemgNum: Number of EMG's used (1 quattro = 4 emgs)emgFreq: Frequency that the emg data was taken at
- Optional Arguments (Can be in any order)
--imuNum: If IMU's were used, how many?--imuFreq: If IMU's were used, what is the sampling frequency?- If
--imuNumis used, this must be specified as well
- If
--proc: Used if we want to process the data. When doing this, put thermswindow size (in ms) we want to use- If this command is not used, the raw data will be visualized
- Using this command, the data will become rectified and smoothed with the specified rms window
- This command only processes EMG data, never the IMU data
--save: This command is used if you want to save the processed data. This can be ran with or without the--proc, but the saved files will be the same as the orginals
-
Data found at
data/y-data.csv, using 2 quattros saved at 2222.2222 Hz- Vizualize raw data:
python main.py data/y-data.csv 8 2222.2222 - Visualize processed data (50 ms):
python main.py data/y-data.csv 8 2222.2222 --proc 50 - Visualize and save processed data:
python main.py data/y-data.csv 8 2222.2222 --proc 20 --save proc_data/procData1.csv
- Vizualize raw data:
-
Data found at
IMU.csv, using 1 quattro and using IMU data, emgFs is 2000.0 Hz, and imuFs is 148.148 Hz- Vizualize raw data:
python main.py IMU.csv 4 2000 --imuNum 1 --imuFreq 148.148 - Visualize processed data (50 ms):
python main.py IMU.csv 4 2000 --imuNum 1 --imuFreq 148.148 --proc 50 - Visualize and save processed data (100 ms):
python main.py IMU.csv 4 2000 --imuNum 1 --imuFreq 148.148 --proc 100 --save proc_data/IMU_proc.csv
- Vizualize raw data: