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

Skip to content

matplotlib.pylab.specgram generate bad image in 1.4.0 #3605

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

Closed
udibr opened this issue Oct 1, 2014 · 4 comments
Closed

matplotlib.pylab.specgram generate bad image in 1.4.0 #3605

udibr opened this issue Oct 1, 2014 · 4 comments
Labels
status: needs clarification Issues that need more information to resolve.

Comments

@udibr
Copy link

udibr commented Oct 1, 2014

Used to work great in 1.3.1 but in 1.4.0 the image is covered with horizontal line.
The can also be seen by averaging over time by plotting Pxx.mean(axis=-1)

@tacaswell
Copy link
Member

Can you provide a minimal example to demonstrate the problem and the image produced?

Your example will probably be turned into a test so this problem does not come back.

@tacaswell tacaswell added this to the unassigned milestone Oct 1, 2014
@tacaswell tacaswell added the status: needs clarification Issues that need more information to resolve. label Oct 1, 2014
@udibr
Copy link
Author

udibr commented Oct 2, 2014

I am sorry, I tried really hard to build a simple code but it all worked fine.
The problem only happens when using data from https://www.kaggle.com/c/seizure-prediction/data
so there is something strange in these specific matlab files.
Anyway, once you have downloaded one of the files, for example Dog_1.tar and open it, you can run the following code:

from matplotlib import pylab as pl
import scipy.io

data = scipy.io.loadmat('Dog_1/Dog_1_interictal_segment_0019.mat')
d = data['interictal_segment_19']['data'][0,0]
pl.specgram(d[0,:])
pl.show()

and 9 horizontal lines appear in equal distance (splitting the y axis to 8 segments)
but I found that if you copy the data everything looks good:

pl.specgram(d[0,:].copy())
pl.show()

which hint that the problem is somehow related to numpy view mechanism

@cimarronm
Copy link
Contributor

Can you try with 1.4.x branch? This looks like (unable to test at the moment to verify) the strided view bug (#3467) which will be fixed in 1.4.1

@udibr
Copy link
Author

udibr commented Oct 2, 2014

Yes the problem is solved in 1.4.x and 1.5.x
(and a work around for 1.4.0 is to copy the input before calling specgram)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification Issues that need more information to resolve.
Projects
None yet
Development

No branches or pull requests

3 participants