Marcos Duarte
Laboratory of Biomechanics and Motor Control
Federal University of ABC, Brazil
import numpy as np
import pandas as pd
%matplotlib notebook
# tk qt notebook inline ipympl
import matplotlib
import matplotlib.pyplot as plt
import sys, os
sys.path.insert(1, r'./../functions')
%load_ext autoreload
%autoreload 2
from io_cortexmac import read_delsys
freq_trc = 150 # Cortex sampling rate
muscles = ['TA', 'Sol', 'VL', 'BF', 'GMax', 'GL', 'RF', 'GMed', 'VM']
path2 = '/mnt/A/BMClab/Projects/FapespRunAge/Data/Cadence/s20/'
fname = 'run100s.csv'
fname = os.path.join(path2, fname)
df_emg, df_imu = read_delsys(fname, fname2='=', sensors=muscles, freq_trc=150, emg=True, imu=True,
resample=[150, 150], show_msg=True, show=True, suptitle=fname)
Opening file "/mnt/A/BMClab/Projects/FapespRunAge/Data/Cadence/s20/run100s.csv" ... done. Saving file "/mnt/A/BMClab/Projects/FapespRunAge/Data/Cadence/s20/run100s.emg" ... Saving file "/mnt/A/BMClab/Projects/FapespRunAge/Data/Cadence/s20/run100s.imu" ... done.
df_emg
TA | Sol | VL | BF | GMax | GL | RF | GMed | VM | |
---|---|---|---|---|---|---|---|---|---|
Time | |||||||||
0.000000 | 0.007029 | 0.006594 | 0.004291 | 0.019979 | 0.001023 | 0.000115 | 0.001364 | 0.006995 | 0.012894 |
0.006667 | 0.017886 | 0.015504 | 0.009065 | 0.039202 | 0.002080 | 0.000222 | 0.002835 | 0.014085 | 0.026085 |
0.013333 | 0.017084 | 0.015021 | 0.008657 | 0.037148 | 0.001975 | 0.000212 | 0.002892 | 0.013995 | 0.048973 |
0.020000 | 0.025477 | 0.016714 | 0.011098 | 0.042947 | 0.002208 | 0.000276 | 0.003207 | 0.015144 | 0.080798 |
0.026667 | 0.027587 | 0.016324 | 0.011031 | 0.042059 | 0.002324 | 0.000256 | 0.003414 | 0.014969 | 0.087736 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
29.946667 | 0.070643 | 0.337400 | 0.105687 | 0.025723 | 0.043704 | 0.001281 | 0.044262 | 0.150382 | 1.326730 |
29.953333 | 0.074686 | 0.306654 | 0.106799 | 0.022041 | 0.044794 | 0.001114 | 0.044378 | 0.145094 | 1.234395 |
29.960000 | 0.060467 | 0.249718 | 0.093027 | 0.013716 | 0.042580 | 0.000937 | 0.038819 | 0.137253 | 1.125383 |
29.966667 | 0.055182 | 0.250829 | 0.076784 | 0.010169 | 0.044326 | 0.000701 | 0.033299 | 0.089877 | 1.186043 |
29.973333 | 0.025094 | 0.103625 | 0.031833 | 0.004877 | 0.013978 | 0.000241 | 0.013248 | 0.024222 | 0.495989 |
4497 rows × 9 columns
df_imu
TA IM ACC Pitch | TA IM ACC Roll | TA IM ACC Yaw | TA IM GYR Pitch | TA IM GYR Roll | TA IM GYR Yaw | TA IM MAG Pitch | TA IM MAG Roll | TA IM MAG Yaw | Sol IM ACC Pitch | ... | GMed IM MAG Yaw | VM IM ACC Pitch | VM IM ACC Roll | VM IM ACC Yaw | VM IM GYR Pitch | VM IM GYR Roll | VM IM GYR Yaw | VM IM MAG Pitch | VM IM MAG Roll | VM IM MAG Yaw | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Time | |||||||||||||||||||||
0.000000 | 1.461924 | 0.054725 | -1.220061 | 332.541443 | -0.305084 | 393.802277 | 153.198425 | -93.232719 | -140.406525 | -3.092418 | ... | -100.159142 | -1.307523 | -0.878033 | -0.970382 | -186.955399 | 109.036980 | -38.867687 | 13.935328 | -128.196564 | -379.281097 |
0.006667 | 1.206918 | -0.580939 | -1.055024 | 317.020447 | 6.356417 | 376.144806 | 154.889496 | -94.512703 | -142.536484 | -3.524715 | ... | -100.225967 | -0.786845 | -0.687781 | -0.411544 | -261.242249 | 123.340370 | -16.872202 | 14.170884 | -128.877518 | -379.898071 |
0.013333 | 1.254572 | -0.929420 | -0.892858 | 293.616821 | 25.956482 | 338.785217 | 154.434433 | -94.714867 | -143.238785 | -3.617497 | ... | -99.351959 | 0.015441 | -0.560639 | 0.490481 | -193.679840 | 80.191986 | 39.518909 | 14.068916 | -128.381226 | -376.153442 |
0.020000 | 1.295480 | -1.040251 | -0.754853 | 276.118744 | 26.507492 | 306.563416 | 156.412994 | -96.575020 | -145.354950 | -3.532538 | ... | -99.758972 | 0.813057 | -0.650732 | 0.985687 | -36.635735 | 17.316431 | 74.768578 | 14.443660 | -129.880676 | -378.628845 |
0.026667 | 0.720512 | -1.038927 | -0.815304 | 258.242981 | 11.812378 | 270.558746 | 155.565628 | -96.788765 | -143.896317 | -2.934765 | ... | -97.856499 | 1.212349 | -0.795189 | 0.612395 | -6.388461 | -62.259018 | 57.945923 | 14.935710 | -128.734497 | -374.054565 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
29.946667 | 6.703976 | 0.445667 | -4.139219 | -270.413361 | -47.437138 | -268.662994 | 152.623108 | -101.347496 | -147.524078 | -1.395813 | ... | -97.832497 | -3.226587 | 4.142353 | -5.151693 | -125.047264 | 225.588974 | -38.197094 | 13.122366 | -127.026657 | -372.528320 |
29.953333 | 2.637491 | 0.850779 | -1.344797 | -261.812836 | -165.894760 | -224.713684 | 150.876724 | -99.626503 | -144.750290 | -0.624715 | ... | -97.712196 | -2.899570 | 2.789130 | -4.677643 | -147.121429 | 208.933853 | -1.363779 | 13.491474 | -127.160400 | -368.826569 |
29.960000 | 0.467987 | 1.139431 | -2.419861 | -199.883545 | 31.710869 | -123.376144 | 151.648697 | -99.329712 | -144.617905 | -2.538196 | ... | -100.098679 | -1.761733 | 0.788060 | -4.187121 | -244.747864 | 68.450127 | 17.060461 | 13.958459 | -130.325455 | -370.974426 |
29.966667 | 1.178041 | -0.060100 | -2.848602 | -224.175644 | 86.155693 | -67.423538 | 150.504471 | -97.854019 | -143.243225 | -1.446289 | ... | -99.830841 | -0.881454 | -2.445498 | -2.791923 | -197.206223 | -104.399704 | -14.399959 | 13.710456 | -130.421295 | -369.229919 |
29.973333 | 0.014567 | -0.003157 | -0.019136 | -2.363307 | 0.406399 | -0.576367 | 1.448279 | -0.939822 | -1.378258 | -0.009453 | ... | -0.959878 | -0.005267 | -0.032889 | -0.022074 | -1.444339 | -1.538728 | -0.105037 | 0.130882 | -1.255806 | -3.557163 |
4497 rows × 81 columns
print('Sampling rates for EMG and IMU data:')
print(np.mean(1/np.diff(df_emg.index)), np.mean(1/np.diff(df_imu.index)))
Sampling rates for EMG and IMU data: 150.00000000000006 150.00000000000006