Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/dev/14303.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where right-clicking a second component in :meth:`mne.preprocessing.ICA.plot_sources` raised an ``IndexError``, by `Johannes Herforth`_.
2 changes: 1 addition & 1 deletion mne/viz/ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def _fast_plot_ica_properties(
inst, ica, reject_by_annotation, reject
)
del reject, inst
epochs_src_picked = epochs_src.pick(picks)
epochs_src_picked = epochs_src.copy().pick(picks)
del epochs_src
good_indices = np.setdiff1d(np.arange(len(epochs_src_picked)), bad_indices)

Expand Down
5 changes: 5 additions & 0 deletions mne/viz/tests/test_ica.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ def test_plot_ica_sources(raw_orig, browser_backend, monkeypatch):
# close child fig directly (workaround for mpl issue #18609)
fig._fake_keypress("escape", fig=fig.mne.child_figs[0])
assert browser_backend._get_n_figs() == 1
# a second click must work too
fig._click_ch_name(ch_index=1, button=3)
assert browser_backend._get_n_figs() == 2
fig._fake_keypress("escape", fig=fig.mne.child_figs[-1])
assert browser_backend._get_n_figs() == 1
fig._fake_keypress(fig.mne.close_key)
assert browser_backend._get_n_figs() == 0
del long_raw
Expand Down
Loading