You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DSS._fit_mne fell back to the internal NumPy covariance path for Evoked
inputs, because mne.compute_covariance accepts only Epochs and Raw. This
adds a small compute_evoked_covariance helper that treats the averaged
response's time samples as observations and returns a genuine mne.Covariance,
then wires it into the Evoked branch of _fit_mne so the estimation stays
within the MNE ecosystem — consistent with the Raw and Epochs branches.
Changes
mne_denoise/dss/utils/covariance.py: new compute_evoked_covariance. It
wraps the Evoked as a single-trial EpochsArray and defers to mne.compute_covariance with keep_sample_mean=True (so the single average
is not subtracted away). The intentional "not baseline corrected" notice is
suppressed, since DSS uses the raw second-moment covariance.
mne_denoise/dss/linear.py: the Evoked branch builds baseline/biased
covariances through the helper instead of calling _fit_numpy.
Tests: unit tests for the helper (type/shape, second-moment value, guard on
too-few samples) plus a regression test asserting the Evoked fit reproduces compute_dss on the MNE-side covariances.
Thanks for implementing this sina; but I was mainly thinking whether we could make mne-pythonmne.compute_covariance function accepts an evoked object too? that would be the cleanest way of doing it. @drammock@larsoner what do you think of this? I can open the issue on mne-python to make the change; if it is out of scope for mne-python we can work on the changes @snesmaeili suggested.
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
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
DSS._fit_mnefell back to the internal NumPy covariance path forEvokedinputs, because
mne.compute_covarianceaccepts onlyEpochsandRaw. Thisadds a small
compute_evoked_covariancehelper that treats the averagedresponse's time samples as observations and returns a genuine
mne.Covariance,then wires it into the Evoked branch of
_fit_mneso the estimation stayswithin the MNE ecosystem — consistent with the Raw and Epochs branches.
Changes
mne_denoise/dss/utils/covariance.py: newcompute_evoked_covariance. Itwraps the Evoked as a single-trial
EpochsArrayand defers tomne.compute_covariancewithkeep_sample_mean=True(so the single averageis not subtracted away). The intentional "not baseline corrected" notice is
suppressed, since DSS uses the raw second-moment covariance.
mne_denoise/dss/linear.py: the Evoked branch builds baseline/biasedcovariances through the helper instead of calling
_fit_numpy.too-few samples) plus a regression test asserting the Evoked fit reproduces
compute_dsson the MNE-side covariances.Closes #39