Skip to content

with weights = 'equal', mne.combine_evoked computes sum, not mean #7865

@SophieHerbst

Description

@SophieHerbst

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:

naves = np.array([evk.nave for evk in all_evoked], float)
  if isinstance(weights, str):
      _check_option('weights', weights, ['nave', 'equal'])
      if weights == 'nave':
          weights = naves / naves.sum()
      else:
          weights = np.ones_like(naves)
  else:
      weights = np.array(weights, float)

Shouldn't it be
weights = np.ones_like(naves) / len(all_evoked)
instead of
weights = np.ones_like(naves) ?

The documentation says

The weights to apply to the data of each evoked instance. Can also be 'nave' to weight according to evoked.nave, or "equal" to use equal weighting (each weighted as 1/N).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions