physioex.data.BandpassFilter#

class physioex.data.BandpassFilter(low=0.3, high=40.0, order=5, ftype='butter')[source]#

Bases: PreprocessingStep

IIR Butterworth bandpass filter (zero-phase via sosfiltfilt).

Uses second-order sections (SOS) representation for numerical stability. The ba-form (transfer function) is numerically unstable for long signals at high sampling rates with low normalized cutoffs (e.g., 0.3 Hz at 500 Hz → normalized = 0.0012), causing NaN output. SOS avoids this.

If the input sampling rate is too low for the filter band (high >= Nyquist), the filter is skipped with a warning.

Parameters:
__init__(low=0.3, high=40.0, order=5, ftype='butter')[source]#
Parameters:

Methods

__init__([low, high, order, ftype])

compile(fs_in[, header])

Precompute any expensive state and return a callable specialized for fs_in.

spec()

Return canonical, hashable text repr.

compile(fs_in, header=None)[source]#

Precompute any expensive state and return a callable specialized for fs_in.

header is an optional per-channel metadata dict (physical dimension, physical min/max, …) forwarded to steps that declare they need it (needs_header attribute, e.g. PhysicalScale). Steps that ignore it simply do not read it; the signature default keeps every existing compile(fs) call site working.

Parameters:
Return type:

CompiledStep

spec()[source]#

Return canonical, hashable text repr.

Format: ClassName(key1=val1,key2=val2,…) with sorted keys, floats normalized via f’{float(v):.10g}’.

Return type:

str