Exemple #1
0
    def test_singleAnalysis(self):

        # ----DATA-----
        DATA_PATH = pyCGM2.TEST_DATA_PATH + "GaitData\CGM1-NormalGaitData-Events\Hånnibøl Lecter\\"
        modelledFilenames = ["gait Trial 01.c3d", "gait Trial 02.c3d"]

        #---- Analysis
        #--------------------------------------------------------------------------

        modelInfo = None
        subjectInfo = None
        experimentalInfo = None

        analysisInstance = analysis.makeAnalysis(DATA_PATH, modelledFilenames)

        ndp = normativeDatasets.Schwartz2008("Free")
        gps = scores.CGM1_GPS()
        scf = scores.ScoreFilter(gps, analysisInstance, ndp)
        scf.compute()

        # viewer
        kv = plotViewers.GpsMapPlotViewer(analysisInstance)

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        pf.plot()
Exemple #2
0
def plot_MAP(DATA_PATH,
             analysis,
             normativeDataset,
             exportPdf=False,
             outputName=None,
             pointLabelSuffix=None,
             show=True,
             title=None,
             exportPng=False):
    """
    plot_MAP : display the Movement Analysis Profile


    :param DATA_PATH [str]: path to your data
    :param analysis [pyCGM2.Processing.analysis.Analysis]: pyCGM2 analysis instance
    :param normativeDataset [pyCGM2.Report.normativeDatasets]: pyCGM2 normative dataset instance


    **optional**

    :param pointLabelSuffix [string]: (None) suffix added to outputs
    :param exportPdf [bool]: save as pdf (False[default])
    :param outputName [string]:  name of your pdf file (None[default] export your pdf with name : Global Analysis)
    :param show [bool]: enable matplotlib show function
    :param title [string]: change default title of the plot panel
    """
    if outputName is None:
        outputName = "PyCGM2-Analysis"

    if exportPdf or exportPng:
        filenameOut = outputName + "-Map"

    #compute
    gps = scores.CGM1_GPS(pointSuffix=pointLabelSuffix)
    scf = scores.ScoreFilter(gps, analysis, normativeDataset)
    scf.compute()

    #plot
    kv = plotViewers.GpsMapPlotViewer(analysis,
                                      pointLabelSuffix=pointLabelSuffix)

    pf = plotFilters.PlottingFilter()
    pf.setViewer(kv)
    if exportPdf: pf.setExport(DATA_PATH, filenameOut, "pdf")
    if title is not None: pf.setTitle(title + "-Map")
    fig = pf.plot()
    if show: plt.show()

    if exportPng:
        fig.savefig(DATA_PATH + filenameOut + ".png")
        return fig, filenameOut + ".png"
    else:
        return fig
Exemple #3
0
    def singleAnalysis(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)


        ndp = normativeDatasets.Schwartz2008("Free")
        gps =scores.CGM1_GPS()
        scf = scores.ScoreFilter(gps,analysis, ndp)
        scf.compute()

        # viewer
        kv = plotViewers.GpsMapPlotViewer(analysis)

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        pf.setPath(DATA_PATH)
        pf.setPdfName(str("map"))
        pf.plot()

        plt.show()
Exemple #4
0
    def singleAnalysis(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)

        ndp = normativeDatasets.Schwartz2008("Free")
        gps = scores.CGM1_GPS()
        scf = scores.ScoreFilter(gps, analysisInstance, ndp)
        scf.compute()

        # viewer
        kv = plotViewers.GpsMapPlotViewer(analysisInstance)

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        pf.setPath(DATA_PATH)
        pf.setPdfName(str("map"))
        pf.plot()

        plt.show()