gaitmap.event_detection.FilteredRamppEventDetection#
- class gaitmap.event_detection.FilteredRamppEventDetection(ic_search_region_ms: tuple[float, float] = (80, 50), min_vel_search_win_size_ms: float = 100, ic_lowpass_filter: BaseFilter = cf(ButterworthFilter(cutoff_freq_hz=15, filter_type='lowpass', order=2)), memory: Memory | None = None, enforce_consistency: bool = True, detect_only: tuple[str, ...] | None = None)[source]#
Detect gait events using RamppEventDetection with an additional low-pass filter for ic calculation.
Note
This algorithm is only available via the
gaitmap_madpackage and distributed under a AGPL3 licence. To use it, you need to explicitly install thegaitmap_madpackage. Learn more about that here.Rampp event detection with an additional low-pass Butterworth filter. This method is suggested to be used on data containing high frequency noise or artifacts which occur around the ic part of the strides. The tc and min velocity are calculated from the original signal.
- Parameters:
- ic_search_region_ms
The region to look for the initial contact in the acc_pa signal in ms given an ic candidate. According to [1], for the ic the algorithm first looks for a local minimum in the gyr_ml signal after the swing phase. The actual ic is then determined in the acc_pa signal in the ic_search_region_ms around that gyr_ml minimum. ic_search_region_ms[0] describes the start and ic_search_region_ms[1] the end of the region to check around the gyr_ml minimum. The values of
ic_search_region_msmust be greater or equal than the sample time (1/sampling_rate_hz).- min_vel_search_win_size_ms
The size of the sliding window for finding the minimum gyroscope energy in ms.
- ic_lowpass_filter
An instance of a Filter-transform (e.g.
ButterworthFilter) that will be applied to the gyr_ml data before the IC is detected. While not enforced, this should be a lowpass filter to ensure that the results are as expected.- memory
An optional
joblib.Memoryobject that can be provided to cache the detection of all events.- enforce_consistency
An optional bool that can be set to False if you wish to disable postprocessing (see Notes section for more information).
- detect_only
An optional tuple of strings that can be used to only detect a subset of events. By default, all events (“ic”, “tc”, “min_vel”) are detected. If
min_velis not detected, themin_vel_event_list_output will not be available. If “ic” is not detected, thepre_icwill also not be available in the output.
- Other Parameters:
- data
The data passed to the
detectmethod.- sampling_rate_hz
The sampling rate of the data
- stride_list
A list of strides provided by a stride segmentation method. The stride list is expected to have no gaps between subsequent strides. That means for subsequent strides the end sample of one stride should be the start sample of the next stride.
- Attributes:
- min_vel_event_list_A stride list or dictionary with such values
The result of the
detectmethod holding all temporal gait events and start / end of all strides. The stride borders for the stride_events are aligned with the min_vel samples. Hence, the start sample of each stride corresponds to the min_vel sample of that stride and the end sample corresponds to the min_vel sample of the subsequent stride. Strides for which no valid events could be found are removed. Additional strides might have been removed due to the conversion from segmented to min_vel strides. The ‘s_id’ index is selected according to which segmented stride the pre-ic belongs to.- segmented_event_list_A stride list or dictionary with such values
The result of the
detectmethod holding all temporal gait events and start / end of all strides. This version of the results has the same stride borders than the inputstride_listand has additional columns for all the detected events. Strides for which no valid events could be found are removed.
Notes
Due to attachment methods used for foot-worn IMUs, the sensor might experience bounce and vibrate at the time of the heel strike (IC) which leads to high frequency artifacts in the gyr_ml signal. This can lead to an inaccurate IC detection, as it relies on the identification of extrema in the signal. To resolve this issue, this event detection method applies a low-pass filter to remove high frequency artifacts. Note, that the lowpass filter is only used for the IC detection and not the detection of other events. Other than that, the implementation is identical to the normal Rampp event detection (
RamppEventDetection).[1]Rampp, A., Barth, J., Schülein, S., Gaßmann, K. G., Klucken, J., & Eskofier, B. M. (2014). Inertial sensor-based stride parameter calculation from gait sequences in geriatric patients. IEEE transactions on biomedical engineering, 62(4), 1089-1097.. https://doi.org/10.1109/TBME.2014.2368211
Methods
clone()Create a new instance of the class with all parameters copied over.
detect(data, stride_list, *, sampling_rate_hz)Find gait events in data within strides provided by stride_list.
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__(ic_search_region_ms: tuple[float, float] = (80, 50), min_vel_search_win_size_ms: float = 100, ic_lowpass_filter: BaseFilter = cf(ButterworthFilter(cutoff_freq_hz=15, filter_type='lowpass', order=2)), memory: Memory | None = None, enforce_consistency: bool = True, detect_only: tuple[str, ...] | None = None) 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 | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame], stride_list: DataFrame | dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame], *, sampling_rate_hz: float) Self[source]#
Find gait events in data within strides provided by stride_list.
- Parameters:
- data
The data set holding the imu raw data
- stride_list
A list of strides provided by a stride segmentation method
- 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_jsonmethod 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.