taper

function of dascore.proc.taper source

taper(
    patch: Patch ,
    window_type: str = hann,
    **kwargs ,
)-> ‘PatchType’

Taper the ends of the signal.

Parameters

Parameter Description
patch The patch instance.
window_type The type of window to use For tapering. Supported Options are:
barthann
bartlett
blackman
blackmanharris
bohman
hamming
hann
nuttall
parzen
triang
**kwargs Used to specify the dimension along which to taper and the percentage
of total length of the dimension or abolsute units. If a single value
is passed, the taper will be applied to both ends. A length two tuple
can specify different values for each end, or no taper on one end.

Returns

The tapered patch.

Examples

import dascore as dc
patch = dc.get_example_patch() # generate example patch
# Apply an Hanning taper to 5% of each end for time dimension.
patch_taper1 = patch.taper(time=0.05, window_type="hann")
# Apply a triangular taper to 10% of the start of the distance dimension.
patch_taper2 = patch.taper(distance=(0.10, None), window_type='triang')
# Apply taper on first and last 15 m along distance axis.
from dascore.units import m
patch_taper3 = patch.taper(distance=15 * m)