ENH: Multi-channel Wiener filter (MWF) native denoiser - #51
Draft
snesmaeili wants to merge 4 commits into
Draft
Conversation
snesmaeili
force-pushed
the
feature/native-mwf
branch
from
July 2, 2026 10:40
f08c95c to
ef3febd
Compare
Add mne_denoise.mwf with MWF (BaseEstimator/TransformerMixin) plus compute_mwf, mwf_filter, and hf_power_mask. MWF is a generic reference-free spatial cleaner and the RELAX-pipeline core (Somers, Francart & Bertrand 2018): it recovers the clean signal via R_clean @ inv(R_artifact) @ X from artifact-free and artifact-present segment covariances, with artifact segments marked by broadband HF power (or a supplied mask). fit() learns the Wiener operator, transform() applies it (leakage-safe); accepts MNE Raw/Epochs (sfreq from info) or NumPy arrays. Documented as a general cleaner (can attenuate neural HF activity), not an artifact-specific method. Edge cases handled: cap the HF-mask smoothing window at the signal length (numpy convolve mode=same otherwise yields a mask longer than short recordings/epochs); guard single-channel input; coerce int 0/1 masks to bool. Includes unit tests (tests/test_mwf.py) and docs (docs/mwf.md, api/index).
snesmaeili
force-pushed
the
feature/native-mwf
branch
from
August 1, 2026 02:41
ef3febd to
1b129e1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
+ Coverage 96.08% 96.11% +0.03%
==========================================
Files 65 67 +2
Lines 8170 8448 +278
Branches 1420 1473 +53
==========================================
+ Hits 7850 8120 +270
- Misses 152 157 +5
- Partials 168 171 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
snesmaeili
marked this pull request as draft
August 1, 2026 08:40
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.
Summary
Rebases PR #51 onto current
mainand hardens the new multi-channel Wiener filter around an explicit, evidence-aware contract.MultichannelWienerFilter;MWFremains a documented short alias.poseig-style positive-rank default, full/integer rank controls, artifact weighting (mu), and relative covariance loading.mask_strategy=hf_poweropt-in and is documented as an unvalidated mask-authoring heuristic, not part of core MWF.fit()freezes the learned spatial operator andtransform()never re-estimates a mask or covariance on evaluation data.Evidence boundary
This implementation follows the authors' public MATLAB equations and locks internal invariants such as full-rank covariance-ratio equivalence and common-unit rescaling. It does not yet claim external numerical parity with the MATLAB toolbox or validated performance for a particular acquisition regime. The authors' delay-embedded extension is also not included; this PR implements the zero-delay method only.
Primary references:
Tests and documentation
-W --keep-going) passes with gallery execution disabled for the local documentation check.The full cross-platform/package matrix remains delegated to this PR's GitHub Actions checks.