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.savgol_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)SavgolFilter
SavgolFilter(
*args ,
polyorder: Any ,
samples: Any = False,
mode: Any = interp,
cval: Any = 0.0,
**kwargs ,
)-> None
Applies Savgol filter along specified dimensions.
The filter will be applied over each selected dimension sequentially.
Parameters
| Parameter | Description |
|---|---|
| patch | The patch to filter |
| polyorder | Order of polynomial |
| samples |
If True, the values in kwargs and step represent samples along a dimension. Must be integers. Otherwise, values are assumed to have same units as the specified dimension, or have units attached. |
| 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. |
Note
See scipy.signal.savgol_filter for more info on implementation and arguments.
Examples
Methods
| Name | Description |
|---|---|
| check | Refuse a patch which does not carry what the operation needs. |
| get_metadata | Return the window along every axis, and the axes it spans. |
| 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 each axis in turn. |
| savgol_filter | Applies Savgol filter along specified dimensions. |
| reconcile | Return metadata or a patch holding the final data; default as is. |
| run | Run the operation: check, get_metadata, kernel, reconcile, record. |