pyCGM_Single.pyCGM.loadCSV

pyCGM_Single.pyCGM.loadCSV(filename)

Open and load a CSV file of motion capture data.

Keys in the returned data dictionaries are marker names, and the corresponding values are a numpy array with the associated value. data[marker] = array([x, y, z])

Parameters
filenamestr

File name of the CSV file to be loaded.

Returns
[motionData, unlabeledMotionData, labels]array

motionData is a list of dict. Each dict represents one frame in the trial. unlabeledMotionData contains a list of dictionaries of the same form as in motionData, but for unlabeled points. labels is a list of marker names.

Examples

Sample_Static.csv in SampleData is used to test the output.

>>> filename = 'SampleData/ROM/Sample_Static.csv'
>>> result = loadCSV(filename)
>>> motionData = result[0]
>>> unlabeledMotionData = result[1]
>>> labels = result[2]

Testing for some values from data.

>>> motionData[0]['RHNO'] 
array([ 811.9591064, 677.3413696, 1055.390991 ])
>>> motionData[0]['C7'] 
array([ 250.765976, 165.616333, 1528.094116])
>>> unlabeledMotionData[0] 
{'*111': array([ 692.8970947, 423.9462585, 1240.289063 ]),
 '*112': array([-225.5265198, 405.5791321, 1214.458618 ]),
 '*113': array([ -82.65164185, 232.3781891 , 1361.853638 ]),
 '*114': array([ 568.5736694, 260.4929504, 1361.799805 ])}
>>> labels
['LFHD', 'RFHD', 'LBHD', ...]