Report
normativeDatasets
Module deals with normative datasets.
Normative datasets are embedded in pyCGM2. they are placed in the folder pyCGM2/Data as a json file.
The construction of a NormativeData instance automatically populate its attribute data, an intuitive dictionary with model ouput as key, reporting mean and standard deviation as sub-key.
The NormativeSTP class replicates the process for the spatio-temporal excel file (normal_stp.xlsx) placed in the folder pyCGM2/Data/stp
- class pyCGM2.Report.normativeDatasets.NormalSTP
Normative spatio-temporal dataset.
The instance contruction populates the attribute data which reports normative data as a dictionary
- class pyCGM2.Report.normativeDatasets.NormativeData(filenameNoExt, modality)
Normative dataset.
The instance contruction populates the attribute data which reports normative data as a dictionary
- Parameters
filenameNoExt (str) – filename of the targeted json file.
modality (str) – modality.
plot
Module contains low-level plot functions
- pyCGM2.Report.plot.addNormalActivationLayer(figAxis, normalActivationLabel, fo)
display normal muscle activation in the background of a time-normalized trace
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
normalActivationLabel (str) – muscle label
fo (int) – time-normalized foot off frame
- pyCGM2.Report.plot.addTemporalNormalActivationLayer(figAxis, acq, normalActivationLabel, context)
display normal muscle activation in the background of a temporal trace
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
acq (btk.Acquisition) – an acquisition
normalActivationLabel (str) – muscle label
context (str) – event context
- pyCGM2.Report.plot.consistencyPlot(figAxis, analysisStructureItem, pointLabel, contextPointLabel, axis, color=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot all time-normalized traces from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
pointLabel (str) – point label
contextPointLabel (str) – event context
axis (int) – column index of the point values
color (type,Optional[None]) – line color
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
- pyCGM2.Report.plot.descriptivePlot(figAxis, analysisStructureItem, pointLabel, contextPointLabel, axis, color=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot descriptive (average and sd corridor) time-normalized traces from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
pointLabel (str) – point label
contextPointLabel (str) – event context
axis (int) – column index of the point values
color (type,Optional[None]) – line color
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
- pyCGM2.Report.plot.gaitConsistencyPlot(figAxis, analysisStructureItem, pointLabel, contextPointLabel, axis, color=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot all gait traces from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
pointLabel (str) – point label
contextPointLabel (str) – event context
axis (int) – column index of the point values
color (type,Optional[None]) – line color
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
- pyCGM2.Report.plot.gaitDescriptivePlot(figAxis, analysisStructureItem, pointLabel, contextPointLabel, axis, color=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot descriptive (average and sd corridor) gait traces from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
pointLabel (str) – point label
contextPointLabel (str) – event context
axis (int) – column index of the point values
color (type,Optional[None]) – line color
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
- pyCGM2.Report.plot.gaitMeanPlot(figAxis, analysisStructureItem, pointLabel, contextPointLabel, axis, color=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot average gait traces from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
pointLabel (str) – point label
contextPointLabel (str) – event context
axis (int) – column index of the point values
color (type,Optional[None]) – line color
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
- pyCGM2.Report.plot.meanPlot(figAxis, analysisStructureItem, pointLabel, contextPointLabel, axis, color=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot the average time-normalized traces from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
pointLabel (str) – point label
contextPointLabel (str) – event context
axis (int) – column index of the point values
color (type,Optional[None]) – line color
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
- pyCGM2.Report.plot.stpHorizontalHistogram(figAxis, analysisStructureItem, stpLabel, overall=False, title=None, xlabel=None, xlim=None)
Plot spatio-temporal parameters as histogram from an attribute of an analysis instance
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
analysisStructureItem (pyCGM2.Processing.analysis.Analysis.(attribute)) – an attribute of an analysis instance
stpLabel (str) – spatio-temporal label
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
xlim (list,Optional[None]) – x boundaries
- pyCGM2.Report.plot.temporalPlot(figAxis, acq, pointLabel, axis, pointLabelSuffix=None, color=None, linewidth=None, title=None, xlabel=None, ylabel=None, ylim=None, legendLabel=None, customLimits=None)
Plot temporal traces from an acquisition
- Parameters
figAxis (matplotlib.pyplot.Axis) – a matplotlib figure axis
acq (btk.Acquisition) – an acquisition
pointLabel (str) – point label
axis (int) – column index of the point values
pointLabelSuffix (type,Optional[None]) – suffix added to the point label
color (type,Optional[None]) – line color
linewidth (type,Optional[None]) – line width
title (type,Optional[None]) – plot title
xlabel (type,Optional[None]) – x-axis label
ylabel (type,Optional[None]) – y-axis label
ylim (list,Optional[None]) – y boundaries
legendLabel (type,Optional[None]) – legend
customLimits (list,Optional[None]) – horizontal lines
plotFilters
This Module contains the pyCGM2 plot filter PlottingFilter.
This PlottingFilter requires a PlotViewer, then displays the plot panel
- class pyCGM2.Report.plotFilters.PlottingFilter
The plot filter
- plot()
generate plot panel
- setAutomaticYlimits()
set Y-axis boundaries to default values
- setExport(path, filename, format)
Set filename of the export file
- Parameters
path (str) – folder path
filename (str) – filename
format (str) – file format
- setHorizontalLine(axisIndex, value, color='black')
set horizontal lines
- Parameters
axisIndex (int) – index of the matplotlib.figure.axis instance
value (double) – y-axis value
color (str,Optional[black]) – line color
- setTitle(title)
Set the plot panel title
- Parameters
title (str) – title
- setViewer(concretePlotViewer)
set the plot viewer
- Parameters
concretePlotViewer (pyCGM2.report.(Viewers)) – a plot viewer
- setYlimits(axisIndex, min, max)
set the y-axis boundaries
- Parameters
axisIndex (int) – index of the matplotlib.figure.axis instance
min (double) – minimum value
max (double) – maximum value
plotUtils
Viewers
plotViewers
Module contains plotViewers for displaying convenient gait plot
- class pyCGM2.Report.Viewers.plotViewers.GpsMapPlotViewer(iAnalysis, pointLabelSuffix=None)
Plot viewer to display GPS and MAP panel
- Parameters
iAnalysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
- plotPanel()
plat the panel
- class pyCGM2.Report.Viewers.plotViewers.NormalizedKinematicsPlotViewer(iAnalysis, pointLabelSuffix=None, bodyPart=BodyPartPlot.LowerLimb)
Plot time-Normalized Kinematics
- Parameters
iAnalysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
pointLabelSuffix (str) – suffix added model outputs
bodyPart (enums.BodyPartPlot,Optional[enums.BodyPartPlot.LowerLimb]) – body part
- plotPanel()
Plot the panel
- setConcretePlotFunction(concreteplotFunction)
set a plot function ( see plot)
- Parameters
concreteplotFunction (function) – plot function
- setNormativeDataset(iNormativeDataSet)
Set the normative dataset
- Parameters
iNormativeDataSet (pyCGM2.Report.normativeDatasets.NormativeData) – a normative dataset instance
- class pyCGM2.Report.Viewers.plotViewers.NormalizedKineticsPlotViewer(iAnalysis, pointLabelSuffix=None, bodyPart=BodyPartPlot.LowerLimb)
Plot time-Normalized kinetics
- Parameters
iAnalysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
pointLabelSuffix (str) – suffix added model outputs
bodyPart (enums.BodyPartPlot,Optional[enums.BodyPartPlot.LowerLimb]) – body part
- plotPanel()
Plot the panel
- setConcretePlotFunction(concreteplotFunction)
set a plot function ( see plot)
- Parameters
concreteplotFunction (function) – plot function
- setNormativeDataset(iNormativeDataSet)
Set the normative dataset
- Parameters
iNormativeDataSet (pyCGM2.Report.normativeDatasets.NormativeData) – a normative dataset instance
- class pyCGM2.Report.Viewers.plotViewers.SpatioTemporalPlotViewer(iAnalysis)
Plot viewer to display spatio-temporal parameters as histogram
- Parameters
iAnalysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
- plotPanel()
Plot the panel
- setNormativeDataset(iNormativeDataSet)
Set the normative dataset
- Parameters
iNormativeDataSet (pyCGM2.Report.normativeDatasets.NormalSTP) – a spatio-temporal normative dataset instance
- class pyCGM2.Report.Viewers.plotViewers.TemporalKinematicsPlotViewer(iAcq, pointLabelSuffix=None, bodyPart=BodyPartPlot.LowerLimb)
Plot temporal Kinematics
- Parameters
iAcq (btk.Acquisition) – an acquisition
pointLabelSuffix (str) – suffix added model outputs
bodyPart (enums.BodyPartPlot,Optional[enums.BodyPartPlot.LowerLimb]) – body part
- plotPanel()
Plot the panel
- class pyCGM2.Report.Viewers.plotViewers.TemporalKineticsPlotViewer(iAcq, pointLabelSuffix=None, bodyPart=BodyPartPlot.LowerLimb)
Plot temporal Kinetics
- Parameters
iAcq (btk.Acquisition) – an acquisition
pointLabelSuffix (str) – suffix added model outputs
bodyPart (enums.BodyPartPlot,Optional[enums.BodyPartPlot.LowerLimb]) – body part
- plotPanel()
plot the panel
emgPlotViewers
Module contains plotViewers for displaying emg data
- class pyCGM2.Report.Viewers.emgPlotViewers.CoactivationEmgPlotViewer(iAnalysis, pointLabelSuffix=None)
plot coactivation plot
- Parameters
iAnalysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
pointLabelSuffix (str,Optional[None]) – suffix added to emg outputs
- plotPanel()
plot the panel
- setConcretePlotFunction(concreteplotFunction)
set a concrete plot function
- Parameters
concreteplotFunction (pyCGM2.Report.plot) – plot function
- setContext(context)
set event context
- Parameters
context (str) – event context
- setEmgs(label1, label2)
set the 2 emg labels to plot
- Parameters
label1 (str) – emg channel label
label2 (str) – emg channel label
- setMuscles(label1, label2)
set the 2 measured muscle names
- Parameters
label1 (str) – muscle name
label2 (str) – muscle name
- class pyCGM2.Report.Viewers.emgPlotViewers.EnvEmgGaitPlotPanelViewer(iAnalysis, pointLabelSuffix=None)
plot emg envelops
- Parameters
iAnalysis (pyCGM2.Processing.analysis.Analysis) – an analysis instance
pointLabelSuffix (str,Optional[None]) – suffix added to emg outputs
- plotPanel()
plot the panel
- selectEmgChannels(channelNames)
set the emg channels
- Parameters
channelNames (str) – channel labels
- setConcretePlotFunction(concreteplotFunction)
set a concrete plot function
- Parameters
concreteplotFunction (pyCGM2.Report.plot) – plot function
- setEmgManager(emgManager)
set the emgManager instance
- Parameters
emgManager (pyCGM2.EMG.EmgManager) – emgManager instance
- setNormalizedEmgFlag(flag)
Enable/Disable amplitude-normalized emg
- Parameters
flag (bool) – boolean flag
- class pyCGM2.Report.Viewers.emgPlotViewers.MultipleAnalysis_EnvEmgPlotPanelViewer(iAnalyses, legends, pointLabelSuffix=None)
plot emg envelops from multiple analysis instances
- Parameters
iAnalyses (list) – analysis instances
legend (str) – label assoaciated to each instance
pointLabelSuffix (str,Optional[None]) – suffix added to emg outputs
- plotPanel()
plot the panel
- selectEmgChannels(channelNames)
set the emg channels
- Parameters
channelNames (str) – channel labels
- setConcretePlotFunction(concreteplotFunction)
set a concrete plot function
- Parameters
concreteplotFunction (pyCGM2.Report.plot) – plot function
- setEmgManager(emgManager)
set the emgManager instance
- Parameters
emgManager (pyCGM2.EMG.EmgManager) – emgManager instance
- setNormalizedEmgFlag(flag)
Enable/Disable amplitude-normalized emg
- Parameters
flag (bool) – boolean flag
- class pyCGM2.Report.Viewers.emgPlotViewers.TemporalEmgPlotViewer(iAcq, pointLabelSuffix=None)
plot temporal emg plot
- Parameters
iAcq (btk.Acquisition) – an acquisition
pointLabelSuffix (str,Optional[None]) – suffix added to emg outputs
- ignoreNormalActivty(bool)
Enable/disable normal actividy display
- Parameters
bool (bool) – boolean flag
- plotPanel()
plot the panel
- selectEmgChannels(channelNames)
set the emg channels
- Parameters
channelNames (str) – channel labels
- setEmgManager(emgManager)
set the emgManager instance
- Parameters
emgManager (pyCGM2.EMG.EmgManager) – emgManager instance
- setEmgRectify(flag)
Enable/disable rectify mode
- Parameters
flag (bool) – boolean flag
comparisonPlotViewers
Module contains plotViewers for comparing data from different analysis instances
- class pyCGM2.Report.Viewers.comparisonPlotViewers.KinematicsPlotComparisonViewer(iAnalyses, context, legends, pointLabelSuffix_lst=None, bodyPart=BodyPartPlot.LowerLimb)
Compare kinematics
- Parameters
iAnalyses (list) – pyCGM2.Processing.analysis.Analysis instances
context (str) – event context
pointLabelSuffix (str) –
legends (list) – labels caracterizing the analysis instances
pointLabelSuffix_lst (list,Optional[None]) – suffix added to model outputs of the analysis instances
bodyPart (pyCGM2.enums.BodyPartPlot,Optional[pyCGM2.enums.BodyPartPlot.LowerLimb]) – body part
- plotPanel()
plot the panel
- setConcretePlotFunction(concreteplotFunction)
set a plot function ( see plot)
- Parameters
concreteplotFunction (function) – plot function
- setNormativeDataset(iNormativeDataSet)
Set a normative dataset
- Parameters
iNormativeDataSet (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance
- class pyCGM2.Report.Viewers.comparisonPlotViewers.KineticsPlotComparisonViewer(iAnalyses, context, legends, pointLabelSuffix_lst=None, bodyPart=BodyPartPlot.LowerLimb)
Compare kinetics
- Parameters
iAnalyses (list) – pyCGM2.Processing.analysis.Analysis instances
context (str) – event context
pointLabelSuffix (str) –
legends (list) – labels caracterizing the analysis instances
pointLabelSuffix_lst (list,Optional[None]) – suffix added to model outputs of the analysis instances
bodyPart (pyCGM2.enums.BodyPartPlot,Optional[pyCGM2.enums.BodyPartPlot.LowerLimb]) – body part
- plotPanel()
plot the panel
- setConcretePlotFunction(concreteplotFunction)
set a plot function ( see plot)
- Parameters
concreteplotFunction (function) – plot function
- setNormativeDataset(iNormativeDataSet)
Set a normative dataset
- Parameters
iNormativeDataSet (pyCGM2.Report.normativeDatasets.NormativeData) – normative data instance