mne-tools/mne-python — pull request #18 by agramfort (2012-01-23 11:03:49+00:00)
Title: merge of evoked data obtain for example on different raw files

here is a tiny function that allows to concatenate or merge evoked data. It allows you to write stuff like:

>>> epochs1 = mne.Epochs(raw1, events1, event_id, tmin, tmax, picks=picks, baseline=(None, -0.2), reject=reject)
>>> epochs2 = mne.Epochs(raw2, events2, event_id, tmin, tmax, picks=picks, baseline=(None, -0.2), reject=reject)
>>> evoked1 = epochs1.average()
>>> evoked2 = epochs2.average()
>>> evoked = merge_evoked([evoked1, evoked2])

I am however not sure it's the best way to do it.

Any thoughts on how to improve it or make it more generic?

How about:

>>> evoked = evoked1 + evoked2

What would be the most natural way to compute a contrast?

>>> evoked = evoked1 - evoked2

?