Taper

class of dascore.proc.taper
inherits from: PatchProcessor, DascoreBaseModel, pydantic.main.BaseModel
source

Taper(
    *args ,
    window_type: Any = hann,
    **kwargs ,
)-> None

Taper the ends of the signal.

Parameters

Parameter Description
patch The patch instance.
window_type The window whose edge the taper takes. Supported options are:
barthann
bartlett
blackman
blackmanharris
bohman
boxcar
cos
hamming
hann
nuttall
parzen
ramp
triang
or any name or (name, parameter) tuple scipy.signal.get_window
accepts, such as ("tukey", 0.5).
**kwargs Used to specify the dimension along which to taper and the percentage
of total length of the dimension (if a decimal or percent, 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.

Note

A dimension with missing samples (holes in its step) raises; use split_gaps or fill_gaps first.

See Also

Patch.taper_range

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 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)

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the axis, the ramps, and where each meets the untouched middle.
kernel Return the data with its ends scaled by the ramps, in its own dtype.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
numpy_kernel Return a copy of the data with its ends scaled in place.
taper Taper the ends of the signal.
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.