IntervalDurationCriteria#

class mobgap.wba.IntervalDurationCriteria(
min_duration_s: float | None = None,
max_duration_s: float | None = None,
*,
inclusive: tuple[bool, bool] = (False, True),
)[source]#

Checks the duration of the stride by subtracting the start and the end value.

Note that this is different from the IntervalParameterCriteria as it does not check a single parameter but calculates the duration from the start and end values. In many cases, your interval will have an additional duration column that has been calculated beforehand. In such cases, you can decide to use the IntervalParameterCriteria instead.

Parameters:
lower_threshold

The lower threshold for the parameter. If None, the lower threshold is not checked.

upper_threshold

The upper threshold for the parameter. If None, the upper threshold is not checked.

inclusive

A tuple of two booleans indicating if the lower and upper threshold should be inclusive in the comparison. By default, the lower threshold is exclusive and the upper threshold is inclusive.

Methods

check(interval, *[, sampling_rate_hz])

Check if the interval meets the criteria.

check_multiple(intervals, *[, sampling_rate_hz])

Check if the intervals meet the criteria.

clone()

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

get_params([deep])

Get parameters for this algorithm.

requires_columns()

Return a list of columns that are required in the intervals to check.

set_params(**params)

Set the parameters of this Algorithm.

__init__(
min_duration_s: float | None = None,
max_duration_s: float | None = None,
*,
inclusive: tuple[bool, bool] = (False, True),
) None[source]#
check(
interval: Series,
*,
sampling_rate_hz: float | None = None,
) bool[source]#

Check if the interval meets the criteria.

Parameters:
intervalpd.Series

The interval to check. The interval must at least have a start and end column that contain the start and end of the interval in samples. Additional columns might be used to check the values of further parameters.

sampling_rate_hz

The sampling rate of the data in Hz. This is used to potentially convert the start and end values 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.

check_multiple(
intervals: DataFrame,
*,
sampling_rate_hz: float | None = None,
) Series[source]#

Check if the intervals meet the criteria.

Parameters:
intervalspd.DataFrame

The intervals to check. The intervals must at least have a start and end column that contain the start and end of the interval in samples. Additional columns might be used to check the values of further parameters.

sampling_rate_hz

The sampling rate of the data in Hz. This is used to potentially convert the start and end values 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:
pd.Series

A boolean series indicating if the intervals meet the criteria.

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

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.

requires_columns() list[str][source]#

Return a list of columns that are required in the intervals to check.

Returns:
list[str]

A list of column names that are required in the intervals to check.

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.IntervalDurationCriteria#

Assembling WBs

Assembling WBs