Repository navigation
Detect dropouts below 1e-15 V instead of requiring an exact zero - #218
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
=======================================
Coverage 98.08% 98.08%
=======================================
Files 8 8
Lines 886 890 +4
=======================================
+ Hits 869 873 +4
Misses 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sappelhoff
force-pushed
the
dropout-tolerance
branch
from
October 27, 2026 20:10
003629e to
bd6a039
Compare
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.
Stacked on #217 (contains its commits; review the last commit, or merge #217 first and this will show only its own change).
Why
find_bad_by_correlationcounts a window as a dropout only if the MAD of the filtered signal is exactly0. Any filtering before or insideNoisyChannelsleaves residue in a flat stretch:do_detrend=Truehigh-pass alone: ~1e-21 V; only ~9 of ~30 dropout windows stayed exactly zero in a synthetic test,NoisyChannels: up to ~3e-15 V, 0 windows exactly zero, sobad_by_dropoutnever triggers.The existing
test_bad_by_dropoutpasses only because it usesdo_detrend=False.What
1e-15V, the same value as the defaultflat_thresholdoffind_bad_by_nan_flat. Signal MAD in EEG is ~1e-6 V, so the margin is about nine orders of magnitude.matlab_strict=Truekeeps the exact-zero criterion.Measured on synthetic data (30 s dropout, 1 Hz HP + 100 Hz LP + 50/100/150 Hz notch, DC offsets 0–300 mV): 16–20 of 28 dropout windows flagged (windows at the dropout edges contain filter ringing and are not flagged), i.e. far above the default
frac_bad=0.01.Tests
do_detrend=True(fails onmain).main) but not withmatlab_strict=True.Full suite: 71 passed (including the MATLAB comparison tests); pre-commit clean; docs build clean with
-W.