resample

function of dascore.proc.resample source

resample(
    patch: Patch ,
    window ,
    interp_kind ,
    **kwargs ,
)-> Patch

Resample along a single dimension using Fourier Method and interpolation.

The dimension which should be resampled is passed as kwargs. The key is the dimension name and the value is the new sampling period.

Since Fourier methods only support adding or removing an integer number of frequency bins, the exact desired sampling rate is often not achievable with resampling alone. If the fourier resampling doesn’t produce the exact an interpolation (see interpolate) is used to achieve the desired sampling rate.

Parameters

Parameter Description
patch The patch to resample.
window The Fourier-domain window that tapers the Fourier spectrum. See scipy.signal.resample for details. Only used if method == ‘fft’.
interp_kind The interpolation type if output of fourier resampling doesn’t produce exactly the right sampling rate.
**kwargs keyword arguments to specify
Note

Unlike iresample this function requires a sampling_period.

Often the resulting Patch will be slightly shorter than the input Patch.

Examples

# resample a patch along time dimension to 10 ms import dascore as dc patch = dc.get_example_patch() new = patch.resample(time=np.timedelta64(10, ‘ms’))

See Also

decimate interpolate iresample