8000 Fixed bug with default parameters NFFT and noverlap in specgram() by DietBru · Pull Request #7845 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

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
Next Next commit
Fixed bug with default parameters NFFT and noverlap ins specgram()
  • Loading branch information
DietBru committed Jan 16, 2017
commit 70551ecb3f9facae23a847dab302c9fc86f99952
5 changes: 5 additions & 0 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7234,6 +7234,11 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
Z = np.flipud(Z)

if xextent is None:
# define default values:
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this up to the top? I think it is better to have this over-ride the defaults if we change the defaults in mlab.specgram than to have this silently get out of sync (it is unlikely we will make that change, but this just smell very brittle to me).

if noverlap is None:
noverlap = 128 # defined in mlab.specgram
if NFFT is None:
NFFT = 256 # defined in mlab._spectral_helper
# padding is needed for first and last segment:
pad_xextent = (NFFT-noverlap) / Fs / 2
xextent = np.min(t) - pad_xextent, np.max(t) + pad_xextent
Expand Down
0