fn

kaiser

Tensor
kaiser(M: int, beta: float = 12.0, sym: bool = True, dtype: DTypeLike = None, device: DeviceLike = None)
source

Kaiser–Bessel window.

Near-optimal window in the sense that it provides the largest fraction of energy in the main lobe for a given main-lobe width. A single parameter β\beta smoothly traverses the trade-off between time and frequency resolution; popular choices include β5\beta \approx 5 (≈ −37 dB side-lobes), β8.6\beta \approx 8.6 (≈ −90 dB), and β12\beta \approx 12 (≈ −124 dB).

Parameters

Mint
Number of samples in the output window; must be >= 0.
betafloat= 12.0
Shape parameter; defaults to 12.0. Larger beta → wider main lobe, lower side lobes. beta = 0 yields the rectangular window; beta ≈ 5 approximates the Hamming window.
symbool= True
Symmetric (True, default) or periodic (False) variant.
dtypeDTypeLike= None
Desired dtype of the output tensor.
deviceDeviceLike= None
Target device for the output tensor.

Returns

Tensor

1-D tensor of length M.

Notes

Sample formula:

w[n]=I0 ⁣(β1(2nN11)2)I0(β),0n<N,w[n] = \frac{I_0\!\left(\beta\, \sqrt{1 - \left(\frac{2n}{N-1} - 1\right)^2}\right)} {I_0(\beta)}, \qquad 0 \le n < N,

where I0I_0 is the modified Bessel function of the first kind, order 0. The Kaiser-Bessel window is the discrete-time approximation to the continuous prolate-spheroidal window; the side-lobe attenuation in dB is approximately 8.7β8.7\,\beta for moderate β\beta.

Examples

>>> from lucid.signal.windows import kaiser
>>> kaiser(5, beta=8.0)
Tensor([0.0046, 0.3464, 1.0000, 0.3464, 0.0046])