SOSFrequencyFilter#
- class myoverse.datasets.filters.temporal.SOSFrequencyFilter(input_is_chunked, is_output=False, name=None, run_checks=True, *, sos_filter_coefficients, forwards_and_backwards=True, continuous_approach=None, real_time_support_chunks=None)[source]#
Filter that applies a second-order-section filter to the input array.
- Parameters:
input_is_chunked (bool) – Whether the input is chunked or not.
is_output (bool) – Whether the filter is an output filter. If True, the resulting signal will be outputted by and dataset pipeline.
name (str | None) – Name of the filter, by default None.
run_checks (bool) –
Whether to run the checks when filtering. By default, True. If False can potentially speed up performance.
Warning
If False, the user is responsible for ensuring that the input array is valid.
sos_filter_coefficients (tuple[np.ndarray, np.ndarray | float, np.ndarray]) – The second-order-section filter coefficients, typically from scipy.signal.butter with output=”sos”.
forwards_and_backwards (bool) – Whether to apply the filter forwards and backwards or only forwards.
continuous_approach (tuple[int, int] | None) –
If input_is_chunked is True and a tuple of window size and shift is provided, the filter will first unchunk the data, filter, then re-chunk the data.
Warning
Some data will be lost at the end of the signal if the window shift is not equal to the window size.
real_time_support_chunks (np.ndarray | None) – If not None and continuous_approach is not None, the support chunks will be prepended to the input array. That way boundary
- __call__(input_array: np.ndarray) np.ndarray #
Filters the input array. Input shape is determined by whether the allowed_input_type is “both”, “chunked” or “not chunked”.
- reset_state()#
Resets the internal filter state. Only relevant when real_time_mode=True.
Methods