Selecting a subset of epochs

Hi all,

I have raw MEG data that contains responses to four different conditions,
120 responses to each condition. The epochs of certain condition can be
extracted by giving event_id as an argument to mne.Epochs. However, I would
need a file containing a subset of 40 epochs per condition (i.e. 160 epochs
in total). The epochs should be selected randomly. I wonder if there is
some way to do this with mne Python?

Thank you very much,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141005/91c0d4c1/attachment.html

hi Maria,

to balance the number of epochs in each condition you can use the
equalize_event_counts method.

epochs.equalize_event_counts(...)

otherwise you can index epochs with integers.

epochs[[1, 4, 5]] will return a new set of 3 epochs.

HTH
Alex

Many thanks Alex!
I just tested and this seems to work!

-Maria

2014-10-05 18:54 GMT+03:00 Alexandre Gramfort <
alexandre.gramfort at telecom-paristech.fr>:

hi Maria,

to balance the number of epochs in each condition you can use the
equalize_event_counts method.

epochs.equalize_event_counts(...)

otherwise you can index epochs with integers.

epochs[[1, 4, 5]] will return a new set of 3 epochs.

HTH
Alex

> Hi all,
>
> I have raw MEG data that contains responses to four different conditions,
> 120 responses to each condition. The epochs of certain condition can be
> extracted by giving event_id as an argument to mne.Epochs. However, I
would
> need a file containing a subset of 40 epochs per condition (i.e. 160
epochs
> in total). The epochs should be selected randomly. I wonder if there is
some
> way to do this with mne Python?
>
> Thank you very much,
> Maria
>
> _______________________________________________
> 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.
>
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141005/01433bff/attachment.html