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

MRG: Add error checking to prevent the creation of montage with invalid [x, y, z] #10547

Merged
merged 13 commits into from
Apr 20, 2022
Merged

MRG: Add error checking to prevent the creation of montage with invalid [x, y, z] #10547

merged 13 commits into from
Apr 20, 2022

Conversation

mscheltienne
Copy link
Member

@mscheltienne mscheltienne commented Apr 19, 2022

Before, both lines below would not raise.

montage = make_dig_montage(ch_pos={'A1': ['0', '0', '0']})
montage = make_dig_montage(ch_pos={'A1': 5})

The first one, in particular, is problematic, in case you read [x, y, z] values from a file and forget to convert from str to float (definitely never happened to me 🙈).

After, both raise an error at creation and I also added a conversion to a float array at an earlier stage for the [x, y, z].

@mscheltienne mscheltienne marked this pull request as draft April 19, 2022 18:11
mne/io/_digitization.py Outdated Show resolved Hide resolved
mne/io/_digitization.py Outdated Show resolved Hide resolved
mne/io/_digitization.py Outdated Show resolved Hide resolved
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
@mscheltienne mscheltienne marked this pull request as ready for review April 19, 2022 20:46
@mscheltienne mscheltienne changed the title Add error checking to prevent the creation of montage with invalid [x, y, z] MRG: Add error checking to prevent the creation of montage with invalid [x, y, z] Apr 19, 2022
@agramfort agramfort merged commit 4e601bc into mne-tools:main Apr 20, 2022
@agramfort
Copy link
Member

thx @mscheltienne !

@mscheltienne mscheltienne deleted the montage branch April 20, 2022 10:53
larsoner added a commit to alexrockhill/mne-python that referenced this pull request Apr 20, 2022
* upstream/main:
  Correct documented default number of CV splits [skip azp][skip actions] (mne-tools#10548)
  MRG: Add error checking to prevent the creation of montage with invalid [x, y, z] (mne-tools#10547)
larsoner added a commit to agramfort/mne-python that referenced this pull request Apr 21, 2022
* upstream/main: (52 commits)
  MAINT: Extra test for coreg (mne-tools#10549)
  BUG: Fix annot meas_date / crop (mne-tools#10491)
  Update latest.inc
  Use liblinear solver instead of lbgfs in all decodung examples [skip azp][skip actions] (mne-tools#10552)
  STY: Hotfix for HTML [ci skip]
  Allow making inverse solutions from fixed-orientation discrete forward models, enabling multi-dipole modeling (mne-tools#10464)
  Correct documented default number of CV splits [skip azp][skip actions] (mne-tools#10548)
  MRG: Add error checking to prevent the creation of montage with invalid [x, y, z] (mne-tools#10547)
  MRG: Add "verbose" parameter to pick_channels() method (mne-tools#10544)
  CI: Avoid bad PySide6 (mne-tools#10545)
  FIX: Flake (mne-tools#10540)
  FIX: Correct link (mne-tools#10536)
  DOC: Update installers (mne-tools#10535)
  ENH: Add dark mode to website (mne-tools#10523)
  WIP: Copy BEM surfaces by default (don't symlink) (mne-tools#10531)
  Avoid lowpass=0 in brainvision data (mne-tools#10517)
  DOC: Update installers [skip azp] [skip actions] (mne-tools#10528)
  FIX: Fix for old build (mne-tools#10527)
  Fix line noise at wrong frequencies (mne-tools#10525)
  FIX : read fids in eeglab (mne-tools#10521)
  ...
larsoner added a commit to hoechenberger/mne-python that referenced this pull request Apr 21, 2022
…10520

* upstream/main:
  MAINT: Extra test for coreg (mne-tools#10549)
  BUG: Fix annot meas_date / crop (mne-tools#10491)
  Update latest.inc
  Use liblinear solver instead of lbgfs in all decodung examples [skip azp][skip actions] (mne-tools#10552)
  STY: Hotfix for HTML [ci skip]
  Allow making inverse solutions from fixed-orientation discrete forward models, enabling multi-dipole modeling (mne-tools#10464)
  Correct documented default number of CV splits [skip azp][skip actions] (mne-tools#10548)
  MRG: Add error checking to prevent the creation of montage with invalid [x, y, z] (mne-tools#10547)
  MRG: Add "verbose" parameter to pick_channels() method (mne-tools#10544)
  CI: Avoid bad PySide6 (mne-tools#10545)
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