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'),
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. IfNone, 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_columnsmethod 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:
- 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
filtermethod.- 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
filtermethod.- exclusion_reasons_
A dataframe containing the reason why a stride was excluded. The dataframe has two columns:
rule_nameandrule_objcorresponding to the values in therulesparameter. The rule always corresponds to the first rule that failed. To see the results of all rules, use thecheck_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'),
- 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( ) 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
startandendcolumn. We assume that thestartandendvalues are in samples and can be converted to seconds using thesampling_rate_hzparameter. 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
startandendvalues 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_hzshould 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.