-
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
MRG: Add support for NIRS to plot_topomap #7063
Conversation
The images display correctly but the code is throws the error... RuntimeWarning: Channel names are not unique, found duplicates for: {'S1', 'S4', 'S5', 'S7', 'S3', 'S8', 'S6', 'S2'}. Applying running numbers for duplicates. |
Codecov Report
@@ Coverage Diff @@
## master #7063 +/- ##
==========================================
- Coverage 89.74% 89.74% -0.01%
==========================================
Files 442 442
Lines 77786 77788 +2
Branches 12620 12621 +1
==========================================
Hits 69808 69808
- Misses 5169 5170 +1
- Partials 2809 2810 +1 |
There is some difference in how the positions are plotted in the topomap vs sensor inset. The inset has the correct looking locations, but the topoplot seems to expand everything out to fill the head. @larsoner is this a known issue? Does it seem NIRS specific? Should I try and address it here? |
yes it's a known issue and we really need to take a stab at it :(
… |
(but not as part of this PR, don't worry about it here) |
Co-Authored-By: Eric Larson <larson.eric.d@gmail.com>
@larsoner and @agramfort this PR is ready for review. Thanks |
mne/viz/topomap.py
Outdated
# The naming for nirs is very specific and should not be modified | ||
clean_ch_names = info['ch_names'] | ||
else: | ||
clean_ch_names = _clean_names(info['ch_names']) |
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.
_clean_names is used in a number of places. I would rather avoid the branching here to make sure it's consistent with other places. How specific are NIRS channel names? What ch name breaks it?
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.
The name given by the device manufacturer is in the format of source number then detector number, so for example “S1 D2” is the channel between source one and detector two. We then appended the light frequency or chomaphore. So currently the MNE channel names are in the format S1 D2 760
.
The problem was that the spaces were getting removed and the first characters were being kept, so we would have several channel names that were modified to be “S1” for example (because source one may have channels to several detectors). And that caused the error listed in the first comment of this PR.
But we can change the way channel names are stored. We could make it S1-D2-760
Or S1D2-760
etc. I think this would solve the problem, but not sure if it will break other things. What do you think?
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 that’s wrong, the format is currently S1-D2 760
. Another example is S12-D3 850
https://github.com/mne-tools/mne-python/blob/master/mne/io/nirx/tests/test_nirx.py#L37
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.
Ok I have push an attempt to change the naming to S1_D3 760
. This way the source-detector pair is read as a single word, so stays unique without modifying clean_names. The raw.plot doesnt look as good, but I think thats ok. Thoughts?
@larsoner & @agramfort this is ready for another round of review. Thanks |
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.
besides these redundant computations LGTM
@rob-luke you have a conflict, can you rebase? |
Example looks good, +1 for merge after conflict resolution |
Resolved via merge commit, will merge once CIs come back happy |
Thanks @rob-luke |
Reference issue
Addresses issue #7057
What does this implement/fix?
Enables plotting of topomaps for NIRS data, specifically hbo and hbr signals.