Before running following code, the analyst must define the emg configuration of his data collection.
As default, pyCGM2 considers the content of the file emg.settings
copy, located in the folder pyCGM2/Settings
copy.
Here is a part of emg.settings
copy
CHANNELS:
Voltage.EMG1 :
Muscle : RECFEM
Context : Left
NormalActivity : RECFEM
Voltage.EMG2 :
Muscle : RECFEM
Context : Right
NormalActivity : RECFEM
...
Voltage.EMG16 :
Muscle :
Context :
NormalActivity :
copy
- 16 channels are predefined.
- Channels are named
Voltage.EMG1
copy toVoltage.EMG16
copy and matched with analog label of your c3d. - for each channel, the label of the muscle (
muscle
copy) is given as well as its side location (Context
copy) - the item
NormalActivity
copy is the muscle label used for displaying the instant of normal activity in the background of the plot. Unlike, themuscle
copy item, user must select aNormalActivity
copy label in the list:
ADDBRE , ADDLON, ADDMAG, BICFEM, CALF, EXTDIGLON, EXTHALLON, FLEDIGLON, FLEHALLON,
GASTRO, GLUMAX, GLUMED, GLUMIN, GRACIL, HAMSTR, HIPABD, HIPADD, HIPEXT, HIPFLE,
ILIACU, ILIOPS, LATHAM, LATQUA, MEDHAM, MEDQUA, PERBRE, PERLON, POPLIT, RECFEM,
SARTOR, SEMIME, SEMITE, SOLEUS, TENFACLAT, TIBANT, TIBPOS, VASINT, VASLAT,
VASMEDLON, VASMEDOBL
copy
Alter the emg.settings
copy located in the folder pyCGM2/Settings
copy if you want to configure your emg routine.
Exceptionally, if your gait data collection does not match with your routine, you can copy/paste
the emg.settings
copy in the data folder, then edit it.
plot rectify emg
The code shows how you can create plot panel reporting temporal traces of the emg.
import pyCGM2
from pyCGM2.Lib import plot
from pyCGM2.Lib import emg
# data
DATA_PATH = "C:\\myPATH\\"
trialNames = ["03367_05136_20200604-GBNNN-VDEF-01.c3d"]
# load emg manager
emgManager = emg.loadEmg(DATA_PATH)
# process emg channels
emg.processEMG(DATA_PATH, trialNames, emgManager.getChannels(),
highPassFrequencies=[20,200],
envelopFrequency=6.0)
# plot
plot.plotTemporalEMG(DATA_PATH, trialNames[0],
rectify = True)
copy
plot time-normalized emg envelops
Instead of plotting temporal EMG traces, we show how to report the emg envelops normalized on gait event.
This requires the construction of an analysis Instance
copy.
import pyCGM2
from pyCGM2.Lib import plot
from pyCGM2.Lib import emg
from pyCGM2.Lib import analysis
# data
DATA_PATH = "C:\\myPATH\\"
trialNames = ["03367_05136_20200604-GBNNN-VDEF-01.c3d", "03367_05136_20200604-GBNNN-VDEF-02.c3d"]
# emg manager
emgManager = emg.loadEmg(DATA_PATH)
# process emg analog channels
emg.processEMG(DATA_PATH, trialNames, emgManager.getChannels(),
highPassFrequencies=[20,200],
envelopFrequency=6.0)
# construct the analysis instance
analysisInstance = analysis.makeAnalysis(DATA_PATH,
trialNames,
emgChannels = emgManager.getChannels() )
# plot descriptive and consistancy plot panels
plot.plotDescriptiveEnvelopEMGpanel(DATA_PATH,analysisInstance)
plot.plotConsistencyEnvelopEMGpanel(DATA_PATH,analysisInstance)
copy