gastropy.apply_bandpass#
- gastropy.apply_bandpass(data, sfreq, low_hz, high_hz, method='fir', **kwargs)[source]#
Apply a zero-phase bandpass filter to a signal.
Supports FIR (default) and IIR (Butterworth) implementations. FIR uses
filtfiltwith Gustafsson’s method for robust edge handling on long kernels.- Parameters:
data (array_like) – Input signal (1D array).
sfreq (float) – Sampling frequency in Hz.
low_hz (float) – Lower passband edge in Hz.
high_hz (float) – Upper passband edge in Hz.
method (str, optional) – Filter method:
"fir"(default) or"iir".**kwargs – Additional arguments passed to
design_fir_bandpasswhenmethod="fir"(e.g.,f_order,transition_width,window).
- Returns:
filtered (np.ndarray) – Filtered signal (same length as input).
info (dict) – Filter metadata (method, number of taps, window, etc.).
Examples
>>> import numpy as np >>> from gastropy.signal import apply_bandpass >>> t = np.arange(0, 300, 0.1) >>> sig = np.sin(2 * np.pi * 0.05 * t) + np.sin(2 * np.pi * 0.5 * t) >>> filtered, info = apply_bandpass(sig, sfreq=10.0, low_hz=0.03, high_hz=0.07)