fn
cosine
→Tensorcosine(M: int, sym: bool = True, dtype: DTypeLike = None, device: DeviceLike = None)Cosine (half-sine) window.
Produces a single arch of a sine curve over the window length, sometimes called the "sine" or "half-cosine" window. It is a smoother taper than the triangular window with comparable main-lobe width but significantly lower side lobes.
Parameters
MintNumber of samples in the output window; must be
>= 0.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:
Peak side-lobe attenuation is and the main-lobe width is . Sometimes used as the square root of the Hann window for analysis/synthesis pairs.
Examples
>>> from lucid.signal.windows import cosine
>>> cosine(4)
Tensor([0.3827, 0.9239, 0.9239, 0.3827])