Ejemplo n.º 1
0
    def test_gaitConsistencyKinematicPlotPanel(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)

        # viewer
        kv = plotViewers.NormalizedKinematicsPlotViewer(analysisInstance)
        kv.setConcretePlotFunction(plot.gaitConsistencyPlot)
        kv.setNormativeDataset(normativeDatasets.Schwartz2008("Free"))

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        pf.plot()
Ejemplo n.º 2
0
    def test_descriptiveKinematicPlotPanel_savePngAndPdf(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"]

        DATA_PATH_OUT = pyCGM2.TEST_DATA_PATH_OUT+"GaitData\CGM1-NormalGaitData-Events\Hånnibøl Lecter\\"
        files.createDir(DATA_PATH_OUT)

        modelInfo=None
        subjectInfo=None
        experimentalInfo=None

        analysisInstance = analysis.makeAnalysis(DATA_PATH,modelledFilenames)

        # viewer
        kv = plotViewers.NormalizedKinematicsPlotViewer(analysisInstance)
        kv.setConcretePlotFunction(plot.descriptivePlot)
        kv.setNormativeDataset(normativeDatasets.Schwartz2008("Free"))

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        pf.setExport(DATA_PATH_OUT,"test_descriptiveKinematicPlotPanel","png")
        pf.plot()

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        pf.setExport(DATA_PATH_OUT,"test_descriptiveKinematicPlotPanel","pdf")
        pf.plot()
Ejemplo n.º 3
0
    def test_lowLevel_NormalizedKinematicsPlotViewer(self):

        DATA_PATH, analysisInstance = dataTest1()
        normativeDataset = normativeDatasets.NormativeData(
            "Schwartz2008", "Free")
        # viewer
        kv = plotViewers.NormalizedKinematicsPlotViewer(analysisInstance)
        kv.setConcretePlotFunction(reportPlot.gaitDescriptivePlot)
        kv.setNormativeDataset(normativeDataset)

        # filter
        pf = plotFilters.PlottingFilter()
        pf.setViewer(kv)
        fig = pf.plot()

        if SHOW: plt.show()
        return fig
Ejemplo n.º 4
0
def plot_ConsistencyKinematic(DATA_PATH,
                              analysis,
                              bodyPart,
                              normativeDataset,
                              pointLabelSuffix=None,
                              type="Gait",
                              exportPdf=False,
                              outputName=None,
                              show=True,
                              title=None):
    """
    plot_ConsistencyKinematic : display all gait cycle of time-normalized kinematic outputs


    :param DATA_PATH [str]: path to your data
    :param analysis [pyCGM2.Processing.analysis.Analysis]: pyCGM2 analysis instance
    :param bodyPart [str]: body part (choice : LowerLimb, Trunk, UpperLimb)
    :param normativeDataset [pyCGM2.Report.normativeDatasets]: pyCGM2 normative dataset instance

    **optional**

    :param pointLabelSuffix [string]: suffix previously added to your model outputs
    :param type [string]:  display gait events ( other choice than gait [default], display foot strikes only)
    :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 bodyPart == "LowerLimb":
        bodyPart = enums.BodyPartPlot.LowerLimb
    elif bodyPart == "Trunk":
        bodyPart = enums.BodyPartPlot.Trunk
    elif bodyPart == "UpperLimb":
        bodyPart = enums.BodyPartPlot.UpperLimb
    else:
        raise Exception(
            "[pyCGM2] - bodyPart argument not recognized ( must be LowerLimb, Trunk or UpperLimb) "
        )

    if outputName is None:
        outputName = "Global Analysis [" + bodyPart.name + "]"

    if exportPdf:
        filenameOut = str(outputName + "-consistency Kinematics [" +
                          bodyPart.name + "]")

    kv = plotViewers.NormalizedKinematicsPlotViewer(
        analysis, pointLabelSuffix=pointLabelSuffix, bodyPart=bodyPart)

    if type == "Gait":
        kv.setConcretePlotFunction(plot.gaitConsistencyPlot)
    else:
        kv.setConcretePlotFunction(plot.consistencyPlot)

    if normativeDataset is not None:
        kv.setNormativeDataset(normativeDataset)

    # filter
    pf = plotFilters.PlottingFilter()
    pf.setViewer(kv)
    if exportPdf: pf.setExport(DATA_PATH, filenameOut, "pdf")
    if title is not None:
        pf.setTitle(
            str(title + "-consistency  Kinematics [" + bodyPart.name + "]"))
    pf.plot()
    if show: plt.show()