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 to first 20 percent and last 12 percent of time dimension.
from dascore.units import percent
patch_taper3 = patch.taper(time=(20 * percent, 12 * percent))
# Apply taper on first and last 15 m along distance axis.
from dascore.units import m
patch_taper4 = patch.taper(distance=15 * m)taper
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 cos hamming hann nuttall parzen ramp triang |
| **kwargs |
Used to specify the dimension along which to taper and the percentage of total length of the dimension (if a decimal or percente, see examples), or absolute 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.