Butterworth
- class gpype.backend.filters.base.butterworth.Butterworth[source]
Bases:
IONodeButterworth filter implementation for real-time signal processing.
Implements a Butterworth digital filter using second-order sections for numerical stability. Supports lowpass, highpass, bandpass, and bandstop filtering with configurable order and maintains state for streaming data.
- DEFAULT_ORDER = 2
Default filter order for Butterworth filters
- class Configuration[source]
Bases:
ConfigurationConfiguration class for Butterworth filter parameters.
- __init__(fn, btype, order=None, **kwargs)[source]
Initialize the Butterworth filter with specified parameters.
- Parameters:
fn (
list) – List of cutoff frequencies in Hz. Single value for lowpass/ highpass, two values [low, high] for bandpass/bandstop.btype (
str) – Filter type (‘lowpass’, ‘highpass’, ‘bandpass’, ‘bandstop’).order (
int) – Filter order. Defaults to 2 if not specified.**kwargs – Additional arguments passed to parent IONode class.
- Raises:
ValueError – If fn is not a list, btype is invalid, or order <= 0.
- setup(data, port_context_in)[source]
Setup the Butterworth filter before processing begins.
Initializes filter coefficients and state based on sampling rate and channel configuration from input context.
- Parameters:
- Return type:
- Returns:
Output port context dictionary with updated metadata.
- Raises:
ValueError – If required context keys are missing.