welch silently shrinks nperseg to the signal length and only warns
@alandev03▲ 0 net votes
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.