fn

gaussian

Tensor
gaussian(M: int, std: float = 7.0, sym: bool = True, dtype: DTypeLike = None, device: DeviceLike = None)
source

Gaussian window.

Produces a Gaussian-shaped taper centred on the window midpoint. Because the Fourier transform of a Gaussian is itself a Gaussian, this window achieves the (continuous-time) time-frequency uncertainty bound and is the basis of the Gabor / short-time Fourier transform.

Parameters

Mint
Number of samples in the output window; must be >= 0.
stdfloat= 7.0
Standard deviation in samples; defaults to 7.0. Larger std → broader (closer to rectangular) window; smaller → more concentrated taper.
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]=exp ⁣(12(n(N1)/2σ)2),0n<N.w[n] = \exp\!\left( -\frac{1}{2} \left(\frac{n - (N-1)/2}{\sigma}\right)^2 \right), \qquad 0 \le n < N.

Truncating an infinite Gaussian to length M produces shallow discontinuities at the ends; choose std small enough that the window has decayed substantially by the boundary.

Examples

>>> from lucid.signal.windows import gaussian
>>> gaussian(5, std=1.0)
Tensor([0.1353, 0.6065, 1.0000, 0.6065, 0.1353])