combining events with mne-python

Hi,

I have a situation where I would like individual trials to be able to belong to multiple events in the same evoked file. In other words I would like to be able to look at something like

Auditory1 = 1
Auditory2 = 2
AllAuditory =1,2

in the *same* evoked file. This is easy to do with regular mne. Can I also do this with mne-python? I was trying to use the combine_event_ids function for this, but it seems to remove the original two condition codes from the structure so that I'm only left with AllAuditory. I can see that I could create two separate evoked files splitting the data up in different ways, but that would be annoying for my pipeline. I tried to be clever and create doubles of the conditions in my original event_id:

event_id = dict{Auditory1 =1, Auditory1b=1, Auditory 2=2 ...}

and then use the b conditions for combine_event_ids, but I see that fails because even though the Auditory1 conditions nominally remain in the data structure, all their events get deleted (I'm assuming because the event code gets changed).

thanks,
Ellen

Hi Ellen,

if I understand you correctly, your intent is to create averages including both conditions combined but also averages for each of the conditions. In that case just create your epochs with a dict, e.g. dict(aud_l=1, aud_r=2) as event_id parameter.

To have averages of 1, 2 and 1 + 2,
create a list including all three evoked objects and save them to a fiff.

e.g.

evokeds = [epochs[k].average() for k in event_id]

to create the separate evoked objects for each condition and then

evokeds += [epochs.average()]

to append the combined average to the previously created list.

then save the list of evokeds to a file using the mne.fiff.write_evoked function.

Also the following two examples might help:

http://martinos.org/mne/auto_examples/plot_from_raw_to_multiple_epochs_to_evoked.html

http://martinos.org/mne/auto_examples/plot_topo_compare_conditions.html#example-plot-topo-compare-conditions-py

I hope that helps,
Denis

hi Ellen,

with the new patch from Eric :

https://github.com/mne-tools/mne-python/pull/556

you should be able to do:

events = mne.event.merge_events(events, [1, 2], 3, replace_events=False)
event_id = dict(Auditory1 =1, Auditory2=2, AuditoryAll=3)
epochs = Epochs(...)

mne.fiff.write_evoked('auditory-ave.fif',
[epochs['Auditory1'].average(), epochs['Auditory2].average(),
epochs['AuditoryAll'].average()])

HTH
Alex