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

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

merged 3 commits into from
Jan 17, 2017

Conversation

DietBru
Copy link
Contributor

@DietBru DietBru commented Jan 16, 2017

While looking at Bug #6064 I stumbled upon the following problem:
The default parameter in specgram() of NFFT and noverlap is None. The fix in #7692 assumes these parameters to be integers. This pull request fixes that.

Also a warning was added to fix Bug #6064.

@codecov-io
Copy link

codecov-io commented Jan 16, 2017

Current coverage is 62.10% (diff: 66.66%)

Merging #7845 into master will increase coverage by <.01%

@@             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          

Powered by Codecov. Last update 7555a7a...0141f27

@@ -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).

@@ -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.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jan 16, 2017
@tacaswell tacaswell changed the title Fixed bug with default parameters NFFT and noverlap in specgram() [MRG+1] Fixed bug with default parameters NFFT and noverlap in specgram() Jan 16, 2017
@DietBru
Copy link
Contributor Author

DietBru commented Jan 16, 2017

@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 NFFT and noverlap are not set. That might break existing code.

@tacaswell tacaswell modified the milestones: 2.0 (style change major release), 2.1 (next point release) Jan 16, 2017
@tacaswell
Copy link
Member

Tagging this as 2.0 as this fixes a recently merged regression.

@tacaswell
Copy link
Member

docs failure is expected, #7848 fixes it.

@efiring efiring changed the title [MRG+1] Fixed bug with default parameters NFFT and noverlap in specgram() Fixed bug with default parameters NFFT and noverlap in specgram() Jan 17, 2017
@efiring efiring merged commit fa95b58 into matplotlib:master Jan 17, 2017
@tacaswell
Copy link
Member

@efiring I can take care of the backport here

@tacaswell
Copy link
Member

This makes our tests super noisy 😞

@efiring
Copy link
Member

efiring commented Jan 17, 2017

Noisy tests, from this? I don't understand.

@tacaswell
Copy link
Member

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.

@efiring
Copy link
Member

efiring commented Jan 17, 2017

That makes sense to me.

tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull request Jan 17, 2017
…am_overlap_err

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

Did not backport the warning.
@tacaswell
Copy link
Member

See #7855

efiring added a commit that referenced this pull request Jan 17, 2017
Partial backport of pull request #7845 from vollbier/specgram_overlap_err
@DietBru DietBru deleted the specgram_overlap_err branch January 17, 2017 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants