-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Adding get_montage for montage to BaseRaw objects #7667
Conversation
@agramfort lmk if you think there's any issues still?
I used both the: FYI some issues w/ montage ordering?
|
Codecov Report
@@ Coverage Diff @@
## master #7667 +/- ##
==========================================
+ Coverage 90.36% 90.37% +0.01%
==========================================
Files 455 455
Lines 84722 84780 +58
Branches 13425 13433 +8
==========================================
+ Hits 76557 76621 +64
+ Misses 5309 5300 -9
- Partials 2856 2859 +3 |
@adam2392 can you see why CIs complain? I'll review when it's green. thanks |
9e1f515
to
49ba876
Compare
Sorry I totally dropped the ball on this, but will ping you when the CIs pass. Doing a check rn. |
cb15b7b
to
413da50
Compare
Okay I just fixed the codecov issue and now I think that once CI is green this is good to go assuming the changes I made addressed your comments sufficiently. (i.e. using the test dataset) |
a9742d1
to
70122f5
Compare
204d5b1
to
2cff166
Compare
I woudl suggest we limit this PR to get_montage that returns channels that it make sense to use in set_montage (EEG, seeg, ecog, fnirs). I would leave the MEG out of this. |
Sorry for the stupid questions (mne-python codebase is still a big one for me to understand), but... does what I have rn meet that? Since @larsoner suggested I just drop the orientations, I don't think I am doing it anymore(?) Or do I have to add an explicit picks somewhere in the |
I think the idea is to get rid of |
I think the idea is to get rid of get_ch_positions entirely and just have get_montage which returns positions only for the same set of channels that set_montage can set (EEG, sEEG, ECoG, not sure about fNIRS...)
+1
|
Okay got rid of |
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.
I am really not sure why tests are so complicated.
I would read in the testing fif file. do a get_montage and set_montage and assert with objecf_diff that chs and dig are the same.
I would then do a set_montage to an EEG file without montage and then do a get_montage and assert it's also consistent with object_diff
Not sure why the round trip for this test dataset is failing: I get a mismatch say for example:
So I'm not sure if that's coming from the fact that there is a orientation change due to I pushed up the changes so you can see locally. Sorry for the print statements in comments. I'll axe those when this is sorted out. |
For EEG, first three entries in |
Co-authored-by: Eric Larson <[email protected]>
Co-authored-by: Alexandre Gramfort <[email protected]>
88ae1d1
to
119c1ec
Compare
Got it working by adding a "sorting" algorithm applied to the |
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.
@larsoner merge if you're happy
Thanks @adam2392 ! |
* upstream/master: (489 commits) MRG, DOC: Fix ICA docstring, add whitening (mne-tools#8227) MRG: Extract measurement date and age for NIRX files (mne-tools#7891) Nihon Kohden EEG file reader WIP (mne-tools#6017) BUG: Fix scaling for src_mri_t in coreg (mne-tools#8223) MRG: Set pyvista as default 3d backend (mne-tools#8220) MRG: Recreate our helmet graphic (mne-tools#8116) [MRG] Adding get_montage for montage to BaseRaw objects (mne-tools#7667) ENH: Allow setting tqdm backend (mne-tools#8177) [MRG, IO] Persyst reader into Raw object (mne-tools#8176) MRG, BUG: Fix errors in IO/loading/projectors (mne-tools#8210) MAINT: vectorize _read_annotations_edf (mne-tools#8214) FIX : events_from_annotation when annotations.orig_time is None and f… (mne-tools#8209) FIX: do not project to sphere; DOC - explain how to get EEGLAB-like topoplots (mne-tools#7455) [MRG, DOC] Added linear algebra of transform to doc (mne-tools#7087) FIX: Travis failure on python3.8.1 (mne-tools#8207) BF: String formatting in exception message (mne-tools#8206) BUG: Fix STC limit bug (mne-tools#8202) MRG, DOC: fix ica tutorial (mne-tools#8175) CSP component order selection (mne-tools#8151) MRG, ENH: Add on_missing to plot_events (mne-tools#8198) ...
* Adding additional containsmixin for montage and ch pos. * Removing unnecessary code. * Adding up fixes for comments from agram. * Adding updated. * Adding updated test montage. * Adding updated docstring. * Adding updated docstring. * Adding change log. * Adding get_montage doc. * Fixing pydoc. * Update mne/channels/channels.py Co-authored-by: Alexandre Gramfort <[email protected]> * Wip. * Adding unit tests for ch positions. * Coord frame from chs. * Adding the documentation. * Deleting script. * Removing diff. * Fix flake8. * Fixing unit test for codecov. * Update mne/channels/channels.py Co-authored-by: Eric Larson <[email protected]> * Adding updated digitatization. * Adding updated digitatization. * Adding channels. * FIX: Ref * Fixing unit tests. * Removing get_ch_positions. * Fix latest. * trying. * Merging. * Update mne/channels/tests/test_montage.py Co-authored-by: Alexandre Gramfort <[email protected]> * Fixing reference location. * Fixing reference location. * Merging. * Show test montage breaks. * Adding updated unit tests. * Adding updated montage. * Fixing order. * Fixing unit tests for fieldtrip. * Fixing unit tests for fieldtrip. * Adding fix. Co-authored-by: Alexandre Gramfort <[email protected]> Co-authored-by: Eric Larson <[email protected]>
Reference issue
Fixes: #7652
What does this implement/fix?
Adds
get_montage()
andget_ch_positions
forContainsMixin
mixin class, which can be used by all instances to get the montage or channel positions.