Whiten

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

Whiten(
    *args ,
    smooth_size: Any = None,
    water_level: Any = None,
    **kwargs ,
)-> None

Spectral whitening of a signal.

The whitened signal is returned in the same domain (eq frequency or time domain) as the input signal. See also the Whiten Processing Section.

Parameters

Parameter Description
smooth_size Size in transformed domain units (eg Hz) or samples of moving average
window, used to compute the spectrum before whitening.
If None, don’t smooth signal which results in a uniform amplitude.
units.
water_level If used, float between 0 and 1 to stabilize frequencies with near
zero amplitude. Does nothing if smooth_size is None.
Values between 0.01 and 0.05 usually work well.
**kwargs Used to specify the dimension range in transformed units (e.g, Hz)
of the smoothing. Can either be a sequence of two values or
four values to specify a taper range. Simply uses
Patch.taper_range under the hood.
If kwargs are provided, try to smooth time or ft_time coords.
Note
  1. The FFT result is divided by the smoothed spectrum before inverting back to time-domain signal. The phase is not changed.

  2. Amplitude is NOT preserved

Example

import dascore as dc

patch = dc.get_example_patch()

# Whiten along time dimension
white_patch = patch.whiten(time=None)

# Band limited whitening
white_patch = patch.whiten(time=(20, 40))

# Band limited with taper ends
white_patch = patch.whiten(time=(10, 20, 40, 60))

# Whitening along distance with amplitude smoothing (0.1/m))
white_patch = patch.whiten(smooth_size=0.1, distance=None)

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
get_metadata Return the whitened metadata, and the transforms, smoothing and taper.
kernel As numpy_kernel, on the data’s own backend.
model_copy Copy the model, dropping cached values the update invalidates.
new Create new instance with some attributed updated.
numpy_kernel Return the data with flattened amplitudes and their phases kept.
whiten Spectral whitening of a signal.
reconcile Return metadata or a patch holding the final data; default as is.
run Run the operation: check, get_metadata, kernel, reconcile, record.