-
Notifications
You must be signed in to change notification settings - Fork 34
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
Make noisy channel exclusion during Reference compatible with MATLAB PREP #93
Conversation
Codecov Report
@@ Coverage Diff @@
## master #93 +/- ##
==========================================
+ Coverage 98.51% 98.83% +0.31%
==========================================
Files 7 7
Lines 675 687 +12
==========================================
+ Hits 665 679 +14
+ Misses 10 8 -2
Continue to review full report at Codecov.
|
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.
LGTM! Only minor comments for docs
@sappelhoff Okay, I've updated the docs and whats-new, and have addressed your comments. A couple questions before this gets merged:
|
I think that if a parameter is configurable in MatPREP, and it's reasonably easy to make it configurable in PyPrep, then we SHOULD make it possible. These params should always have a reasonable default (like in MatPrep) though. On the other hand, let's not expose more params than MatPrep does (for now), unless we judge it very very important.
🤔 yeah, that sounds off. +1 for an issue about this 1. on pyprep and 2. on matprep. The one for pyprep can be marked to be resolved in version 0.5 --> version 0.4 being targeted more at feature completeness with matprep. If nobody ever reacts to this on matprep, we can do our own, non-matprep-strict thing in pyprep starting with 0.5.
Yes, that's true, good point. What does matprep do here? |
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.
there are three lines in this diff that are not being covered --> is it possible to reasonably do so with little changes/effort? If not, no problem.
Okay, I'll add it to the
Sounds good, will do! Maybe this is a place for some experimentation, but my gut instinct would be to default to only marking initial bad-by-flat and bad-by-NaN channels as fully "unusable". I'd imagine that the original intent was to removing channels that contribute more noise than signal from contaminating the average reference, but given how sensitive the 'bad-by-correlation' default settings are (if over 1% of all correlation windows are below threshold, the whole channel is considered bad) and how that can change after average referencing, I don't think initial bad-by-SNR channels should be treated as permanently bad. Anyway, that can all be discussed in the new issue.
It just ignores dropout channels completely during referencing: only bad-by-flat/NaN/SNR channels are permanently flagged and removed from the average reference at the onset, and due to the likely bug we've reported already they won't get identified or excluded on subsequent iterations either.
The |
Okay, I've made codecov a bit happier now: I covered a line that only gets run if the input signal is completely clean, fixed a bug that prevented a ValueError from getting covered (it was throwing a ValueError earlier, so the test passed but the coverage failed), and worked around a known |
Thanks @a-hurst |
…PREP (#93) * Add "as_dict" option for get_bads * Don't permanently exclude initial bad-by-SNRs * Match PREP's noisy channel updating logic * Minor variable name cleanup * use as_dict throughout reference.py * Fix 'ignore' logic * Add back "bad_all" (whoops) * Update matlab_differences.rst * Add max_iterations args, link to dropout issue * Fix diffs mistake, update whats_new.rst * Add PrepPipeline API for max_iterations * Improve test coverage for Reference * Add whats_new entry for SNR changes * Fix quotes to make black happy * Improve Reference test coverage some more * remove unused import
PR Description
Closes #91. This PR does three main things:
Reference.robust_reference
to stop permanently excluding channels that are flagged as bad-by-SNR prior to initial re-referencing.Reference.robust_reference
to exclude bad-by-dropout channels from the full set of bad channels whenmatlab_strict
isTrue
, matching MatPREP's (likely accidental) behaviour.as_dict
argument toNoisyChannels.get_bads
that returns bad channels by type as a dictionary in order to facilitate the above changes. In addition to being generally useful, it also saves a lot of dict construction inreference.py
.I still need to update the
whats_new.rst
andmatlab_differences.rst
here, but I figured given the time-zone difference that it would be better to get the code up for review before I went to bed. Thanks in advance for checking this over!Merge Checklist
closes #<issue-number>
to automatically close an issue