bundles / scipy latest / scipy / signal / _spectral_py / check_NOLA
function
scipy.signal._spectral_py:check_NOLA
Signature
def check_NOLA ( window , nperseg , noverlap , tol = 1e-10 ) Summary
Check whether the Nonzero Overlap Add (NOLA) constraint is met.
Parameters
window: str or tuple or array_likeDesired window to use. If
windowis a string or tuple, it is passed to get_window to generate the window values, which are DFT-even by default. See get_window for a list of windows and required parameters. Ifwindowis array_like it will be used directly as the window and its length must be nperseg.nperseg: intLength of each segment.
noverlap: intNumber of points to overlap between segments.
tol: float, optionalThe allowed variance of a bin's weighted sum from the median bin sum.
Returns
verdict: boolTrueif chosen combination satisfies the NOLA constraint withintol,Falseotherwise
Notes
In order to enable inversion of an STFT via the inverse STFT in istft, the signal windowing must obey the constraint of "nonzero overlap add" (NOLA):
for all , where is the window function, is the frame index, and is the hop size ( = nperseg - noverlap).
This ensures that the normalization factors in the denominator of the overlap-add inversion equation are not zero. Only very pathological windows will fail the NOLA constraint.
Array API Standard Support
check_NOLA has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ⛔ PyTorch ⛔ ⛔ JAX ⛔ ⛔ Dask ⛔ n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
import numpy as np from scipy import signal✓
signal.check_NOLA(signal.windows.boxcar(100), 100, 75)
✗signal.check_NOLA(signal.windows.boxcar(100), 100, 25)
✗signal.check_NOLA(signal.windows.hann(120, sym=True), 120, 60)
✗w = np.ones(64, dtype="float") w[::2] = 0✓
signal.check_NOLA(w, 64, 32)
✗signal.check_NOLA(signal.windows.hann(64), 64, 0) signal.check_NOLA(signal.windows.hann(64), 64, 1) signal.check_NOLA(signal.windows.hann(64), 64, 2)✗
See also
- check_COLA
Check whether the Constant OverLap Add (COLA) constraint is met
- istft
Inverse Short Time Fourier Transform
- stft
Short Time Fourier Transform
Aliases
-
scipy.signal.check_NOLA