EMG module

emgManager

class pyCGM2.EMG.emgManager.EmgManager(DATA_PATH, emgSettings=None)

Class to manage emg settings ( ie the emg.settings file)

Parameters
  • DATA_PATH (str) – data folder path

  • emgSettings (str,Optional[None]) – content of the emg.settings file

getChannelSection()

return the channel section of the emg settings

getChannels()

return the channel labels

getMuscles()

return the muscles

getNormalActivity()

return the normal activity muscle reference

getProcessingSection()

return the processing section of the emg settings

getSides()

return side of each emg

emgFilters

This module contains emg filters handling emg procedures

check out the script : Tests est_EMG.py for examples

class pyCGM2.EMG.emgFilters.BasicEmgProcessingFilter(acq, labels)

Filter for filtering emg signals with a high pass filter

Parameters
  • acq (Btk.Acquisition) – btk acquisition instance

  • labels (list) – emg labels.

run()

Run the filter

setHighPassFrequencies(low, up)

Set the frequency boudaries of your emg Butterworth high-pass filter.

Parameters
  • low (float) – lower frequency

  • up (float) – upper frequency

class pyCGM2.EMG.emgFilters.DiscreteEMGFilter(discreteEMGProcedure, analysis, emgLabels, emgMuscles, emgContexts, subjInfo=None, condExpInfo=None)

Filter for handing procedure.

the goal of this filter is to return a Pandas dataframe.

Parameters
  • discreteEMGProcedure (pyCGM2.EMG.discreteEmgProcedures.procedure) – a discrete emg procedure instance.

  • analysis (pyCGM2.Processing.analysis.Analysis) – A pycgm2 analysis instance

  • emgLabels (list) – emg labels

  • emgMuscles (list) – muscle matching emg labels

  • emgContexts (list) – side of each emg labels

  • subjInfo (dict,Optional[None]) – dictionary decribing the subject. Items will be added to the generated pandas dataframe

  • condExpInfo (dict,Optional[None]) – dictionary decribing the experiment conditions. Items will be added to the generated pandas dataframe

getOutput()

run the procedure and get outputs

Returns

pandas.Dataframe – DataFrame

setCondExpInf(condExpInfo)

set experiment condition info

Parameters

condExpInfo (dict) – dictionary decribing the experiment conditions. Items will be added to the generated pandas dataframe

setSubjInfo(subjInfo)

set subject info

Parameters

subjInfo (dict) – dictionary decribing the subject. Items will be added to the generated pandas dataframe

class pyCGM2.EMG.emgFilters.EmgCoActivationFilter(analysis, context)

Filter for computing coactivation index

Parameters
run()

run ethe filter

The coactivation section of the pyCGM2-Analysis instance is updated with descriptive statistics

setCoactivationMethod(concreteCA)

set the coactivation procedure

Parameters

concreteCA (pyCGM2.EMG.Coactivation) – Coactivation procedure instance

setEMG1(label)

set the label of the first emg signal

Parameters

label (str) – emg label

setEMG2(label)

set the label of the second emg signal

Parameters

label (str) – emg label

class pyCGM2.EMG.emgFilters.EmgEnvelopProcessingFilter(acq, labels)

Filter for processing emg envelop from low-pass filter :param acq: btk acquisition instance :type acq: Btk.Acquisition :param labels: emg labels. :type labels: list

run()

Run the filter

setCutoffFrequency(fc)

Set the cut-off frequency.

Parameters

fc (float) – cut-off frequency

class pyCGM2.EMG.emgFilters.EmgNormalisationProcessingFilter(analysis, label, context)

Filter for normalizing emg signals in amplitude

Parameters
processAnalysis()

Process the pyCGM2 analysis instance

New labels with the suffix _Norm is created in the section emgStats.data of the pyCGM2 analysis instance

processC3d()

Process all c3d filenames

Each c3d are updated and include a new analog label with the suffix _Norm

run()

run the filter

setC3ds(datPath, c3ds, fileSuffix=None)

Set a list of c3d.

Parameters
  • datPath (str) – Folder data path

  • c3ds (list) – the names of c3d

  • fileSuffix (str,optional) – suffix added to c3d filenames

setMaxMethod(EnumEmgNorm, Value=None)

set a normalisation method

Parameters
  • EnumEmgNorm (pyCGM2.Enums) – method

  • Value (float,Optional) – force the denominator value

setThresholdFromOtherAnalysis(analysis)

Set an other pyCGM2 analysis instance as normalisation denominator

Parameters

analysis (pyCGM2.Processing.analysis.Analysis) – A pycgm2 analysis instance

coactivationProcedures

This module contains co-activation procedures

check out the script : Tests est_EMG.py for examples

class pyCGM2.EMG.coactivationProcedures.FalconerCoActivationProcedure

Coactivation index according falconer and Winter

Falconer K, Winter DA. Quantitative assessment of cocontraction at the ankle joint in walking. Electromyogr Clin Neurophysiol. 1985;25:135–149. [PubMed] [Google Scholar]

run(emg1, emg2)

run the procedure.

Parameters
  • emg1 (str) – emg label .

  • emg2 (str) – emg label

Returns

list – Coactivation index

class pyCGM2.EMG.coactivationProcedures.UnithanCoActivationProcedure

Coactivation procedure according Unithan et al, 1996

Unnithan VB, Dowling JJ, Frost G, Volpe Ayub B, Bar-Or O. Cocontraction and phasic activity during GAIT in children with cerebral palsy. Electromyogr Clin Neurophysiol. 1996;36:487–494.

run(emg1, emg2)

run the procedure.

Parameters
  • emg1 (str) – emg label .

  • emg2 (str) – emg label

Returns

list – Coactivation index

discreteEmgProcedures

Module containes Filter and Procedure for extracting discrete value ( e.g : amplitude) from each emg signal

class pyCGM2.EMG.discreteEmgProcedures.AmplitudesProcedure

This procedure computes EMG amplitude for each gait phases

detect(analysisInstance, emgLabels, emgMuscles, emgContexts)

Compute amplitudes

Parameters
  • analysis (pyCGM2.Processing.analysis.Analysis) – A pycgm2 analysis instance

  • emgLabels (list) – emg labels

  • emgMuscles (list) – muscle matching emg labels

  • emgContexts (list) – side of each eamg labels

normalActivation

The module contains convenient function for getting the normal emg activity of the muscles listed in the file (pyCGM2/Data/normativeData/emg/normalActivation.json).

pyCGM2.EMG.normalActivation.getNormalBurstActivity(muscle, fo)

get onsets and offsets of a specific muscle.

Parameters
  • muscle (str) – muscle label listed in normalActivation.json

  • fo (int) – foot off frame

pyCGM2.EMG.normalActivation.getNormalBurstActivity_fromCycles(muscle, ff, begin, fo, end, apf)

get onsets and offsets of a specific muscle from .

Parameters
  • muscle (str) – muscle label listed in normalActivation.json

  • ff (int) – first frame of the btk.acquisition

  • begin (int) – initial frame of cycle

  • fo (int) – foot off frame

  • end (int) – final frame of the cycle

  • apf (int) – nNumber of analog sample per frame