NotchFilter

class of dascore.proc.filter
inherits from: PatchProcessor, DascoreBaseModel, pydantic.main.BaseModel
source

NotchFilter(
    *args ,
    q: Any ,
    **kwargs ,
)-> None

Apply a second-order IIR notch digital filter on patch’s data.

A notch filter is a band-stop filter with a narrow bandwidth (high quality factor). It rejects a narrow frequency band and leaves the rest of the spectrum little changed.

Parameters

Parameter Description
patch The patch to filter
q Quality factor (float). A higher Q value means a narrower notch,
which targets the specific frequency more precisely.
A lower Q results in a wider notch, meaning a broader range of
frequencies around the specific frequency will be attenuated.
**kwargs Used to specify the dimension(s) and associated frequency and/or wavelength
(or equivalent values) for the filter.

See Also

scipy.signal.iirnotch.

Examples

import dascore
pa = dascore.get_example_patch()
 # Apply a notch filter along time axis to remove 60 Hz
filtered = pa.notch_filter(time=60, q=30)
 # Apply a notch filter along distance axis to remove 5 m wavelength
filtered = pa.notch_filter(distance=0.2, q=30)
 # Apply a notch filter along both time and distance axes
filtered = pa.notch_filter(time=60, distance=0.2, q=30)
# Optionally, units can be specified for a more expressive API.
from dascore.units import m, ft, s, Hz
# Apply a notch filter along time axis to remove 60 Hz
filtered = pa.notch_filter(time=60 * Hz, q=30)
# Apply a notch filter along distance axis to remove 5 m wavelength
filtered = pa.notch_filter(distance=5 * m, q=30)

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the axis and filter coefficients of each dimension.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
numpy_kernel Return the data with each notch applied in turn.
notch_filter Apply a second-order IIR notch digital filter on patch’s data.
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.