StrideSelection#

class mobgap.wba.StrideSelection(
rules: list[tuple[str, BaseIntervalCriteria]] | None = cf([('stride_duration_thres', IntervalDurationCriteria(inclusive=(False, True), max_duration_s=3.0, min_duration_s=0.2)), ('stride_length_thres', IntervalParameterCriteria(inclusive=(False, True), lower_threshold=0.15, parameter='stride_length_m', upper_threshold=None))]),
*,
incompatible_rules: Literal['raise', 'warn', 'skip'] = cf('warn'),
)[source]#

Selects strides based on a set of criteria.

This can be used to filter out valid strides from a list of strides provided by a gait pipeline.

Parameters:
rules

The rules that are used to filter the strides. They need to be provided as a list of tuples, where the first element is the name of the rule and the second is an instance of a subclass of mobgap.wba.BaseIntervalCriteria. If None, no rules are applied and all strides are considered valid.

incompatible_rules

What to do, if an incompatible rule is provided. This will be checked, by the required_columns method of the rule. If not all required columns exist in the provided stride list, the rule is considered incompatible. Depending on this parameter, the algorithm will either raise a ValueError, issue skip the rule and issue a warning or skip the rule silently. Default is “warn”.

Other Parameters:
stride_list

The stride list provided to the filter method.

sampling_rate_hz

The sampling rate provided to the filter method.

Attributes:
filtered_stride_list_

A dataframe containing all strides that are considered valid. This is a strict subset of the stride list that was provided to the filter method.

excluded_stride_list_

A dataframe containing all strides that are considered invalid. This is a strict subset of the stride list that was provided to the filter method.

exclusion_reasons_

A dataframe containing the reason why a stride was excluded. The dataframe has two columns: rule_name and rule_obj corresponding to the values in the rules parameter. The rule always corresponds to the first rule that failed. To see the results of all rules, use the check_results_ attribute. The df only contains rows for strides that were excluded.

check_results_

A dataframe containing the results of the checks for each rule. The dataframe has one column for each rule and one row for each stride in the stride list. The values are boolean and indicate if the stride meets the criteria of the rule.

Methods

clone()

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

filter(stride_list, *, sampling_rate_hz)

Filter the stride list.

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

PredefinedParameters

__init__(
rules: list[tuple[str, BaseIntervalCriteria]] | None = cf([('stride_duration_thres', IntervalDurationCriteria(inclusive=(False, True), max_duration_s=3.0, min_duration_s=0.2)), ('stride_length_thres', IntervalParameterCriteria(inclusive=(False, True), lower_threshold=0.15, parameter='stride_length_m', upper_threshold=None))]),
*,
incompatible_rules: Literal['raise', 'warn', 'skip'] = cf('warn'),
) 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

filter(
stride_list: DataFrame,
*,
sampling_rate_hz: float,
) Self[source]#

Filter the stride list.

Parameters:
stride_list

The stride list to filter. The stride list must be a dataframe, where each row represents a stride. The index should be a unique identifier for each stride. The dataframe must at least have a start and end column. We assume that the start and end values are in samples and can be converted to seconds using the sampling_rate_hz parameter. Additional required columns depend on the rules that are used for filtering.

sampling_rate_hz

The sampling rate of the data in Hz. This is used to potentially convert the start and end values of a stride to seconds, assuming that they are in samples. If this is not the case and the value are already in seconds, sampling_rate_hz should set to 1.

Returns:
self

The instance itself with the result parameters set.

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=.

Examples using mobgap.wba.StrideSelection#

The Mobilise-D pipeline: Step-by-Step Breakdown

The Mobilise-D pipeline: Step-by-Step Breakdown

Assembling WBs

Assembling WBs