pyCGM_Single.pycgmIO.splitDataDict

pyCGM_Single.pycgmIO.splitDataDict(motionData)

Splits an array of motion capture data into separate labels and data.

Parameters
motionDataarray

List of dict. Indices of motionData correspond to frames in the trial. Keys in the dictionary are marker names and values are x, y, and z coordinates of the corresponding marker.

Returns
labels, datatuple

labels is a list of marker position names from the dictionary keys in motiondata. data is a list of x, y, and z coordinate values corresponding to the marker names in labels. Indices of data correspond to frames in the trial.

Examples

Example for three markers and two frames of trial.

>>> from numpy import array
>>> motionData = [{'RFHD': array([325.83, 402.55, 1722.51]),
...                'LFHD': array([184.55, 409.69, 1721.34]),
...                'LBHD': array([197.86, 251.29, 1696.92])},
...               {'RFHD': array([326.83, 403.55, 1723.53]),
...                'LFHD': array([185.55, 408.69, 1722.34]),
...                'LBHD': array([198.86, 252.29, 1697.94])}]
>>> values, labels = splitDataDict(motionData)
>>> labels
['RFHD', 'LFHD', 'LBHD']
>>> values 
[array([[ 325.83, 402.55, 1722.51],
        [ 184.55, 409.69, 1721.34],
        [ 197.86, 251.29, 1696.92]]),
 array([[ 326.83, 403.55, 1723.53],
        [ 185.55, 408.69, 1722.34],
        [ 198.86, 252.29, 1697.94]])]