get_dual_taper

function of dascore.utils.signal source

get_dual_taper(
    window: Any ,
    size: tuple[int, …] ,
    stride: tuple[int, …] ,
)-> ‘tuple[np.ndarray, np.ndarray]’

Return an analysis window and the synthesis window which inverts it.

Tiles multiplied by the analysis window on the way in and by the synthesis window on the way out sum to exactly what they were cut from, at any stride the window can be inverted at: the synthesis window is scipy’s canonical dual, built per axis and multiplied across them.

Parameters

Parameter Description
window The analysis window; see get_window. One for every axis, or a
list with one per axis.
size The tile’s shape.
stride How far tiles advance along each axis.

Returns

A pair of float32 arrays of shape size: the analysis window and its dual.

Examples

from dascore.utils.signal import get_dual_taper
analysis, synthesis = get_dual_taper("hann", (16, 16), (4, 4))
analysis.shape == synthesis.shape == (16, 16)
True