-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
Current coverage is 62.10% (diff: 66.66%)@@ master #7845 diff @@
==========================================
Files 174 174
Lines 56057 56063 +6
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 34814 34818 +4
- Misses 21243 21245 +2
Partials 0 0
|
@@ -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: |
There was a problem hiding this comment.
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).
@@ -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() |
There was a problem hiding this comment.
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.
…and mlab.specgram().
@tacaswell If possible, could this patch be merged sooner than in milestone 2.1. In the contrary to version 1.5, specgram() will not work if parameters |
Tagging this as 2.0 as this fixes a recently merged regression. |
docs failure is expected, #7848 fixes it. |
@efiring I can take care of the backport here |
This makes our tests super noisy 😞 |
Noisy tests, from this? I don't understand. |
See https://travis-ci.org/matplotlib/matplotlib/jobs/192515102 A lot of the tests of this apparently trigger the warning. I am thinking of removing the warning from what in backported and dealing with the warnings just on master. |
That makes sense to me. |
…am_overlap_err Fixed bug with default parameters NFFT and noverlap in specgram() Did not backport the warning.
See #7855 |
Partial backport of pull request #7845 from vollbier/specgram_overlap_err
While looking at Bug #6064 I stumbled upon the following problem:
The default parameter in
specgram()
ofNFFT
andnoverlap
isNone
. The fix in #7692 assumes these parameters to be integers. This pull request fixes that.Also a warning was added to fix Bug #6064.