Beispiel #1
0
    def setup_class(cls):
        """
        Called once for all tests for Pipelines.
        Sets rounding_precision, and does a one-time load
        of dynamic and static trial data as dictionaries from
        SampleData/Sample_2/.
        """
        cls.rounding_precision = 8
        cwd = os.getcwd()
        if(cwd.split(os.sep)[-1]=="pyCGM_Single"):
            parent = os.path.dirname(cwd)
            os.chdir(parent)
        cls.cwd = os.getcwd()

        cur_dir = cls.cwd
        dynamic_trial, static_trial,_,_,_ = getfilenames(3)
        dynamic_trial = os.path.join(cur_dir, dynamic_trial)
        static_trial = os.path.join(cur_dir, static_trial)
        motionData = loadData(dynamic_trial)
        staticData = loadData(static_trial)
        cls.data_original = dataAsDict(motionData, npArray=True)
        cls.static_original = dataAsDict(staticData, npArray=True)
        for frame in motionData:
            frame['SACR'] = pelvisJointCenter(frame)[2]
        cls.data_with_sacrum_original = dataAsDict(motionData, npArray=True)
        Pipelines.clearMarker(motionData, 'LFHD')
        cls.data_with_sacrum_clear_marker = dataAsDict(motionData, npArray=True)
Beispiel #2
0
    def test_clearMarker_accuracy(self, data, name, expected_result):
        """
        This function tests Pipelines.clearMarker(data, name), where
        data is an array of dictionary of markers lists and name is the 
        name of a marker to clear.

        We test cases where the values in data are lists and numpy arrays.
        We test the case where the marker name is not a key in data.
        """
        result = Pipelines.clearMarker(data, name)
        np.testing.assert_equal(result, expected_result)