Applies a Finite Impulse Response (FIR) filter along the time axis.
Uses zero-phase forward-backward filtering via signal::filtfilt() to
avoid phase distortion.
Usage
firFilter(
x,
low = NULL,
high = NULL,
order = 100L,
type = c("pass", "low", "high", "stop"),
window = "hamming",
causal = FALSE,
output_assay = "filtered"
)Arguments
- x
A
PhysioExperimentobject.- low
Lower cutoff frequency in Hz.
- high
Upper cutoff frequency in Hz.
- order
Filter order (number of taps - 1). Default is 100.
- type
Filter type: "low", "high", "pass" (bandpass), or "stop" (bandstop).
- window
Window function for FIR design. Default is "hamming".
- causal
Logical. If FALSE (default), apply zero-phase forward-backward filtering (
signal::filtfilt()), which is non-causal. If TRUE, apply a single forward (causal) pass vialfilter()with a steady-state warm start, producing a real-time-equivalent result (linear-phase group delay oforder / 2samples, no acausal pre-ringing).- output_assay
Name for the output assay. Default is "filtered".
Value
A PhysioExperiment object with a new assay named output_assay
containing the FIR-filtered data. Dimensions match the input assay.
See also
butterworthFilter() for IIR filtering, notchFilter() for power
line noise removal, filterSignals() for moving average filtering,
lfilter() for the underlying causal filtering primitive.