def gaitDescriptiveKinematicPlotPanel(cls): # ----DATA----- DATA_PATH = pyCGM2.TEST_DATA_PATH+"operations\\plot\\gaitPlot\\" modelledFilenames = ["gait Trial 03 - viconName.c3d"] #---- c3d manager #-------------------------------------------------------------------------- c3dmanagerProcedure = c3dManager.UniqueC3dSetProcedure(DATA_PATH,modelledFilenames) cmf = c3dManager.C3dManagerFilter(c3dmanagerProcedure) cmf.enableEmg(False) trialManager = cmf.generate() #---- Analysis #-------------------------------------------------------------------------- modelInfo=None subjectInfo=None experimentalInfo=None analysisInstance = analysis.makeAnalysis("Gait", "CGM1.0", DATA_PATH,modelledFilenames,None, None, None) # viewer kv = plotViewers.LowerLimbKinematicsPlotViewer(analysisInstance) kv.setConcretePlotFunction(plot.gaitDescriptivePlot) kv.setNormativeDataset(normativeDatasets.Schwartz2008("Free")) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.plot() plt.show()
def gaitDescriptiveKinematicPlotPanel(cls): # ----DATA----- DATA_PATH = pyCGM2.TEST_DATA_PATH+"operations\\plot\\gaitPlot\\" modelledFilenames = ["gait Trial 03 - viconName.c3d"] #---- c3d manager #-------------------------------------------------------------------------- c3dmanagerProcedure = c3dManager.UniqueC3dSetProcedure(DATA_PATH,modelledFilenames) cmf = c3dManager.C3dManagerFilter(c3dmanagerProcedure) cmf.enableEmg(False) trialManager = cmf.generate() #---- Analysis #-------------------------------------------------------------------------- modelInfo=None subjectInfo=None experimentalInfo=None analysis = gaitSmartFunctions.make_analysis(trialManager, cgm.CGM1LowerLimbs.ANALYSIS_KINEMATIC_LABELS_DICT, cgm.CGM1LowerLimbs.ANALYSIS_KINETIC_LABELS_DICT, modelInfo,subjectInfo,experimentalInfo) # viewer kv = plotViewers.LowerLimbKinematicsPlotViewer(analysis) kv.setConcretePlotFunction(plot.gaitDescriptivePlot) kv.setNormativeDataset(normativeDatasets.Schwartz2008("Free")) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.plot() ka = annotator.Annotator(pf.fig) ka.IncreasedRange(0,40,10,40, "Context", timing="Throughout Cycle") print(ka.getAnnotations()) plt.show()
def gaitDescriptiveKinematicPlotPanel_recorded(cls): # ----DATA----- DATA_PATH = pyCGM2.TEST_DATA_PATH+"operations\\plot\\gaitPlot\\" modelledFilenames = ["gait Trial 03 - viconName.c3d"] #---- c3d manager #-------------------------------------------------------------------------- c3dmanagerProcedure = c3dManager.UniqueC3dSetProcedure(DATA_PATH,modelledFilenames) cmf = c3dManager.C3dManagerFilter(c3dmanagerProcedure) cmf.enableEmg(False) trialManager = cmf.generate() #---- Analysis #-------------------------------------------------------------------------- modelInfo=None subjectInfo=None experimentalInfo=None analysis = gaitSmartFunctions.make_analysis(trialManager, cgm.CGM1LowerLimbs.ANALYSIS_KINEMATIC_LABELS_DICT, cgm.CGM1LowerLimbs.ANALYSIS_KINETIC_LABELS_DICT, modelInfo,subjectInfo,experimentalInfo) # viewer kv = plotViewers.LowerLimbKinematicsPlotViewer(analysis) kv.setConcretePlotFunction(plot.gaitDescriptivePlot) kv.setNormativeDataset(normativeDatasets.Schwartz2008("Free")) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.setExport("C:\\Users\\HLS501\\Desktop\\","test","png") pf.plot() plt.show()
def cgm_gaitPlots(modelVersion, analysis, kineticFlag, outputPath, pdfFilename, pointLabelSuffix="", normativeDataset=None): # filter 0 - stp panel #------------------------------------------- # pstViewer stpv = plotViewers.SpatioTemporalPlotViewer(analysis) stpv.setNormativeDataset(normativeDatasets.NormalSTP()) # filter stppf = plotFilters.PlottingFilter() stppf.setViewer(stpv) stppf.setExport(outputPath, str(pdfFilename + "-stp"), "pdf") stppf.plot() # filter 1 - descriptive kinematic panel #------------------------------------------- # viewer if modelVersion in [ "CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2", "CGM2.2e", "CGM2.3", "CGM2.3e" ]: kv = plotViewers.LowerLimbKinematicsPlotViewer( analysis, pointLabelSuffix=pointLabelSuffix) elif modelVersion in ["CGM2.4", "CGM2.4e"]: kv = plotViewers.LowerLimbMultiFootKinematicsPlotViewer( analysis, pointLabelSuffix=pointLabelSuffix) else: raise Exception("[pyCGM2] Model version not known") kv.setConcretePlotFunction(plot.gaitDescriptivePlot) if normativeDataset is not None: kv.setNormativeDataset(normativeDataset) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.setExport(outputPath, str(pdfFilename + "-descriptive Kinematics"), "pdf") pf.plot() # filter 2 - consistency kinematic panel #------------------------------------------- # viewer if modelVersion in [ "CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2", "CGM2.2e", "CGM2.3", "CGM2.3e" ]: kv = plotViewers.LowerLimbKinematicsPlotViewer( analysis, pointLabelSuffix=pointLabelSuffix) elif modelVersion in ["CGM2.4", "CGM2.4e"]: kv = plotViewers.LowerLimbMultiFootKinematicsPlotViewer( analysis, pointLabelSuffix=pointLabelSuffix) else: raise Exception("[pyCGM2] Model version not known") kv.setConcretePlotFunction(plot.gaitConsistencyPlot) if normativeDataset is not None: kv.setNormativeDataset(normativeDataset) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.setExport(outputPath, str(pdfFilename + "-consistency Kinematics"), "pdf") pf.plot() if kineticFlag: # filter 1 - descriptive kinematic panel #------------------------------------------- # viewer if modelVersion in [ "CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2", "CGM2.2e", "CGM2.3", "CGM2.3e", "CGM2.4", "CGM2.4e" ]: kv = plotViewers.LowerLimbKineticsPlotViewer( analysis, pointLabelSuffix=pointLabelSuffix) kv.setConcretePlotFunction(plot.gaitDescriptivePlot) if normativeDataset is not None: kv.setNormativeDataset(normativeDataset) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.setExport(outputPath, str(pdfFilename + "-descriptive Kinetics"), "pdf") pf.plot() # filter 2 - consistency kinematic panel #------------------------------------------- # viewer if modelVersion in [ "CGM1.0", "CGM1.1", "CGM2.1", "CGM2.2", "CGM2.2e", "CGM2.3", "CGM2.3e", "CGM2.4", "CGM2.4e" ]: kv = plotViewers.LowerLimbKineticsPlotViewer( analysis, pointLabelSuffix=pointLabelSuffix) kv.setConcretePlotFunction(plot.gaitConsistencyPlot) if normativeDataset is not None: kv.setNormativeDataset(normativeDataset) # filter pf = plotFilters.PlottingFilter() pf.setViewer(kv) pf.setExport(outputPath, str(pdfFilename + "-consistency Kinetics"), "pdf") pf.plot()