-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
with weights = 'equal', mne.combine_evoked computes sum, not mean #7865
Comments
@drammock @jasmainak thoughts? |
a quick glance suggests that the code and documentation do not match. I'll look more closely later today. |
Besides the mismatch, I think the sum is difficult to interpret, because the amplitude depends on the number of evokeds that one tries to combine. |
There is definitely something wrong here. If I recall correctly the discussion among myself, @jasmainak, @jona-sassenhagen, and @agramfort, it was decided that |
The problem is that if you do: combine_evoked([evoked1, -evoked2], 'equal') vs combine_evoked([evoked1, evoked2], 'equal') they should do the same thing but with sign flipped. If you want to do a proper average, you should use weights='nave'. |
I see your point now @jasmainak, but that didn't become clear to me from the documentation. |
humm ... how would you suggest we improve the wording?
you can still do this with: combine_evoked([evoked1, evoked2], [0.5, 0.5])
I think EEG people tend to do this |
it seems to me like the definitive question here is "what is a more common use case: equally-weighted sum, or equally-weighted average?" Both are possible, it's a question of which we want to make easy for users with a string argument to
Therefore I'm preparing a PR to make the code align with the docstring for |
Following up on a strange variation in the scale of my evokeds, I realized that
mne.combine_evoked computes the sum, rather than the mean when weights = 'equal'
(mne version: '0.21.dev0'):
evoked.py, line 876:
Shouldn't it be
weights = np.ones_like(naves) / len(all_evoked)
instead of
weights = np.ones_like(naves)
?The documentation says
The text was updated successfully, but these errors were encountered: