skdh.gait.substeps.VerticalCwtGaitEvents#

class skdh.gait.substeps.VerticalCwtGaitEvents(use_cwt_scale_relation=True, wavelet_scale='default', round_scale=False)#

Predict initial and final contact events using a Continuous Wavelet Transform on the vertical acceleration.

Parameters:
use_cwt_scale_relationbool, optional

Use the optimal scale/frequency relationship (see Notes). This changes which scale is used for the smoothing/differentiation operation performed with the continuous wavelet transform. Default is True. See Notes for a caveat of the relationship.

wavelet_scale{“default”, float, int}, optional

The wavelet scale to use. If use_cwt_scale_relation=True, then this is only used initially to determine the optimal scale. If False, then is used as the scale for the initial and final contact event detection. “default” corresponds to the default scale from [1], scaled for the sampling frequency. If a float, this is the value in Hz that the desired wavelet decomposition happens. For reference, [1] used a frequency of 1.25Hz. If an integer, uses that value as the scale.

round_scalebool, optional

Round the CWT scales to integers. Default is False.

Methods

convert_timestamps(t)

Convert a timestamp/array of timestamps to a datetime object

get_cwt_scales(v_velocity, fs, mean_step_freq)

Get the CWT scales for the IC and FC events.

predict(time, accel, accel_filt, v_axis, ...)

save_results(results, file_name)

Save the results of the processing pipeline to a csv file

handle_wavelet_scale

Notes

The optimal scale/frequency relationship found in [2] was based on a cohort of only young women students. While it is recommended to use this relationship, the user should be aware of this shortfall in the generation of the relationship.

References

[1] (1,2)

J. McCamley, M. Donati, E. Grimpampi, and C. Mazzà, “An enhanced estimate of initial contact and final contact instants of time using lower trunk inertial sensor data,” Gait & Posture, vol. 36, no. 2, pp. 316–318, Jun. 2012, doi: 10.1016/j.gaitpost.2012.02.019.

[2]

C. Caramia, C. De Marchis, and M. Schmid, “Optimizing the Scale of a Wavelet-Based Method for the Detection of Gait Events from a Waist-Mounted Accelerometer under Different Walking Speeds,” Sensors, vol. 19, no. 8, p. 1869, Jan. 2019, doi: 10.3390/s19081869.

get_cwt_scales(v_velocity, fs, mean_step_freq)#

Get the CWT scales for the IC and FC events.

Parameters:
v_velocitynumpy.ndarray

Vertical velocity, in units of “g*sec”.

fsfloat

Sampling frequency, in Hz.

mean_step_freqfloat, None

Mean step frequency for this walking bout.

Returns:
scale1int

First scale for the CWT. For initial contact events.

scale2int

Second scale for the CWT. For final contact events.

predict(time, accel, accel_filt, v_axis, v_axis_sign, *, fs=None, mean_step_freq=None)#
Parameters:
time
accel
accel_filt
v_axis
v_axis_sign
fs
mean_step_freq
Returns:
resultsdict

Dictionary of the results, with the following items that can be used as inputs to downstream processing steps: - initial_contacts: detected initial contact events (heel-strikes). - final_contacts: detected final contact events (toe-offs).