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

MAINT: Safer check #198

Merged
merged 1 commit into from
Sep 19, 2023
Merged

MAINT: Safer check #198

merged 1 commit into from
Sep 19, 2023

Conversation

larsoner
Copy link
Member

Every once in a while in testing I get:

________________________________________________________________________ test_plot_instance_components[qt] _________________________________________________________________________
mne/viz/tests/test_ica.py:521: in test_plot_instance_components
    fig._fake_click((x, y), xform="data")
../mne-qt-browser/mne_qt_browser/_pg_figure.py:4665: in _fake_click
    raise RuntimeError(f'There as been an {exc[0]} inside the Qt '
E   RuntimeError: There as been an <class 'RuntimeWarning'> inside the Qt event loop (look above for traceback).
...
Traceback (most recent call last):
  File "/home/larsoner/python/virtualenvs/base/lib/python3.11/site-packages/pyqtgraph/GraphicsScene/GraphicsScene.py", line 378, in sendClickEvent
    item.mouseClickEvent(ev)
  File "/home/larsoner/python/mne-qt-browser/mne_qt_browser/_pg_figure.py", line 612, in mouseClickEvent
    y_values = np.asarray(list(self.ch_texts.values()))[:, 1, :]
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
IndexError: too many indices for array: array is 1-dimensional, but 3 were indexed

Not quite sure why this happens, but this PR works around the issue by short-circuiting if there are no values.

@drammock drammock merged commit a409833 into mne-tools:main Sep 19, 2023
20 checks passed
@larsoner larsoner deleted the short branch September 19, 2023 19:59
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.

2 participants