fn
general_hamming
→Tensorgeneral_hamming(M: int, alpha: float, sym: bool = True, dtype: DTypeLike = None, device: DeviceLike = None)Generalised Hamming-family window.
Parametric two-term cosine window covering the Hann () / Hamming () family. The free parameter controls the trade-off between the level of the first side-lobe and the asymptotic side-lobe roll-off rate.
Parameters
MintNumber of samples in the output window; must be
>= 0.alphafloatMixing coefficient; gives Hann,
gives Hamming.
symbool= TrueSymmetric (
True, default) or periodic (False) variant.dtypeDTypeLike= NoneDesired dtype of the output tensor.
deviceDeviceLike= NoneTarget device for the output tensor.
Returns
Tensor1-D tensor of length M containing the window samples.
Notes
Sample formula:
With the first side-lobe is minimised in absolute level (the so-called "optimal" Hamming).
Examples
>>> from lucid.signal.windows import general_hamming
>>> general_hamming(5, alpha=0.5)
Tensor([0.0000, 0.5000, 1.0000, 0.5000, 0.0000])