Skip to content
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

mlab.psd behavior change #2565

Closed
megies opened this issue Nov 1, 2013 · 3 comments
Closed

mlab.psd behavior change #2565

megies opened this issue Nov 1, 2013 · 3 comments

Comments

@megies
Copy link
Contributor

megies commented Nov 1, 2013

@toddrjen, 809411c breaks a test in @obspy that uses matplotlib.mlab.psd. Is a behavior change intended for 1.4.x? I would have to introduce more matplotlib version checking on our end then.. Or is this a bugfix in spectral estimation even? The commit message sounded like only refactoring was intended..

Here is an example of a program that yields different results after 809411c:

import numpy as np
from matplotlib import mlab

np.random.seed(1)
x = np.random.randn(100)
spec, freq = mlab.psd(x, NFFT=32, Fs=2, detrend=mlab.detrend_linear,
                      window=mlab.window_hanning, noverlap=20, pad_to=200,
                      sides="onesided", scale_by_freq=True)

Here is the image with the results before/after:
psd

@toddrjen
Copy link
Contributor

toddrjen commented Nov 2, 2013

Thanks for pointing this out. It appears I inadvertently changed the order
of some operations. I have fixed this, and am now implementing unit tests
to more thoroughly check this and avoid this problem in the future. Once I
confirm the tests are working I will submit a fix.
On Nov 1, 2013 6:47 PM, "Tobias Megies" notifications@github.com wrote:

@toddrjen https://github.com/toddrjen, 809411chttps://github.com/matplotlib/matplotlib/commit/809411cbreaks a test in
@obspy https://github.com/obspy that uses matpltolib.mlab.psd. Is a
behavior change intended for 1.4.x? I would have to introduce more
matplotlib version checking on our end then.. Or is this a bugfix in
spectral estimation even?

Here is an example of a program that yields different results after
809411c 809411c:

import numpy as npfrom matplotlib import mlab
np.random.seed(1)x = np.random.randn(100)spec, freq = mlab.psd(x, NFFT=32, Fs=2, detrend=mlab.detrend_linear,
window=mlab.window_hanning, noverlap=20, pad_to=200,
sides="onesided", scale_by_freq=True)


Reply to this email directly or view it on GitHubhttps://github.com//issues/2565
.

@toddrjen
Copy link
Contributor

toddrjen commented Nov 5, 2013

Pull request #2571 should fix this problem. I also added unit tests for this.

@megies
Copy link
Contributor Author

megies commented Nov 11, 2013

Fixed with ff304e4.

@megies megies closed this as completed Nov 11, 2013
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

No branches or pull requests

2 participants