gaitmap.utils.static_moment_detection.find_static_sequences#

gaitmap.utils.static_moment_detection.find_static_sequences(signal: ndarray, window_length: int, inactive_signal_th: float, metric: typing_extensions.Literal[maximum, variance, mean, median, squared_mean] = 'mean', overlap: int | None = None) ndarray[source]#

Search for static sequences within given input signal, based on windowed L2-norm thresholding.

Warning

Due to edge cases at the end of the input data where window size and overlap might not fit your data, the last window might be discarded for analysis and will therefore always be considered as non-static!

Parameters:
signalarray with shape (n, 3)

3D signal on which static moment detection should be performed (e.g. 3D-acc or 3D-gyr data)

window_lengthint

Length of desired window in units of samples

inactive_signal_thfloat

Threshold to decide whether a window should be considered as active or inactive. Window will be tested on <= threshold

metricstr, optional

Metric which will be calculated per window, one of the following strings

‘mean’ (default)

Calculates mean value per window

‘maximum’

Calculates maximum value per window

‘median’

Calculates median value per window

‘variance’

Calculates variance value per window

overlapint, optional

Length of desired overlap in units of samples. If None (default) overlap will be window_length - 1

Returns:
Array of [start, end] labels indication static regions within the input signal

See also

gaitmap.utils.array_handling.sliding_window_view

Details on the used windowing function for this method.

Examples

>>> gyro_data = load_gyro_data(path)
>>> static_regions = get_static_moment_labels(gyro_data, window_length=128, overlap=64, inactive_signal_th=5)