sho-87/sensormotion

sm.gait.step_regularity IndexError

Closed this issue · 1 comments

step_reg, stride_reg = sm.gait.step_regularity(ac_peak_values)
File ".../python3.6/site-packages/sensormotion-1.1.0-py3.6.egg/sensormotion/gait.py", line 128, in step_regularity
ac_d2 = peaks_half[2] # second dominant period i.e. a stride (left-left)
sm.gait.step_regularity IndexError: index 2 is out of bounds for axis 0 with size 2

@jiakang the calculation of regularity (specifically stride regularity) requires at least 2 steps, which in the autocorrelation corresponds to at least 3 peaks: one at lag 0 (which should always exist), one corresponding to the step, and one corresponding to a stride

after you calculate the autocorrelation (or run peak detection on the autocorrelation), how many peaks does it have? you should be able to see from plotting the ac signal. the error is saying that the signal doesn't have enough identified peaks

are you testing this on actual gait data, or just some test data? vertical gait acceleration should be periodic enough that you should have enough peaks in the ac signal