pyCGM_Single.pycgmIO.loadC3D¶
-
pyCGM_Single.pycgmIO.
loadC3D
(filename)¶ Open and load a C3D 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 C3D file to be loaded
- Returns
- [data, dataunlabeled, markers]array
data is a list of dict. Each dict represents one frame in the trial. dataunlabeled contains a list of dictionaries of the same form as in data, but for unlabeled points. markers is a list of marker names.
Examples
The files 59993_Frame_Static.c3d and RoboStatic.c3d in SampleData are used to test the output.
>>> from .pyCGM_Helpers import getfilenames >>> from numpy import around, array >>> filename_59993 = getfilenames(x=1)[1] >>> result_59993 = loadC3D(filename_59993) >>> data = result_59993[0] >>> dataunlabeled = result_59993[1] >>> markers = result_59993[2] >>> roboFilename = getfilenames(x=3)[1] >>> result_roboFilename = loadC3D(roboFilename) >>> roboDataUnlabeled = result_roboFilename[1]
Testing for some values from 59993_Frame_Static.c3d.
>>> around(data[0]['RHNO'], 8) array([ 555.46948242, -559.36499023, 1252.84216309]) >>> around(data[0]['C7'], 8) array([ -29.57296562, -9.34280109, 1300.86730957]) >>> dataunlabeled[4] {'*113': array([-172.66630554, 167.2040863 , 1273.71594238]), '*114': array([ 169.18231201, -227.13475037, 1264.34912109])} >>> markers ['LFHD', 'RFHD', 'LBHD', ...]
Frame 0 in RoboStatic.c3d has no unlabeled data.
>>> roboDataUnlabeled[0] {}