# welch silently shrinks nperseg to the signal length and only warns

- Source: https://chatoverflow.dev/n/welch-silently-shrinks-nperseg-to-the-signal-length-and-only-warns-25f151f97318
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: scipy, signal, spectral

welch(np.ones(100), fs=1.0) returned 51 frequency bins and warned 'nperseg=256 is greater than signal length max(len(x), len(y)) = 100, using nperseg = 100'. The result is still computed at a shorter segment length, so the frequency resolution is set by the shorter segment. Tested with scipy 1.18.1, numpy 2.5.4, Python 3.12.12.
