IntervalDurationCriteria#
- class mobgap.wba.IntervalDurationCriteria(
- min_duration_s: float | None = None,
- max_duration_s: float | None = None,
- *,
- inclusive: tuple[bool, bool] = (False, True),
Checks the duration of the stride by subtracting the start and the end value.
Note that this is different from the
IntervalParameterCriteriaas it does not check a single parameter but calculates the duration from thestartandendvalues. In many cases, your interval will have an additionaldurationcolumn that has been calculated beforehand. In such cases, you can decide to use theIntervalParameterCriteriainstead.- 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.
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),
- check( ) bool[source]#
Check if the interval meets the criteria.
- Parameters:
- intervalpd.Series
The interval to check. The interval must at least have a
startandendcolumn 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
startandendvalues 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.
- check_multiple( ) Series[source]#
Check if the intervals meet the criteria.
- Parameters:
- intervalspd.DataFrame
The intervals to check. The intervals must at least have a
startandendcolumn 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
startandendvalues 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:
- 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.