whiten

function of dascore.proc.whiten source

whiten(
    patch: Patch ,
    smooth_size: None | float[None, float] = None,
    water_level: None | float[None, float] = None,
    **kwargs ,
)-> ‘PatchType’

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
patch The patch to transform.
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)