The lib module
CGM functions
- pyCGM2.Lib.CGM.cgm1.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, required_mp, optional_mp, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, pointSuffix, **kwargs)
CGM1 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter..
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm1.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM1 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm1_1.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, required_mp, optional_mp, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, pointSuffix, **kwargs)
CGM1.1 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter..
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm1_1.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM1.1 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_1.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, required_mp, optional_mp, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, hjcMethod, pointSuffix, **kwargs)
CGM21 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter..
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
hjcMethod (dict) – hip joint centre regressions
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_1.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM2.1 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_2.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, weights, required_mp, optional_mp, ik_flag, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, hjcMethod, pointSuffix, **kwargs)
CGM22 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter..
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
hjcMethod (dict) – hip joint centre regressions
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_2.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, weights, ik_flag, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM22 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
weights (dict) – marker weights
ik_flag (bool) – enable/disable inverse kinematics
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_3.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, weights, required_mp, optional_mp, ik_flag, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, hjcMethod, pointSuffix, **kwargs)
CGM23 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter.
ik_flag (bool) – enable or disable inverse kinematics
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
hjcMethod (dict) – hip joint centre regressions
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_3.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, weights, ik_flag, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM23 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
weights (dict) – marker weights
ik_flag (bool) – enable/disable inverse kinematics
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_4.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, weights, required_mp, optional_mp, ik_flag, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, hjcMethod, pointSuffix, **kwargs)
CGM24 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter.
ik_flag (bool) – enable or disable inverse kinematics
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
hjcMethod (dict) – hip joint centre regressions
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_4.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, weights, ik_flag, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM24 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
weights (dict) – marker weights
ik_flag (bool) – enable/disable inverse kinematics
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_5.calibrate(DATA_PATH, calibrateFilenameLabelled, translators, weights, required_mp, optional_mp, ik_flag, leftFlatFoot, rightFlatFoot, headFlat, markerDiameter, hjcMethod, pointSuffix, **kwargs)
CGM25 calibration.
- Parameters
DATA_PATH (str) – folder path.
calibrateFilenameLabelled (str) – filename of your static file.
translators (dict) – marker translators.
required_mp (dict) – required anthropometric parameter.
optional_mp (dict) – optional anthropometric parameter.
ik_flag (bool) – enable or disable inverse kinematics
leftFlatFoot (bool) – flat foot option.
rightFlatFoot (bool) – flat foot option.
headFlat (bool) – flat head option.
markerDiameter (float) – marker diameter
hjcMethod (dict) – hip joint centre regressions
pointSuffix (str) – suffix to add to ouputs
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
model (pyCGM2.Model) – the calibrated Model
acqStatic (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.cgm2_5.fitting(model, DATA_PATH, reconstructFilenameLabelled, translators, weights, ik_flag, markerDiameter, pointSuffix, mfpa, momentProjection, **kwargs)
CGM25 Fitting.
- Parameters
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
weights (dict) – marker weights
ik_flag (bool) – enable/disable inverse kinematics
markerDiameter (float) – marker diameter
pointSuffix (str) – suffix to add to ouputs
mfpa (str) – force plate assignment
momentProjection (str) – referential for projection of joint moment
- Keyword Arguments
anomalyException (bool) – raise exception if anomaly detected
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
frameInit (int) – frame index.
frameEnd (int) – frame index
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
displayCoordinateSystem (bool) – return virtual markers for visualisation of the anatomical refentials
noKinematicsCalculation (bool) – disable computation of joint kinematics
- Returns
acqGait (Btk.Acquisition) – static btkAcquisition instance with model ouputs
detectAnomaly (bool) – presence of anomaly
- pyCGM2.Lib.CGM.kneeCalibration.calibration2Dof(model, DATA_PATH, reconstructFilenameLabelled, translators, side, beginFrame, endFrame, jointRange, **kwargs)
- Parameters
model (pyCGM2.Model) – model instance
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
side (str) – body side (Left or Right)
beginFrame (int) – frame index.
endFrame (int) – frame index
jointRange (list) – joint range of motion boundaries
- Keyword Arguments
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
- Returns
model (pyCGM2.Model) – updated model instance
acqFunc (Btk.Acquisition) – static btkAcquisition instance with model ouputs
side (str) – body side
- pyCGM2.Lib.CGM.kneeCalibration.sara(model, DATA_PATH, reconstructFilenameLabelled, translators, side, beginFrame, endFrame, **kwargs)
calibration2Dof
- Parameters
model (pyCGM2.Model) – model instance
DATA_PATH (str) – folder path.
reconstructFilenameLabelled (str) – filename of your gait trial.
translators (dict) – marker translators.
side (str) – body side (Left or Right)
beginFrame (int) – frame index.
endFrame (int) – frame index
jointRange (list) – joint range of motion boundaries
- Keyword Arguments
forceBtkAcq (btk.Acquisition) – use a btkAcquisition instance instead of building the btkAcquisition from the static filename
fc_lowPass_marker (float) – low-pass fiter cutoff frequency applied on marker trajectories
order_lowPass_marker (int) – order of the low-pass filter applied on marker trajectories
fc_lowPass_forcePlate (float) – low-pass fiter cutoff frequency applied on force plate measurements
order_lowPass_forcePlate – order fiter cutoff frequency applied on force plate measurements
- Returns
model (pyCGM2.Model) – updated model instance
acqFunc (Btk.Acquisition) – static btkAcquisition instance with model ouputs
side (str) – body side
analysis
- pyCGM2.Lib.analysis.exportAnalysis(analysisInstance, DATA_PATH, name, mode='Advanced')
export an Analysis instance as excel spreadsheet.
- Parameters
analysisInstance (pyCGM2.Processing.analysis.Analysis) – Analysis instance.
DATA_PATH (str) – folder path
name (str) – name of your excel file.
mode (str) – spreadsheet mode . (“Advanced or Basic”)
Example:
exportAnalysis(AnalysisInstance, "c:\DATA\","johnDoe")
- pyCGM2.Lib.analysis.makeAnalysis(DATA_PATH, filenames, type='Gait', kinematicLabelsDict={'Left': ['LHipAngles', 'LKneeAngles', 'LAnkleAngles', 'LFootProgressAngles', 'LPelvisAngles', 'LForeFootAngles', 'LThoraxAngles', 'LSpineAngles', 'LNeckAngles', 'LHeadAngles', 'LShoulderAngles', 'LElbowAngles', 'LWristAngles'], 'Right': ['RHipAngles', 'RKneeAngles', 'RAnkleAngles', 'RFootProgressAngles', 'RPelvisAngles', 'RForeFootAngles', 'RThoraxAngles', 'RSpineAngles', 'RNeckAngles', 'RHeadAngles', 'RShoulderAngles', 'RElbowAngles', 'RWristAngles']}, kineticLabelsDict={'Left': ['LHipMoment', 'LKneeMoment', 'LAnkleMoment', 'LHipPower', 'LKneePower', 'LAnklePower'], 'Right': ['RHipMoment', 'RKneeMoment', 'RAnkleMoment', 'RHipPower', 'RKneePower', 'RAnklePower']}, emgChannels=[], pointLabelSuffix=None, subjectInfo=None, experimentalInfo=None, modelInfo=None, **kwargs)
This function normalises data in time and returns an Analysis Instance ie a nested dictionary containing spatiotemporal parameters, normalized kinematics, normalized kinetics and normalized EMG envelops from a list of c3d files.
By default: the function calls :
kinematic and kinetic ouputs of the CGM
emg channels names Voltage.EMG1 to Voltage.EMG16
You can also compute spatiotemporal parameters, normalized kinematics, normalized kinetics and normalized EMG envelops from different set of c3d files. For that, use the named arguments :
pstfilenames
kinematicfilenames
kineticfilenames
emgfilenames
- Parameters
DATA_PATH (str) – folder path
filenames (list) – list of c3d files to normalize
type (str) – event type (choice : “Gait” or “unknown”).
kinematicLabelsDict (dict) – dictionary containing kinematic data to normalize.
kineticLabelsDict (dict) – dictionary containing kinetic data to normalize.
emgChannels (list) – list of emg channels
pointLabelSuffix (str) – suffix associated to point output
subjectInfo (dict) – dictionary with metadata information about the subject.
experimentalInfo (dict) – dictionary with metadata information about the expreiment.
modelInfo (dict) – dictionary with metadata information about the model.
- Keyword Arguments
btkAcqs (list of btk.Acquisition) – btkAcq instances to process instead of calling c3d file.
pstfilenames (list) – list of c3d files used for computing spatiotemporal parameters
kinematicfilenames (list) – list of c3d files used to normalize kinematic data
kineticfilenames (list) – list of c3d files used to normalize kinetic data
emgfilenames (list) – list of c3d files used to normalize emg data
- Returns
analysisFilter.analysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
Examples:
analysisInstance = analysis.makeAnalysis(DATA_PATH, [file1.c3d,"file2.c3d"])
The code takes 2 c3d files, then time normalized kinematics, kinetics and emg. Kinematic and kinetic labels are the default CGM output labels. The Emg channels are defined in the emg.setting file
analysisInstance2 = analysis.makeAnalysis(DATA_PATH, [file1.c3d,"file2.c3d"], ..........................................kinematicLabelsDict = {"Left": ["LHipAngles,LKneeAngles"], "Right": ["RHipAngles,RKneeAngles"]}, ..........................................kineticLabelsDict = {"Left": ["LHipMoment,LKneePower"], "Right": ["RHipMoment,RKneeMoment"], ..........................................emgChannels = ["Voltage.EMG1","Voltage.EMG2","Voltage.EMG3"], ..........................................subjectInfo = {"Name":"Doe","Firstname":"John"}, ..........................................experimentalInfo = {"Barefoot":"No"}, ..........................................modelInfo = {"Model":"CGM1"})
The code called specific model outputs and emg channels. In addition, the code also adds subject, experimental and model metadata. These information will be displayed in the exported spreadsheet.
Emg
- pyCGM2.Lib.emg.loadEmg(DATA_PATH)
Load and manage emg settings
- Parameters
DATA_PATH (str) – folder path.
- Returns
emgManager (pyCGM2.EMG.EmgManager) – an emg manager instance
- pyCGM2.Lib.emg.normalizedEMG(DATA_PATH, analysis, method='MeanMax', fromOtherAnalysis=None, mvcSettings=None, **kwargs)
Emg normalisation in amplitude.
This function update the analysis instance with normalized emg signal in amplitude
- Parameters
analysis (pyCGM2.Processing.analysis.Analysis) – an analysis Instance
DATA_PATH (str) – folder path
method (str) – normalisation method (choice : MeanMax, MaxMax, MedianMax ).
fromOtherAnalysis (pyCGM2.Processing.analysis.Analysis) – normalise in amplitude from another analysis instance.
mvcSettings (dict) – mvc settings.
- Keyword Arguments
forceEmgManager (pyCGM2.Emg.EmgManager) – force the use of a specific emgManager instance.
Examples:
emg.normalizedEMG(emgAnalysisInstance, .................method="MeanMax", .................fromOtherAnalysis=emgAnalysisInstancePreBloc)
The code normalized emg channels of the current analysis instance emgAnalysisInstance from the mean maximum values of an other analysis instance emgAnalysisInstancePreBloc
- pyCGM2.Lib.emg.processEMG(DATA_PATH, gaitTrials, emgChannels, highPassFrequencies=[20, 200], envelopFrequency=6.0, fileSuffix=None, outDataPath=None)
basic filtering of EMG from c3d files .
- Parameters
DATA_PATH (str) – folder path.
gaitTrials (str) – list of c3d files.
emgChannels (list) – list or emg channel
highPassFrequencies (list) – boundaries of the bandpass filter
envelopFrequency (float) – cut-off frequency of low pass emg
fileSuffix (str) – add a suffix to the exported c3d files
outDataPath (str) – path to place the exported c3d files.
Examples:
emg.processEMG(DATA_PATH, ["file1.c3d","file2.c3d"], ["Voltage.EMG1","Voltage.EMG2"])
The code loads 2 c3d files, then processes the analog channel name Voltage.EMG1 and Voltage.EMG2
- pyCGM2.Lib.emg.processEMG_fromBtkAcq(acq, emgChannels, highPassFrequencies=[20, 200], envelopFrequency=6.0)
Process EMG from a btk.acquisition
- Parameters
acq (btk.Acquisition) – an acquisition instance
emgChannels (list) – emg channels ( ie analog labels )
highPassFrequencies (list,Optional[20,200]) – high pass frequencies
envelopFrequency (float,Optional[6.0]) – low pass filter frequency
Examples:
emg.processEMG_fromBtkAcq(acq, .................["Voltage.EMG1","Voltage.EMG2"])
Event
- pyCGM2.Lib.eventDetector.zeni(acqGait, footStrikeOffset=0, footOffOffset=0, **kwargs)
kinematic-based event detector according Zeni et al(2008).
This method need the presence of the markers “LPSI”,”RPSI”,”LHEE”,”LTOE”,”RHEE”,”RTOE”
Reference: Zeni, J. A.; Richards, J. G.; Higginson, J. S. (2008) Two simple methods for determining gait events during treadmill and overground walking using kinematic data. In : Gait & posture, vol. 27, n° 4, p. 710–714. DOI: 10.1016/j.gaitpost.2007.07.007.
- Parameters
acqGait (btk.Acquisition) – an acquisition instance.
footStrikeOffset (int) – systematic offset to add to all footStrikeOffset events. Default is 0.
footOffOffset (int) – systematic offset to add to all footOffOffset events. Default is 0.
- Keyword Arguments
fc_lowPass_marker (double) – cut-off frequency of the lowpass filter applied on markers
order_lowPass_marker (int) – order of the lowpass filter applied on markers
- Returns
acqGait (btk.Acquisition) – updated acquisition with detected events.
state (bool) – state of the detector
Plot
This module gathers convenient functions for plotting Kinematics, Kinetics and EMG. All functions return a matplotlib figure instance
- pyCGM2.Lib.plot.compareEmgEnvelops(DATA_PATH, analyses, legends, normalized=False, plotType='Descriptive', show=True, title=None, type='Gait', OUT_PATH=None, outputName=None, exportPng=False, exportPdf=False, **kwargs)
plot EMG envelops from different analysis instances.
- Parameters
DATA_PATH (str) – path to your data
analysis (list) – list of analysis instances.
legends (list) – short label representing each analysis instances
emgSettings (str) – content of the emg.Settings file
normalized (bool) – enable plot of emg normalized in amplitude .
plotType (str) – descriptive (ie average + sd) or consistency plots ( choice: Descriptive, Consistency)
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
pointSuffixes (list) – suffix previously added to your model outputs.
show (bool) – show matplotlib figure.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
- Keyword Arguments
forceEmgManager (pyCGM2.Emg.EmgManager) – force the use of a specific emgManager instance.
Examples:
compareEmgEnvelops("c:\mydata\",[analysisInstance1,analysisInstance2],["pre","post"])
- pyCGM2.Lib.plot.compareKinematic(DATA_PATH, analyses, legends, context, bodyPart, normativeDataset, plotType='Descriptive', type='Gait', pointSuffixes=None, show=True, title=None, OUT_PATH=None, outputName=None, exportPng=False, exportPdf=False)
plot kinematics from different analysis instances.
- Parameters
DATA_PATH (str) – path to your data
analysis (list) – list of analysis instances.
legends (list) – short label representing each analysis instances
context (str) – event context
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
plotType (str) – descriptive (ie average + sd) or consistency plots ( choice: Descriptive, Consistency)
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
pointSuffixes (list) – suffix previously added to your model outputs.
show (bool) – show matplotlib figure.
type – type of events. if different to Gait, use foot strike only to define cycles
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
compareKinematic("c:\mydata\",[analysisInstance1,analysisInstance2],["pre","post"],"Left","LowerLimb",normativeInstance)
- pyCGM2.Lib.plot.compareKinetic(DATA_PATH, analyses, legends, context, bodyPart, normativeDataset, plotType='Descriptive', type='Gait', pointSuffixes=None, show=True, title=None, OUT_PATH=None, outputName=None, exportPng=False, exportPdf=False)
plot kinetics from different analysis instances.
- Parameters
OUT_PATH (str) – path to your data
analysis (list) – list of analysis instances.
legends (list) – short label representing each analysis instances
context (str) – event context
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
plotType (str) – descriptive (ie average + sd) or consistency plots ( choice: Descriptive, Consistency)
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
pointSuffixes (list) – suffix previously added to your model outputs.
show (bool) – show matplotlib figure.
OUT_PATH – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
compareKinetic("c:\mydata\",[analysisInstance1,analysisInstance2],["pre","post"],"Left","LowerLimb",normativeInstance)
- pyCGM2.Lib.plot.compareSelectedEmgEvelops(DATA_PATH, analyses, legends, emgChannels, contexts, normalized=False, plotType='Descriptive', type='Gait', show=True, title=None, OUT_PATH=None, outputName=None, exportPng=False, exportPdf=False)
compare selected EMG envelops from different analysis instances constructed from the same session.
- Parameters
DATA_PATH (str) – path to your data
analysis (list) – list of analysis instances.
legends (list) – short label representing each analysis instances
emgChannels (list) – names of your emg channels ( ie analog labels ).
contexts (list) – event contexts (matched with side of the emg channels).
normalized (bool) – enable plot of emg normalized in amplitude .
plotType (str) – descriptive (ie average + sd) or consistency plots ( choice: Descriptive, Consistency)
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
pointSuffixes (list) – suffix previously added to your model outputs.
show (bool) – show matplotlib figure.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
compareSelectedEmgEvelops("c:\mydata\",[analysisInstance1,analysisInstance2],["pre","post"], ["Voltage.EMG1","Voltage.EMG2"], ["Left","Right"])
The code plots :
the channel Voltage.EMG1 from two analysis instances. Plot lines represent the time-normalized emg envelops from the Left gait events.
the channel Voltage.EMG2 from two analysis instances. Plot lines represent the time-normalized emg envelops from the Right gait events.
pre and post are used as legend
- pyCGM2.Lib.plot.plotConsistencyEnvelopEMGpanel(DATA_PATH, analysis, normalized=False, type='Gait', exportPdf=False, OUT_PATH=None, outputName=None, show=True, title=None, exportPng=False, **kwargs)
display all-cycles of time-normalized EMG envelops.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
normalized (bool) – enable plot of emg normalized in amplitude.
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
- Keyword Arguments
forceEmgManager (pyCGM2.Emg.EmgManager) – force the use of a specific emgManager instance.
Examples:
plotConsistencyEnvelopEMGpanel("C:\myDATA\", analysisInstance)
- pyCGM2.Lib.plot.plotDescriptiveEnvelopEMGpanel(DATA_PATH, analysis, normalized=False, type='Gait', exportPdf=False, OUT_PATH=None, outputName=None, show=True, title=None, exportPng=False, **kwargs)
display average and standard deviation of time-normalized EMG envelops.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
normalized (bool) – enable plot of emg normalized in amplitude .
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
exportPdf (bool) – export as pdf
OUT_PATH (str) – path to your ouput folder
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
- Keyword Arguments
forceEmgManager (pyCGM2.Emg.EmgManager) – force the use of a specific emgManager instance.
Examples:
plotDescriptiveEnvelopEMGpanel("C:\myDATA\", analysisInstance)
- pyCGM2.Lib.plot.plotTemporalEMG(DATA_PATH, processedEmgfile, rectify=True, exportPdf=False, outputName=None, show=True, title=None, ignoreNormalActivity=False, exportPng=False, OUT_PATH=None, **kwargs)
Display temporal traces of EMG signals
- Parameters
DATA_PATH (str) – path to your data
processedEmgfile (str) – name of your c3d file with emg.
emgSettings (str) – content of the emg.setting file.
- Keyword Arguments
rectify (bool) – display rectify or raw signal .
exportPdf (bool) – export as pdf (default: False).
OUT_PATH (str) – path to your ouput folder
outputName (str) – name of the output file.
show (bool) – show the matplotlib figure (default: True) .
title (str) – modify the plot panel title.
ignoreNormalActivity (Optional,bool) – disable display of normal activity in the background.
exportPng (bool) – export as png.
OUT_PATH – specify an path different than the DATA_PATH to export plot
btkAcq (btk.Acquisition) – force use of a btkAcquisition instead of loading from processedEmgfile.
forceEmgManager (pyCGM2.Emg.EmgManager) – force the use of a specific emgManager instance.
Examples:
plotTemporalEMG("C:\myDATA\", "file1.c3d")
- pyCGM2.Lib.plot.plotTemporalKinematic(DATA_PATH, modelledFilename, bodyPart, pointLabelSuffix=None, exportPdf=False, OUT_PATH=None, outputName=None, show=True, title=None, exportPng=False, **kwargs)
plotTemporalKinematic : display temporal trace of the CGM kinematic outputs
- Parameters
DATA_PATH (str) – path to your data
modelledFilenames (str) – name of your c3d including kinematic output
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
pointLabelSuffix (str) – suffix previously added to your model outputs.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf.
outputName (str) – name of the output file .
show (bool) – show the matplotlib figure .
title (str) – modify plot panel title
exportPng (Optional,bool) – export as png .
- Keyword Arguments
btkAcq (btk.Acquisition) – force use of a btkAcquisition instead of loading from modelledFilename.
Examples:
plotTemporalKinematic("C:\myDATA\", "file1.c3d","LowerLimb")
- pyCGM2.Lib.plot.plotTemporalKinetic(DATA_PATH, modelledFilenames, bodyPart, pointLabelSuffix=None, exportPdf=False, OUT_PATH=None, outputName=None, show=True, title=None, exportPng=False, **kwargs)
plotTemporalKinetic : display temporal trace of the CGM kinetic outputs
- Parameters
DATA_PATH (str) – path to your data
modelledFilenames (str) – name of your c3d including kinematic output
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
pointLabelSuffix (str) – suffix previously added to your model outputs.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf.
outputName (str) – name of the output file .
show (bool) – show the matplotlib figure .
title (str) – modify plot panel title
exportPng (bool) – export as png .
- Keyword Arguments
btkAcq (btk.Acquisition) – force use of a btkAcquisition instead of loading from modelledFilename.
Examples:
plotTemporalKinetic("C:\myDATA\", "file1.c3d","LowerLimb")
- pyCGM2.Lib.plot.plot_ConsistencyKinematic(DATA_PATH, analysis, bodyPart, normativeDataset, pointLabelSuffix=None, type='Gait', OUT_PATH=None, exportPdf=False, outputName=None, show=True, title=None, exportPng=False)
display all cycles of time-normalized kinematic output.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
pointLabelSuffix (str) – suffix previously added to your model outputs.
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
plot_ConsistencyKinematic("c:\mydata\",analysisInstance,"LowerLimb",normativeInstance)
- pyCGM2.Lib.plot.plot_ConsistencyKinetic(DATA_PATH, analysis, bodyPart, normativeDataset, pointLabelSuffix=None, type='Gait', OUT_PATH=None, exportPdf=False, outputName=None, show=True, title=None, exportPng=False)
display all cycles of time-normalized kinetic outputs.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
pointLabelSuffix (str) – suffix previously added to your model outputs.
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (Optional,bool) – export as png.
Examples:
plot_ConsistencyKinetic("c:\mydata\",analysisInstance,"LowerLimb",normativeInstance)
- pyCGM2.Lib.plot.plot_DescriptiveKinematic(DATA_PATH, analysis, bodyPart, normativeDataset, pointLabelSuffix=None, type='Gait', OUT_PATH=None, exportPdf=False, outputName=None, show=True, title=None, exportPng=False)
display average and standard deviation of time-normalized kinematic output.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
pointLabelSuffix (str) – suffix previously added to your model outputs.
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
plot_DescriptiveKinematic("c:\mydata\",analysisInstance,"LowerLimb",normativeInstance)
- pyCGM2.Lib.plot.plot_DescriptiveKinetic(DATA_PATH, analysis, bodyPart, normativeDataset, pointLabelSuffix=None, type='Gait', OUT_PATH=None, exportPdf=False, outputName=None, show=True, title=None, exportPng=False)
display average and standard deviation of time-normalized kinetic outputs.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
bodyPart (str) – body part (choice : LowerLimb, Trunk, UpperLimb)
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
pointLabelSuffix (str) – suffix previously added to your model outputs.
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
plot_DescriptiveKinetic("c:\mydata\",analysisInstance,"LowerLimb",normativeInstance)
- pyCGM2.Lib.plot.plot_MAP(DATA_PATH, analysis, normativeDataset, exportPdf=False, outputName=None, pointLabelSuffix=None, show=True, title=None, exportPng=False, OUT_PATH=None)
display histogram of the Movement Analysis Profile.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance.
pointLabelSuffix (str) – suffix previously added to your model outputs.
type (str) – [Optional, “Gait”]. event type. By default cycle is defined from foot strike. Gait searched for the foot off events.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
plot_MAP("c:\mydata\",analysisInstance,normativeInstance)
- pyCGM2.Lib.plot.plot_spatioTemporal(DATA_PATH, analysis, exportPdf=False, OUT_PATH=None, outputName=None, show=True, title=None, exportPng=False)
display spatio-temporal parameters as horizontal histogram.
- Parameters
DATA_PATH (str) – path to your data
analysis (pyCGM2.Processing.analysis.Analysis) – analysis instance.
OUT_PATH (str) – path to your ouput folder
exportPdf (bool) – export as pdf
outputName (str) – name of the output filename.
show (bool) – show matplotlib figure.
title (str) – modify the plot panel title.
exportPng (bool) – export as png.
Examples:
plot_spatioTemporal("C:\myDATA\", analysisInstance)
report
- pyCGM2.Lib.report.pdfGaitReport(DATA_PATH, modelledTrials, normativeDataset, pointSuffix, title='gait report')
generate pdf with Kinematic-Kinetic-MAP gait plots .
- Parameters
DATA_PATH (str) – data folder path
modelledTrials (list) – modelled trial names
normativeDataset (pyCGM2.Report.normativeDatasets.NormativeData) – a normativeDataset instance
pointSuffix (str) – suffix added to model outputs
title (str,Optional[gait report]) – title