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

Display of zero-length spectrograms in viewer fails on Windows. #30

Closed
HaroldMills opened this issue Oct 20, 2014 · 2 comments
Closed
Assignees
Labels

Comments

@HaroldMills
Copy link
Owner

Bill Evans recently showed me that the viewer clips window becomes nonfunctional if one looks at CLC noise clips for the night of 2014-09-02 in an example data set he is preparing. I was unable to reproduce this problem on Mac OS X, but I do see it on Windows 8 (Bill uses some version of Windows).

The problem appears to be related to zero-length spectrograms. The CLC clip with time 2014-09-03 01:02:08 has only 113 samples (the .wav file has 270 bytes), and so its spectrogram has zero spectra for the default window size of 128 samples. When I try to display such a spectrogram in the viewer (on Windows, but not on Mac OS X), an exception is raised from within Matplotlib and I see the following stack trace:

Traceback (most recent call last):
  File "C:\Users\Harold\Anaconda\lib\site-packages\matplotlib\backends\backend_qt5.py", line 338, in resizeEvent
    self.draw()
  File "C:\Users\Harold\Anaconda\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 148, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Users\Harold\Anaconda\lib\site-packages\matplotlib\backends\backend_agg.py", line 456, in draw
    self.renderer = self.get_renderer(cleared=True)
  File "C:\Users\Harold\Anaconda\lib\site-packages\matplotlib\backends\backend_agg.py", line 473, in get_renderer
    self.renderer = RendererAgg(w, h, self.figure.dpi)
  File "C:\Users\Harold\Anaconda\lib\site-packages\matplotlib\backends\backend_agg.py", line 94, in __init__
    self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
ValueError: width and height must each be below 32768
@HaroldMills HaroldMills self-assigned this Oct 20, 2014
@HaroldMills
Copy link
Owner Author

In the PyDev debugger I see that the width of the figure canvas for the zero-length spectrogram (width in the call to _RenderAgg in the stack trace of the first issue comment) is -3. The particular value of the width may depend on the size of the clips window, but it's a problem that it's negative. The size that is assigned to the figure by the viewer (method _lay_out_clips of class _FiguresFrameWithFlowLayout_) is 3 pixels.

Regardless of this problem, it might be best for a clip figure to have a minimum (positive!) width (in pixels) to ensure that it is minimally noticeable. I'll need to think more about how best to accomplish this. This will incidentally function as a workaround to the current problem as long as we make the minimum width large enough.

@HaroldMills
Copy link
Owner Author

I've been planning to switch from PySide to PyQt, so in case that would help with this problem I went ahead and did that today. It did not help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant