diff --git a/sensormotion/gait.py b/sensormotion/gait.py index 123a111..d755f83 100644 --- a/sensormotion/gait.py +++ b/sensormotion/gait.py @@ -123,6 +123,11 @@ def step_regularity(autocorr_peak_values): """ peaks_half = autocorr_peak_values[autocorr_peak_values.size//2:] + + assert len(peaks_half) >= 3, \ + 'Not enough autocorrelation peaks detected. Plot the ' \ + 'autocorrelation signal to visually inspect peaks' + ac_lag0 = peaks_half[0] # autocorrelation value at lag 0 ac_d1 = peaks_half[1] # first dominant period i.e. a step (left-right) ac_d2 = peaks_half[2] # second dominant period i.e. a stride (left-left) @@ -171,6 +176,11 @@ def step_symmetry(autocorr_peak_values): """ peaks_half = autocorr_peak_values[autocorr_peak_values.size//2:] + + assert len(peaks_half) >= 3, \ + 'Not enough autocorrelation peaks detected. Plot the ' \ + 'autocorrelation signal to visually inspect peaks' + ac_d1 = peaks_half[1] # first dominant period i.e. a step (left-right) ac_d2 = peaks_half[2] # second dominant period i.e. a stride (left-left) diff --git a/sensormotion/version.py b/sensormotion/version.py index 7b344ec..7bb021e 100644 --- a/sensormotion/version.py +++ b/sensormotion/version.py @@ -1 +1 @@ -__version__ = '1.1.2' +__version__ = '1.1.3'