function of dascore.proc.filter source

    patch: Patch ,
    polyorder ,
    samples = False,
    mode = interp,
    cval = 0.0,
    **kwargs ,
)-> ‘PatchType’

Applies Savgol filter along spenfied dimensions.

The filter will be applied over each selected dimension sequentially.


Parameter Description
patch The patch to filter
polyorder Order of polynomial
samples If True samples are specified
If False coordinate of dimension
mode The mode for handling edges.
cval The constant value for when mode == constant.
**kwargs Used to specify the shape of the savgol filter in each dimension.

See scipy.signal.savgol_filter for more info on implementation and arguments.


import dascore
from dascore.units import m, s
pa = dascore.get_example_patch()

# Apply second order polynomial Savgol filter
# over time dimension with 0.10 sec window.
filtered_pa_1 = pa.savgol_filter(polyorder=2, time=0.1)

# Apply Savgol filter over distance dimension using a 5 sample
# distance window.
filtered_pa_2 = pa.median_filter(distance=5, samples=True, polyorder=2)

# Combine distance and time filter
filtered_pa_3 = pa.savgol_filter(distance=10, time=0.1, polyorder=4)