eurobench / rrd_pi_slope

Code related to the computation of Performance Metrics during a walking on slope experiments
0 stars 0 forks source link

subject_01 cond_05 run_01 fails #11

Closed alfonsotecnalia closed 2 years ago

alfonsotecnalia commented 3 years ago

get_gait_spatio_temporal_params is complaining

aremazeilles commented 3 years ago

I got also errors with more files provided by Erik. For instance:

run_pi_gait check_sub1_cond5_run1/subject_00_cond_5_run_000_gaitEvents.yaml out            130 ↵
Traceback (most recent call last):
  File "/home/anthony/code/eurobench/rrd/venv/bin/run_pi_gait", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/anthony/code/eurobench/rrd/src/pi_walk_slope/script/run_pi_gait", line 43, in <module>
    sys.exit(main(fn_gait, folder_out))
  File "/home/anthony/code/eurobench/rrd/src/pi_walk_slope/pi_walk_slope/gait_phases.py", line 128, in main
    params = get_gait_spatiotemporal_params(gait_events)
  File "/home/anthony/code/eurobench/rrd/src/pi_walk_slope/pi_walk_slope/gait_phases.py", line 47, in get_gait_spatiotemporal_params
    params[side+'_t_stance'] = [(to[i]-hc[i])/t_gc[i] for i in range(np.min([len(to),len(hc)]))]
  File "/home/anthony/code/eurobench/rrd/src/pi_walk_slope/pi_walk_slope/gait_phases.py", line 47, in <listcomp>
    params[side+'_t_stance'] = [(to[i]-hc[i])/t_gc[i] for i in range(np.min([len(to),len(hc)]))]
IndexError: list index out of range

Note that this is related to the files Erik transmitted to us through wetransfer, back in June

Rvs94 commented 3 years ago

I will take a look at it on Thursday!

aremazeilles commented 3 years ago

great! thanks

Rvs94 commented 3 years ago

Issue with gait_events length and number of gait cycles, should be fixed. Could you let me know whether the update to gait_phases.py worked?

alfonsotecnalia commented 3 years ago

Different error. Running :

docker run --rm -v $PWD/in:/in -v $PWD/out:/out eurobenchtest/rrd_pi_slope:v1.0.1 run_pi_walk_slope /in/subject_00_cond_5_run_001_gaitEvents.yaml /in/subject_00_cond_5_run_001_jointAngles.csv /in/subject_00_cond_5_run_001_emg.csv /out

I am getting the following output:

Left t_stance: -20.1 +/- 30.4%
Left t_swing: 120.1 +/- 30.4%
Right t_stance: 62.3 +/- 2.2%
Right t_swing: 37.7 +/- 2.2%
Left t_double_support1: 11.5 +/- 4.5%
Left t_double_support2: 10.4 +/- 3.2%
Left t_single_support: -41.9 +/- 37.3%
Right t_double_support1: 12.3 +/- 1.6%
Right t_double_support2: 12.7 +/- 3.0%
Right t_single_support: 37.5 +/- 3.0%
Cadence: 91.0 +/- 13.7 SPM
All data:
 {'l_t_gait_cycle': [2.469, 1.225, 1.233, 1.287], 'l_t_stance': [0.32523288780882953, -0.39020408163265285, -0.3884833738848338, -0.34887334887334875], 'l_t_swing': [0.6747671121911705, 1.3902040816326529, 1.3884833738848337, 1.3488733488733486], 'r_t_gait_cycle': [1.1789999999999998, 1.2580000000000002, 1.194, 1.2930000000000001, 1.255], 'r_t_stance': [0.6276505513146736, 0.5818759936406994, 0.6264656616415408, 0.6488785769528231, 0.6278884462151397], 'r_t_swing': [0.3723494486853264, 0.4181240063593006, 0.3735343383584592, 0.35112142304717686, 0.37211155378486027], 'l_t_double_support1': [0.04252733900364519, 0.12571428571428564, 0.16707218167072213, 0.12509712509712548], 'l_t_double_support2': [0.05670311867152694, 0.12163265306122469, 0.09326845093268432, 0.1429681429681431], 'l_t_single_support': [0.2260024301336574, -0.6375510204081632, -0.6488240064882402, -0.6169386169386173], 'r_t_double_support1': [0.11874469889737069, 0.11844197138314802, 0.09631490787269663, 0.14230471771075032, 0.1378486055776893], 'r_t_double_support2': [0.089058524173028, 0.12241653418123997, 0.17252931323283116, 0.12451662799690677], 'r_t_single_support': [0.4198473282442749, 0.3410174880763114, 0.3576214405360131, 0.382057231245166], 'cadence': array([ 90.49773756,  50.89058524,  95.6937799 ,  95.08716323,
       101.01010101, 100.        ,  94.78672986,  90.90909091,
        95.6937799 ,  95.54140127])}
Traceback (most recent call last):
  File "/usr/local/bin/run_pi_walk_slope", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/pi_runner/src/pi_walk_slope/script/run_pi_walk_slope", line 68, in <module>
    result2 = main_joint(fn_gait, fn_joint, folder_out)
  File "/home/pi_runner/src/pi_walk_slope/pi_walk_slope/joint_param.py", line 106, in main
    joint_params = get_joint_params(joint_data, gait_events)
  File "/home/pi_runner/src/pi_walk_slope/pi_walk_slope/joint_param.py", line 60, in get_joint_params
    joint_params[side+'_'+joint+'_max_stance'] = [angle[r].max() for r in stance_range]
  File "/home/pi_runner/src/pi_walk_slope/pi_walk_slope/joint_param.py", line 60, in <listcomp>
    joint_params[side+'_'+joint+'_max_stance'] = [angle[r].max() for r in stance_range]
  File "/usr/local/lib/python3.7/site-packages/numpy/core/_methods.py", line 40, in _amax
    return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity
Rvs94 commented 3 years ago

Hm, I checked the error and it has to do with that an initial contact in the data is missing. A check should be implemented to see whether the data is suitable. I will have to think about this.

aremazeilles commented 3 years ago

Hello @Rvs94

Could you progress on this?

Rvs94 commented 3 years ago

Sorry for my late reply. Easiest is just to discard the run as it is faulty, for example with a try/except statement? But it comes down to how dynamic everything should be. Does the script need to be flexible with faulty input data?

alfonsotecnalia commented 3 years ago

The causes of error should be described the best you can so anyone could know what is happening and how to solve the problem (if possible). Appart from an exit code, we recommend to write a human readable entry to the log of the docker image with the description of the error so this log can be shown to the caller.

Rvs94 commented 3 years ago

I think the problem is solved now by checking the order in which heelstrikes and toe-offs occur. Could you check this?

aremazeilles commented 2 years ago

@alfonsotecnalia I checked again https://github.com/eurobench/rrd_pi_slope/issues/11#issuecomment-914315330 and now it works. Do you want me to generate a new docker image to test it again?

alfonsotecnalia commented 2 years ago

yes, please

aremazeilles commented 2 years ago

v1.0.1 generated and uplaoded to docker. I did not update the other yaml file.