Skip to content

Conversation

@AJQuinn
Copy link
Contributor

@AJQuinn AJQuinn commented Aug 23, 2022

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.

@drammock
Copy link
Member

@AJQuinn merge conflict on the changelog file.

@drammock
Copy link
Member

- 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`_)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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`_)

Copy link
Contributor Author

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

Comment on lines 454 to 456
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')
Copy link
Member

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.

Copy link
Contributor Author

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]>
@agramfort agramfort enabled auto-merge (squash) August 24, 2022 08:57
auto-merge was automatically disabled August 24, 2022 09:04

Head branch was pushed to by a user without write access

@drammock drammock enabled auto-merge (squash) August 24, 2022 09:10
@drammock drammock merged commit 5ee892f into mne-tools:main Aug 24, 2022
larsoner added a commit to larsoner/mne-python that referenced this pull request Aug 29, 2022
* 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)
  ...
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.

raw.drop_channels

3 participants