pyCGM_Single.pycgmIO.splitMotionDataDict

pyCGM_Single.pycgmIO.splitMotionDataDict(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.91])},
...               {'RFHD': array([326.83, 403.55, 1723.51]),
...                'LFHD': array([185.55, 408.69, 1722.34]),
...                'LBHD': array([198.86, 252.29, 1697.91])}]
>>> labels, data = splitMotionDataDict(motiondata)
>>> labels
['RFHD', 'LFHD', 'LBHD']
>>> data 
array([[[ 325.83, 402.55, 1722.51],
        [ 184.55, 409.69, 1721.34],
        [ 197.86, 251.29, 1696.91]],
       [[ 326.83, 403.55, 1723.51],
        [ 185.55, 408.69, 1722.34],
        [ 198.86, 252.29, 1697.91]]])