TensorPlay
Reference guides
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.signal

Window functions for spectral analysis and filter design. A window is a length-M sequence of weights that tapers a finite segment of a signal, reducing the spectral leakage that comes from cutting the segment off sharply.

All window functions share a common shape of keyword arguments:

  • M — the window length, a positive integer.

  • sym — whether the window is symmetric (True, the default) or periodic (False). Symmetric windows are used in filter design; periodic windows are used for spectral analysis, where the window is applied to one period of a sampled signal and the first and last samples are not duplicates.

  • dtype, layout, device, requires_grad — the usual tensor construction arguments, so window tensors are created directly on the desired device with the desired data type.

import tensorplay as tp
from tensorplay.signal import windows

print(windows.hann(8))
print(windows.blackman(8, sym=False))
# window tensors are ordinary tensors, so they can be moved or differentiated
w = windows.kaiser(64, beta=8.0)

Window functions

tensorplay.signal.windows.bartlett

Computes the Bartlett window.

tensorplay.signal.windows.blackman

Computes the Blackman window.

tensorplay.signal.windows.cosine

Computes a window with a simple cosine waveform, also known as the sine window.

tensorplay.signal.windows.exponential

Computes a window with an exponentially decaying waveform, also known as the Poisson window.

tensorplay.signal.windows.gaussian

Computes a window with a Gaussian waveform.

tensorplay.signal.windows.general_cosine

Computes the general cosine window, a weighted sum of cosines whose frequencies are integer multiples of the fundamental.

tensorplay.signal.windows.general_hamming

Computes the general Hamming window, the two-term member of the general cosine family.

tensorplay.signal.windows.hamming

Computes the Hamming window.

tensorplay.signal.windows.hann

Computes the Hann window.

tensorplay.signal.windows.kaiser

Computes the Kaiser window.

tensorplay.signal.windows.nuttall

Computes the minimum 4-term Blackman-Harris window described by Nuttall.

Where to go next

  • FFT functions — windowing is typically a preamble to a spectral transform; the FFT page covers the transform side.

  • Tensors — the tensor APIs the window functions are built on.

On this page

Ask DeepWiki