[Mne_analysis] combining events with mne-python

Alexandre Gramfort gramfort at nmr.mgh.harvard.edu
Sun Apr 7 03:56:31 EDT 2013
Search archives:

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



On Sun, Apr 7, 2013 at 1:12 AM, Denis-Alexander Engemann
<d.engemann at fz-juelich.de> wrote:
> 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
>
>
> On Sun, Apr 7, 2013 at 12:14 AM, Ellen Lau <ellenlau at nmr.mgh.harvard.edu>
> wrote:
>>
>> 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
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> The information in this e-mail is intended only for the person to whom it
>> is
>> addressed. If you believe this e-mail was sent to you in error and the
>> e-mail
>> contains patient information, please contact the Partners Compliance
>> HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you in
>> error
>> but does not contain patient information, please contact the sender and
>> properly
>> dispose of the e-mail.
>>
>
>
>
> ------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------------------------
> Forschungszentrum Juelich GmbH
> 52425 Juelich
> Sitz der Gesellschaft: Juelich
> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
> Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
> Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
> Prof. Dr. Sebastian M. Schmidt
> ------------------------------------------------------------------------------------------------
> ------------------------------------------------------------------------------------------------
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>



More information about the Mne_analysis mailing list