Processing

The following shows some simple examples of patch processing. See the proc module documentation for a list of processing functions.

Decimate

The decimate patch function decimates a Patch along a given axis while by default performing low-pass filtering to avoid aliasing.

Data creation

First, we create a patch composed of two sine waves; one above the new decimation frequency and one below.

import dascore as dc

patch = dc.examples.sin_wave_patch(
    sample_rate=1000,
    frequency=[200, 10],
    channel_count=2,
)
_ = patch.viz.wiggle(show=True)

IIR filter

Next we decimate by 10x using IIR filter

decimated_iir = patch.decimate(time=10, filter_type='iir')
_ = decimated_iir.viz.wiggle(show=True)

Notice the lowpass filter removed the 200 Hz signal and only the 10Hz wave remains.

FIR filter

Next we decimate by 10x using FIR filter.

decimated_fir = patch.decimate(time=10, filter_type='fir')
_ = decimated_fir.viz.wiggle(show=True)

No Filter

Next, we decimate without a filter to purposely induce aliasing.

decimated_no_filt = patch.decimate(time=10, filter_type=None)
_ = decimated_no_filt.viz.wiggle(show=True)