vitabel.analysis.intervals

Operations on time series based on interval labels.

Functions

filter_by_intervallabel(...)

Filters a channel or label by a given interval label.

Module Contents

vitabel.analysis.intervals.filter_by_intervallabel(channel_or_label_to_filter: vitabel.timeseries.Channel | vitabel.timeseries.Label, filter_by: vitabel.timeseries.IntervalLabel, invert: bool = False, start_inclusive: bool = True, end_inclusive: bool = True, full_cover: bool = False) → vitabel.timeseries.Channel | vitabel.timeseries.Label

Filters a channel or label by a given interval label.

This creates a new channel or label containing only the data points that fall within the intervals specified in the given interval label.

Parameters:
channel_or_label_to_filter

The channel or label to filter.

filter_by

The interval label to filter by.

invert

If True, inverts the filter, i.e., keeps the parts outside the intervals defined by filter_by.

start_inclusive

If True, the start of the intervals in filter_by is considered inclusive for filtering. If invert is True, this parameter becomes inverted too.

end_inclusive

If True, the end of the intervals in filter_by is considered inclusive for filtering. If invert is True, this parameter becomes inverted too.

full_cover

Only relevant for interval Labels: - If True, keep label intervals only if they are fully contained in at least one filter interval. - If False, keep label intervals if they overlap at all with any filter interval.

Returns:
Channel | Label

The filtered channel or label.