PassFilter

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

PassFilter(
    *args ,
    corners: Any = 4,
    zerophase: Any = True,
    **kwargs ,
)-> None

Apply a Butterworth pass filter (bandpass, highpass, or lowpass).

Parameters

Parameter Description
patch The patch to filter
corners The number of corners for the filter. Default is 4.
zerophase If True, apply the filter twice.
**kwargs Used to specify the dimension and frequency, wavelength, or equivalent
limits.

Examples

import dascore
pa = dascore.get_example_patch()
 # Apply bandpass filter along time axis from 1 to 100 Hz
bandpassed = pa.pass_filter(time=(1, 100))
 # Apply lowpass filter along distance axis for wavelengths less than 100m
lowpassed = pa.pass_filter(distance=(None, 1/100))
# Note that None and ... both indicate open intervals
assert pa.pass_filter(time=(None, 90)) == pa.pass_filter(time=(..., 90))
# Optionally, units can be specified for a more expressive API.
from dascore.units import m, ft, s, Hz
# Filter from 1 Hz to 10 Hz in time dimension
lp_units = pa.pass_filter(time=(1 * Hz, 10 * Hz))
# Filter wavelengths 50m to 100m
bp_m = pa.pass_filter(distance=(50 * m, 100 * m))
# filter wavelengths less than 200 ft
lp_ft = pa.pass_filter(distance=(200 * ft, ...))

Keywords

filtering, bandpass, low pass, high pass, frequency

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the axis and the filter’s second-order sections.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
numpy_kernel Return the data filtered along the axis.
pass_filter Apply a Butterworth pass filter (bandpass, highpass, or lowpass).
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.