-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add _on_missing functionality to UpdateChannelsMixin #11077
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
Add _on_missing functionality to UpdateChannelsMixin #11077
Conversation
|
@AJQuinn merge conflict on the changelog file. |
|
to debug this failure locally: run |
…ajquinn/mne-python into drop_channels_on_missing_update
doc/changes/latest.inc
Outdated
| - Add ``starting_affine`` keyword argument to :func:`mne.transforms.compute_volume_registration` to initialize an alignment with an affine (:gh:`11020` by `Alex Rockhill`_) | ||
| - The ``trans`` parameter in :func:`mne.make_field_map` now accepts a :class:`~pathlib.Path` object, and uses standardised loading logic (:gh:`10784` by :newcontrib:`Andrew Quinn`) | ||
| - Allow :func:`mne.beamformer.make_dics` to take ``pick_ori='vector'`` to compute vector source estimates (:gh:`19080` by `Alex Rockhill`_) | ||
| - Add ``on_missing`` functionality to :class:`mne.channels.UpdateChannelsMixin` to tune drop_channels behaviour when specified channel names are not found(:gh:`11043` by `Andrew Quinn`_) |
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.
| - Add ``on_missing`` functionality to :class:`mne.channels.UpdateChannelsMixin` to tune drop_channels behaviour when specified channel names are not found(:gh:`11043` by `Andrew Quinn`_) | |
| - Add ``on_missing`` functionality to :class:`mne.channels.UpdateChannelsMixin` to tune drop_channels behaviour when specified channel names are not found (:gh:`11077` by `Andrew Quinn`_) |
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.
Thanks @agramfort - now fixed in 9ef982d
Co-authored-by: Daniel McCloy <[email protected]>
mne/channels/tests/test_channels.py
Outdated
| pytest.raises(ValueError, raw.drop_channels, m_chs) | ||
| # ...but this can be turned to a warning | ||
| pytest.warns(RuntimeWarning, raw.drop_channels, m_chs, on_missing='warn') |
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.
sorry I didn't catch this before, but ideally these should use the newer context-manager style of raises or warns. git grep "with pytest.raises" will show you some examples of the syntax; the advantage is (1) easier to read what's being tested and (2) checks that the actual error/warning message matches rather than just the error/warning type.
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.
Thanks - I've updated in 761d719
Co-authored-by: Alexandre Gramfort <[email protected]>
Head branch was pushed to by a user without write access
* upstream/main: (366 commits) BUG: Spectrum deprecation cleanup [circle deploy] (mne-tools#11115) Add API entry list and map (mne-tools#10999) Add legacy decorator (mne-tools#11097) [ENH, MRG] Add time-frequency epoch source estimation (mne-tools#11095) Revert "Add error message when conversion of EEG locs to [circle deploy] (mne-tools#11104) MRG: Fixes for mne-tools#11090 (mne-tools#11108) add test for edf units param (mne-tools#11105) BUG: Improve logic for bti (mne-tools#11102) add spectrum class (mne-tools#10184) ENH : add units parameter to read_raw_edf in case units is missing from the file (mne-tools#11099) ENH: Add temperature and galvanic (mne-tools#11090) Add error message when conversion of EEG locs to head space fails (mne-tools#11080) DOC: removed unnecessary line in PSF example (mne-tools#11085) FIX: Update helmet during ICP (mne-tools#11084) Fix various typos (mne-tools#11086) DOC: Rel BUG: don't assume that channel info contains particular keys (mne-tools#11074) [BUG] Fix plot_topomap with sphere="eeglab" (mne-tools#11081) Add `vmin` and `vmax` specification to `mne.Evoked.animate_topomap` (mne-tools#11073) Add _on_missing functionality to UpdateChannelsMixin (mne-tools#11077) ...
Reference issue
Example: Fixes #11043.
What does this implement/fix?
This PR adds _on_missing functionality to UpdateChannelsMixin to customise behaviour when specified channel names are not found in object.