function of dascore.proc.filter source

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

Apply 2-D median filter.


Parameter Description
patch The patch to filter
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 median filter in each dimension.
See examples for more info.


import dascore
from dascore.units import m, s
pa = dascore.get_example_patch()
 # 1. Apply median filter only over time dimension with 0.10 sec window
filtered_pa_1 = pa.median_filter(time=0.1)
 # 2. Apply median filter over both time and distance
 # using a 0.1 second time window and 2 m distance window
filtered_pa_2 = pa.median_filter(time=0.1 * s, distance=2 * m)
 # 3. Apply median filter with 3 time samples and 4 distance samples
filtered_pa = pa.median_filter(
    time=3, distance=4, samples=True,

See scipy.ndimage.median_filter for more info on implementation and arguments.

Values specified with kwargs should be small, for example < 10 samples otherwise this can take a long time and use lots of memory.