Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0141f27

Browse files
committed
Added warning to mlab.specgram() to fix Bug #6064
1 parent 70551ec commit 0141f27

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/mlab.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,9 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
12741274
"""
12751275
if noverlap is None:
12761276
noverlap = 128
1277+
if len(x) <= (256 if NFFT is None else NFFT): # see _spectral_helper()
1278+
warnings.warn("Only one segment is calculated since parameter NFFT " +
1279+
"(=%d) >= signal length (=%d)." % (NFFT, len(x)))
12771280

12781281
spec, freqs, t = _spectral_helper(x=x, y=None, NFFT=NFFT, Fs=Fs,
12791282
detrend_func=detrend, window=window,

0 commit comments

Comments
 (0)