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

Skip to content

Fixed bug with default parameters NFFT and noverlap in specgram() #7845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added warning to mlab.specgram() to fix Bug #6064
  • Loading branch information
DietBru committed Jan 16, 2017
commit 0141f27ce3f2ec24c60205b63aa63fd64bf2608b
3 changes: 3 additions & 0 deletions lib/matplotlib/mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None,
"""
if noverlap is None:
noverlap = 128
if len(x) <= (256 if NFFT is None else NFFT): # see _spectral_helper()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, I would encode the default of 256 so that it can not get out of sync with the down stream functions.

warnings.warn("Only one segment is calculated since parameter NFFT " +
"(=%d) >= signal length (=%d)." % (NFFT, len(x)))

spec, freqs, t = _spectral_helper(x=x, y=None, NFFT=NFFT, Fs=Fs,
detrend_func=detrend, window=window,
Expand Down