Marcos Duarte
Laboratory of Biomechanics and Motor Control
Federal University of ABC, Brazil
EZC3D is an easy to use reader, modifier and writer for C3D format files.
https://github.com/pyomeca/ezc3d
import numpy as np
import pandas as pd
#%matplotlib notebook
%matplotlib widget
import matplotlib as mpl
import matplotlib.pyplot as plt
import sys, os
import ezc3d
sys.path.insert(1, r'./../functions')
from dfmlevel import dfmlevel
from read_c3d import read_c3d
path2 = '/mnt/A/BMClab/Projects/FapespRunAge/Data/Cadence/s20/'
fname = 'run100c.c3d'
fname = os.path.join(path2, fname)
an, pt = read_c3d(fname, analog='all', point='all', short_label=True)
an
F1X | F1Y | F1Z | M1X | M1Y | M1Z | F2X | F2Y | F2Z | M2X | ... | Sensor 9EMG | Sensor 9IM ACC Pitch | Sensor 9IM ACC Roll | Sensor 9IM ACC Yaw | Sensor 9IM GYR Pitch | Sensor 9IM GYR Roll | Sensor 9IM GYR Yaw | Sensor 9IM MAG Pitch | Sensor 9IM MAG Roll | Sensor 9IM MAG Yaw | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time | |||||||||||||||||||||
0.000000 | -0.002441 | 0.001221 | 0.001831 | -0.001373 | 0.000153 | 0.004730 | -0.160675 | -0.284424 | -1.747894 | -2.335968 | ... | -0.000101 | 1.189453 | -3.801758 | 0.761230 | 239.817078 | 110.853661 | -47.134148 | 17.125525 | -145.024765 | -359.325287 |
0.002222 | -0.000000 | 0.000763 | -0.002899 | -0.006256 | -0.002136 | 0.002899 | -0.153503 | -0.305176 | -1.794128 | -2.371979 | ... | -0.000079 | 1.189453 | -3.801758 | 0.761230 | 239.817078 | 110.853661 | -47.134148 | 17.125525 | -145.024765 | -359.325287 |
0.004444 | -0.004730 | -0.003815 | 0.003967 | 0.004272 | -0.000153 | 0.009308 | -0.237579 | -0.264740 | -1.803741 | -2.336426 | ... | 0.000009 | 1.409999 | -4.366765 | 0.746142 | 253.246964 | 121.757927 | -38.114075 | 16.998919 | -144.840210 | -360.182739 |
0.006667 | 0.003662 | 0.002594 | -0.002136 | -0.005646 | -0.000763 | -0.003662 | -0.255737 | -0.204773 | -1.804047 | -2.355499 | ... | 0.000057 | 1.520271 | -4.649269 | 0.738598 | 259.961884 | 127.210060 | -33.604038 | 16.935616 | -144.747940 | -360.611450 |
0.008889 | -0.002747 | -0.002441 | 0.005341 | 0.004578 | 0.005646 | 0.007477 | -0.222321 | -0.244141 | -1.825104 | -2.377777 | ... | 0.000047 | 1.524902 | -4.661133 | 0.738281 | 260.243896 | 127.439026 | -33.414635 | 16.932957 | -144.744064 | -360.629456 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
29.928889 | 0.000610 | 0.001831 | 0.001068 | -0.003052 | 0.002594 | 0.000916 | 0.266876 | -0.237122 | -1.859894 | -2.814178 | ... | 0.000985 | -0.333984 | -3.725586 | 1.123047 | -50.365856 | 217.682938 | 33.475609 | 18.022522 | -130.952713 | -372.479218 |
29.931111 | -0.001068 | 0.000153 | -0.000610 | -0.003662 | -0.000000 | 0.004578 | 0.295715 | -0.170898 | -1.858826 | -2.845459 | ... | -0.000204 | 1.894513 | -5.409503 | 0.189099 | 158.874084 | 251.602448 | 66.935623 | 17.918554 | -131.036682 | -371.474365 |
29.933333 | 0.001984 | 0.004730 | -0.006714 | -0.007935 | -0.003510 | -0.004883 | 0.305481 | -0.218201 | -1.858368 | -2.812653 | ... | 0.000778 | 2.918945 | -6.183594 | -0.240234 | 255.060974 | 267.195129 | 82.317078 | 17.870762 | -131.075272 | -371.012421 |
29.935556 | -0.003204 | 0.001221 | 0.000763 | 0.000916 | 0.001068 | 0.003967 | 0.343933 | -0.170288 | -1.893311 | -2.860107 | ... | 0.000805 | 2.918945 | -6.183594 | -0.240234 | 255.060974 | 267.195129 | 82.317078 | 17.870762 | -131.075272 | -371.012421 |
29.937778 | -0.001221 | 0.003204 | -0.000458 | -0.002747 | 0.001678 | 0.001984 | 0.312500 | -0.135345 | -1.875458 | -2.801056 | ... | -0.001439 | 2.918945 | -6.183594 | -0.240234 | 255.060974 | 267.195129 | 82.317078 | 17.870762 | -131.075272 | -371.012421 |
13473 rows × 130 columns
pt
Marker | RACR | LACR | C7 | CLAV | ... | LMMAL | LCAL | LTOE | LMT5 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Coordinate | X | Y | Z | X | Y | Z | X | Y | Z | X | ... | Z | X | Y | Z | X | Y | Z | X | Y | Z |
XYZ | X1 | Y1 | Z1 | X2 | Y2 | Z2 | X3 | Y3 | Z3 | X4 | ... | Z51 | X52 | Y52 | Z52 | X53 | Y53 | Z53 | X54 | Y54 | Z54 |
Time | |||||||||||||||||||||
0.000000 | 2213.544434 | 1420.947998 | 1571.324829 | 2194.909180 | 1416.853516 | 1215.808472 | 2195.543457 | 1465.110840 | 1394.859375 | 2328.635498 | ... | NaN | 2138.386230 | 68.125816 | 1379.954468 | 2355.536621 | 58.527267 | 1366.957153 | 2319.052002 | 44.644505 | 1313.224976 |
0.006667 | 2212.271729 | 1419.337158 | 1570.394531 | 2197.858887 | 1413.389404 | 1214.322266 | 2195.075928 | 1462.475098 | 1393.838501 | 2329.151367 | ... | NaN | 2118.484619 | 68.607948 | 1379.212769 | 2335.351318 | 58.051247 | 1366.094116 | 2298.880127 | 44.152187 | 1312.532349 |
0.013333 | 2210.282471 | 1418.303955 | 1569.193481 | 2201.142578 | 1410.884766 | 1213.318604 | 2194.371338 | 1460.500854 | 1392.986816 | 2328.939941 | ... | NaN | 2098.407471 | 69.392067 | 1378.596313 | 2314.714111 | 57.271126 | 1365.204224 | 2278.539551 | 43.632252 | 1311.776001 |
0.020000 | 2207.747803 | 1417.928345 | 1568.012329 | 2204.202637 | 1409.422607 | 1212.401733 | 2193.368896 | 1459.449097 | 1392.110962 | 2327.990234 | ... | NaN | 2078.121338 | 70.368813 | 1378.016479 | 2294.337158 | 57.032829 | 1364.186890 | 2258.052002 | 43.281223 | 1311.087036 |
0.026667 | 2204.928955 | 1418.094360 | 1566.952759 | 2207.516357 | 1408.732910 | 1211.450562 | 2192.766113 | 1458.669678 | 1391.343506 | 2326.735352 | ... | NaN | 2057.793945 | 71.495544 | 1377.419800 | 2273.762207 | 56.897720 | 1363.448120 | 2237.523193 | 42.831345 | 1310.343018 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
29.906667 | 2409.503906 | 1409.329224 | 1616.354370 | 2437.631348 | 1428.756226 | 1253.974243 | 2395.374512 | 1458.581787 | 1432.489990 | 2531.663818 | ... | NaN | 2048.218018 | 541.099243 | 1422.988037 | 1951.526611 | 352.146423 | 1385.853271 | 1942.871216 | 400.749084 | 1342.777222 |
29.913333 | 2410.107178 | 1404.970459 | 1618.451416 | 2436.678223 | 1425.311279 | 1254.532104 | 2396.526611 | 1456.373657 | 1432.407837 | 2533.387451 | ... | NaN | 2061.593750 | 546.014771 | 1421.315430 | 1968.394287 | 354.885895 | 1387.186768 | 1960.520386 | 401.953033 | 1342.269287 |
29.920000 | 2411.272217 | 1401.923462 | 1618.552368 | 2435.437988 | 1422.631104 | 1255.395752 | 2397.616699 | 1454.628418 | 1432.525391 | 2533.692627 | ... | NaN | 2074.715820 | 549.933594 | 1419.789429 | 1985.499146 | 355.914154 | 1389.160400 | 1978.374634 | 401.322357 | 1342.066528 |
29.926667 | 2412.643066 | 1400.000366 | 1618.078979 | 2433.286133 | 1420.706665 | 1256.044922 | 2398.005615 | 1453.223389 | 1432.965454 | 2533.084961 | ... | NaN | 2087.037354 | 552.726379 | 1416.801147 | 2003.463379 | 355.632355 | 1391.797119 | 1996.600342 | 399.063965 | 1342.302002 |
29.933333 | 2413.520020 | 1398.615845 | 1617.448486 | 2430.549072 | 1419.565186 | 1256.604492 | 2397.479736 | 1452.064697 | 1433.602539 | 2532.042480 | ... | NaN | 2098.605225 | 554.406067 | 1413.652832 | 2021.544800 | 354.294006 | 1394.230713 | 2014.322510 | 395.487213 | 1343.530518 |
4491 rows × 162 columns