BUG: mne.set_bipolar_reference function to account for bad channels#11245
Merged
agramfort merged 15 commits intomne-tools:mainfrom Oct 16, 2022
moritz-gerster:handle_bads
Merged
BUG: mne.set_bipolar_reference function to account for bad channels#11245agramfort merged 15 commits intomne-tools:mainfrom moritz-gerster:handle_bads
agramfort merged 15 commits intomne-tools:mainfrom
moritz-gerster:handle_bads
Conversation
Member
|
Test failures look real and indicative of some problem |
Contributor
Author
|
We tried everything to get as many tests pass as possible but some are still failing. @larsoner do you have some tips for us? |
Member
|
Locally if I |
Contributor
Author
@larsoner sure, but I think I checked this box already? |
larsoner
reviewed
Oct 15, 2022
agramfort
approved these changes
Oct 16, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Reference issue
Fixes #11243.
What does this implement/fix?
When setting the bipolar reference between one good and one bad channel, the final bipolar channel is currently marked as good.
Bad channels are marked as bad because they contain artifacts. The bipolar reference between a bad channel and a good channel can never yield a good channel as a result. Therefore, the resulting bipolar channels should be marked as bad by mne.
Scenarios
Let us assume we have anode = ['Fc5.'] and cathode=['Fc3.'] and we want to create the bipolar channel ['Fc5.-Fc3.']. However, in our example ['Fc5.'] is marked as a bad channel. Currently, the resulting bipolar channel ['Fc5.-Fc3.'] is returned as a good channel. With our fix:
Scenarios
on_bad="warn"(default):set_bipolar_reference(raw, anode, cathode, ch_name=bipolar_chname, on_bad="warn")RuntimeWarning: Bipolar channels are based on bad channels: ['Fc5.-Fc3.'].
on_bad="raise":set_bipolar_reference(raw, anode, cathode, ch_name=bipolar_chname, on_bad="raise")ValueError: Bipolar channels are based on bad channels: ['Fc5.-Fc3.'].
on_bad="ignore":set_bipolar_reference(raw, anode, cathode, ch_name=bipolar_chname, on_bad="ignore")Added the following bipolar channels:
Fc5.-Fc3.
Result
If
on_badis "raise" or "warn", the bipolar channel ['Fc5.-Fc3.'] will be marked as bad.