-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow lasso selection sensors in a plot_evoked_topo #12071
Conversation
084bd38
to
4fe2135
Compare
4fe2135
to
2c307fe
Compare
It's been a while, but this PR is finally ready for review (and at some point, merge). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only complaint is that I can't remove sensors from the selection because Alt+click+drag
is an OS-level "drag this whole window around the screen" shortcut in Linux. Can we use another key?
I now make it that CTRL adds to the selection, as it was before, and CTRL+SHIFT removes from the selection. Does that work better on OSX? |
failures look like they're probably related:
|
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
done! |
thanks @wmvanvliet awesome work |
* upstream/main: (57 commits) Allow lasso selection sensors in a plot_evoked_topo (mne-tools#12071) MAINT: Fix doc build (mne-tools#13076) BUG: Improve sklearn compliance (mne-tools#13065) [pre-commit.ci] pre-commit autoupdate (mne-tools#13073) MAINT: Add Numba to 3.13 test (mne-tools#13075) Bump autofix-ci/action from ff86a557419858bb967097bfc916833f5647fa8c to 551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef in the actions group (mne-tools#13071) [BUG] Correct annotation onset for exportation to EDF and EEGLAB (mne-tools#12656) New feature for removing heart artifacts from EEG or ESG data using a Principal Component Analysis - Optimal Basis Sets (PCA-OBS) algorithm (mne-tools#13037) [BUG] Fix taper weighting in computation of TFR multitaper power (mne-tools#13067) [FIX] Reading an EDF with preload=False and mixed frequency (mne-tools#13069) Fix evoked topomap colorbars, closes mne-tools#13050 (mne-tools#13063) [pre-commit.ci] pre-commit autoupdate (mne-tools#13060) BUG: Fix bug with interval calculation (mne-tools#13062) [DOC] extend documentation for add_channels (mne-tools#13051) Add `combine_tfr` to API (mne-tools#13054) Add `combine_spectrum()` function and allow `grand_average()` to support `Spectrum` data (mne-tools#13058) BUG: Fix bug with helium anon (mne-tools#13056) [ENH] Add option to store and return TFR taper weights (mne-tools#12910) BUG: viz plot window's 'title' argument showed no effect. (mne-tools#12828) MAINT: Ensure limited set of tests are skipped (mne-tools#13053) ...
@wmvanvliet this maybe just missing an |
looks like it, lets see: #13086 |
This adds
plot_evoked_topo(select=True)
which will allow you to use a lasso selection tool in the same manner asplot_sensors("select")
. It currently doesn't do anything with this selection other than publishing anSelectChannels
UI-Event. This is a part of the planned XFit-like GUI, but could have other uses as well. For example, we could in the future makeplot_evoked_topo
open up a figure with the average of the selected sensors when you select them, similar to what happens when you click on a sensor.The main change this PR makes is to refactor
mne.viz.utils.SelectFromCollection
a bit to make it more general purpose. Where the names of the variables and such were first tightly coupled toraw.plot_sensors
, things are now named from the perspective of a matplotlib figure with aCollection
of patches. The translation from "selecting matplotlib patches" to "selecting channels" is now happening though UI-events. You can register a callback function withmne.viz.utils.SelectFromCollection
for when a selection is made.Raw
andEvoked
use this to emitSelectChannels
UI-events whenever the user uses the lasso to select channels.The main unit test for this class has been moved from
viz/tests/test_raw.py
toviz/tests/test_util.py
. Smaller unit tests are now in place forraw.plot_sensors
andevoked.plot_topo
.In addition to using
CTRL
to "add to selection" you can now also useCTRL+SHIFT
to "remove from selection".At the moment, this doesn't work yet when
unified=False
. If there is a pressing need for it, I can add it, but perhaps this can also be left to a later PR.