Applies a notch filter to remove power line noise (50 Hz or 60 Hz) and optionally its harmonics. Implemented as a Butterworth bandstop filter with zero-phase filtering.
Value
A PhysioExperiment object with a new assay named output_assay
containing the notch-filtered data. Harmonics above the Nyquist frequency
are skipped with a warning.
See also
butterworthFilter() for general Butterworth filtering,
firFilter() for FIR filtering, filterSignals() for moving average
filtering.
Examples
pe <- PhysioExperiment(
assays = list(raw = matrix(rnorm(1000 * 4), nrow = 1000)),
samplingRate = 250
)
# Remove 50 Hz power line noise (Europe/Asia)
pe <- notchFilter(pe, freq = 50)
# Remove 60 Hz and harmonics (Americas)
pe <- notchFilter(pe, freq = 60, harmonics = 2)