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

issue opening stft file #49

Closed
mandarptl opened this issue Mar 21, 2017 · 4 comments
Closed

issue opening stft file #49

mandarptl opened this issue Mar 21, 2017 · 4 comments

Comments

@mandarptl
Copy link

Mandars-MacBook-Pro:models_interface Mandar$ python models_gui.py
Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1542, in call
return self.func(args)
File "/Users/Mandar/Downloads/Downloads/ASP/sms-tools-master/software/models_interface/stft_GUI_frame.py", line 108, in compute_model
stft_function.main(inputFile, window, M, N, H)
File "/Users/Mandar/Downloads/Downloads/ASP/sms-tools-master/software/models_interface/stft_function.py", line 59, in main
plt.pcolormesh(frmTime, binFreq, np.transpose(mX[:,:N
maxplotfreq/fs+1]))
TypeError: slice indices must be integers or None or have an index method

@DavidAntliff
Copy link

I also see this with Python 2.7.13.

A potential fix is to change line 59 to:

plt.pcolormesh(frmTime, binFreq, np.transpose(mX[:,:int(N*maxplotfreq/fs)+1]))

And line 70 to:

plt.pcolormesh(frmTime, binFreq, np.transpose(np.diff(pX[:,:int(N*maxplotfreq/fs)+1],axis=1)))

However I'm not 100% sure if this is entirely correct, since the step value is truncated and may not be quite the right value.

I don't understand how anyone could proceed past this point without seeing this error? 5000.0/fs will always be fractional for typical sample rates, and is unlikely to yield an integer for some typical N (power of 2). Is there a version of Python where slice indices can be non-integer?

@mandarptl
Copy link
Author

Thanks David
The issue has been solved earlier.

@SpotlightKid
Copy link

@mandarptl Can you reference the commit or PR with the fix? All I see is a circular reference of issues between #49 (this one), #52 and #55.

@DavidAntliff
Copy link

@mandarptl has it really been solved? It affected me, on master, just yesterday. I didn't see a fix anywhere obvious.

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

3 participants