gaitmap.zupt_detection.ShoeZuptDetector#

class gaitmap.zupt_detection.ShoeZuptDetector(*, acc_noise_variance: float = 3.5e-09, gyr_noise_variance: float = 1.3e-07, window_length_s: float = 0.15, window_overlap: float | None = 0.5, window_overlap_samples: int | None = None, inactive_signal_threshold: float = 2310129700)[source]#

Detect ZUPTSs using the SHOE algorithm.

This is based on the papers [1] and [2] and uses as weighted sum of the gravity corrected acc and the gyro norm to detect the static moments.

Note

The threshold is heavily dependent on the provided noise levels of the sensors. These values should theoretically be provided in the datasheet of the sensors, but most of the times, it makes sense to grid search the value, as the effective noise level might vary quite a bit. Note, that primarily the relation between the acc and the gyro noise is relevant, as it defines the weighting of the two signals in the ZUPT detection. Default values likely need to be adapted to your specific use case.

Parameters:
acc_noise_variance

The variance of the noise of the accelerometer.

gyr_noise_variance

The variance of the noise of the gyroscope.

inactive_signal_threshold

Threshold to decide whether a window should be considered as active or inactive. This value heavily depends on the noise levels selected for the other parameters.

window_length_sint

Length of desired window in seconds. The real window length is calculated as window_length_samples = round(sampling_rate_hz * window_length_s)

window_overlapfloat

The overlap between two neighboring windows as a fraction of the window length. Must be 0 <= window_overlap < 1. Note that the window length is first converted into samples, before the effective overlap is calculated. The overlap in samples is calculated as overlap_samples = round(window_length_samples * window_overlap).

When window_overlap is specified, window_overlap_samples must be None.

window_overlap_samplesint

The overlap between two neighboring windows in samples. This can be used as alternative to window_overlap, when you want to set the overlap independent of the sampling rate. The values can be negative. In this case, it will be interpreted as len(window_length_samples) - window_overlap_samples. This can be helpful if you want to set the overlap to the maximum possible value. Then set window_overlap_samples to -1.

When window_overlap_samples is specified, window_overlap must be None.

window_overlapfloat

The overlap between two neighboring windows as a fraction of the window length. Must be 0 <= window_overlap < 1. Note that the window length is first converted into samples, before the effective overlap is calculated. The overlap in samples is calculated as overlap_samples = round(window_length_samples * window_overlap)

Other Parameters:
data

The data passed to the detect method

sampling_rate_hz

The sampling rate of this data

Attributes:
zupts_

Get the start and end values of all zupts.

per_sample_zupts_

A bool array with length len(data). If the value is True for a sample, it is part of a static region.

window_length_samples_

The internally calculated window length in samples. This might be helpful for debugging

window_overlap_samples_

The internally calculated window overlap in samples. This might be helpful for debugging.

min_vel_index_

The index of the sample with the minimum velocity. This is calculated as the center of the window with the minimum velocity.

min_vel_value_

The minimum velocity value. This is calculated as the value of the window with the minimum velocity. If no window is below the threshold, this value is np.nan. Note, that in this case, min_vel_index is still set to a proper value.

Notes

The default parameters for the noise levels and thresholds are derived based on [2] and a non-exhaustive gridsearch based on level walking data of healthy participants. It is likely that these parameters can be further optimized for a given usecase.

References

[1]

I. Skog, J.-O. Nilsson, P. Händel, and J. Rantakokko, “Zero-velocity detection—An algorithm evaluation,” IEEE Trans. Biomed. Eng., vol. 57, no. 11, pp. 2657-2666, Nov. 2010.

[2] (1,2)

Wagstaff, Peretroukhin, and Kelly, “Robust Data-Driven Zero-Velocity Detection for Foot-Mounted Inertial Navigation.”

Methods

clone()

Create a new instance of the class with all parameters copied over.

detect(data, *, sampling_rate_hz, **_)

Detect all ZUPT regions in the data.

from_json(json_str)

Import an gaitmap object from its json representation.

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

to_json()

Export the current object parameters as json.

__init__(*, acc_noise_variance: float = 3.5e-09, gyr_noise_variance: float = 1.3e-07, window_length_s: float = 0.15, window_overlap: float | None = 0.5, window_overlap_samples: int | None = None, inactive_signal_threshold: float = 2310129700) None[source]#
clone() Self[source]#

Create a new instance of the class with all parameters copied over.

This will create a new instance of the class itself and all nested objects

detect(data: DataFrame, *, sampling_rate_hz: float, **_) Self[source]#

Detect all ZUPT regions in the data.

Parameters:
data

The data set holding the imu raw data

sampling_rate_hz

The sampling rate of the data

Returns:
self

The class instance with all result attributes populated

classmethod from_json(json_str: str) Self[source]#

Import an gaitmap object from its json representation.

For details have a look at the this example.

You can use the to_json method of a class to export it as a compatible json string.

Parameters:
json_str

json formatted string

get_params(deep: bool = True) dict[str, Any][source]#

Get parameters for this algorithm.

Parameters:
deep

Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like nested_object_name__ (Note the two “_” at the end)

Returns:
params

Parameter names mapped to their values.

set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.

to_json() str[source]#

Export the current object parameters as json.

For details have a look at the this example.

You can use the from_json method of any gaitmap algorithm to load the object again.

Warning

This will only export the Parameters of the instance, but not any results!

Examples using gaitmap.zupt_detection.ShoeZuptDetector#

ZUPT Dependency of the Trajectory Estimation

ZUPT Dependency of the Trajectory Estimation

ZUPT Dependency of the Trajectory Estimation