[Mne_analysis] Mne_analysis Digest, Vol 156, Issue 14

Bruno Mansur brunommansur at gmail.com
Mon Feb 1 08:12:49 EST 2021
Search archives:

        External Email - Use Caution        

Hi Daniel McCloy, thanks a lot for your answer!

As you said I had to to solve this problem writing a function. It's working
now :)

Best regards,

Bruno

Am Sa., 30. Jan. 2021 um 18:02 Uhr schrieb <
mne_analysis-request at nmr.mgh.harvard.edu>:

> Send Mne_analysis mailing list submissions to
>         mne_analysis at nmr.mgh.harvard.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://secure-web.cisco.com/1mKk4hxm3peN3S1A44GP7RZHginKsJ8ILa7R0x9wzuhaUaFWz8FKfIY3Ey8Lz1pL96LuCDbLsDCbmsVvrVQK5DSD_2XjlafTicTeLqhDpGXWc9OiO3MkpDcdsiIGH1bKfyu0UFP2WhpcYYEzocSEvG4bcovH24uqxXvJYQfil5LNox8B7nHEXCB9JuuOIpKTtZc4NgVzb7ZSyFBrFj_W76SY2VYTQpHUdJ4K2hDO0qNQicYFGkjCCgSggxT-PKwcio30zfLDU43CG3UmgHG1I5J_6Z1AHHOxOR4ghGp7dXmU/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Fmne_analysis
> or, via email, send a message with subject or body 'help' to
>         mne_analysis-request at nmr.mgh.harvard.edu
>
> You can reach the person managing the list at
>         mne_analysis-owner at nmr.mgh.harvard.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Mne_analysis digest..."
>
>
> Today's Topics:
>
>    1. Re: Defining Epochs according to event order (Dan McCloy)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 30 Jan 2021 01:55:38 +0000
> From: Dan McCloy <dan at mccloy.info>
> Subject: Re: [Mne_analysis] Defining Epochs according to event order
> To: Discussion and support forum for the users of MNE Software
>         <mne_analysis at nmr.mgh.harvard.edu>
> Message-ID:
>
> <Rhq63DyPRiZOeAU9WZIMvrpYIm6IX1o-QxeUJYaeP33nnoMKNdLoZf06G2viM6hBhxJHNksagxhi1kW7Jz0LsxZH6FRnWiSXmOJZECwzzL0=@
> mccloy.info>
>
> Content-Type: text/plain; charset="utf-8"
>
>         External Email - Use Caution
>
> I don't think there's an easy / built-in way to do this in MNE-Python. Do
> the 3 events always occur in a predictable order? If so, I would write a
> function that takes in the original event array, finds occurrences of the
> "middle" event, looks before and after for the other events, and uses the
> sample numbers (in the first column of the events array) to determine how
> long before/after the middle event the epoch needs to be in order to
> include all 3. Then look across all epochs and pick the minimum "before
> time" and maximum "after time" to yield an epoch duration that is
> guaranteed to include all 3 events for *all* epochs (add some extra
> "padding" time if you want to prevent the events from ending up at the
> edges of the epoch). With those 2 numbers in hand as your `tmin` and
> `tmax`, you can epoch around the middle event and be sure that you'll
> always have the earlier and later event included.
>
> -- dan
> Daniel McCloy
>
> https://secure-web.cisco.com/1xy7_y1owFF9BI53hSPaCLPo6J9PCFvaQUJmvdW9O5AOH83rcGU6LNaZOQgGCCAc6v851U8FXMKiBDJNvKUV3FZu_QxHLOwsWjBaNodv-BX8uwMkGxY3KcPppdckrXuX3OJfXfZnamINvF3pth8kC1NJNRHnO_67KvY-GpJJkzySMWoG6PSDvU7RMwQxzUiO78TeIM5yi_ExQ00I5yLosQxA7th0EWQ6lYaIVNZFtPBRPRKmNmiOjlaZ9iS1zJ_SWtRw4t6OO1WkBCtM0pU6FTA/https%3A%2F%2Fdan.mccloy.info
> Research Scientist
> Institute for Learning and Brain Sciences
> University of Washington
>
> ??????? Original Message ???????
> On Thursday, January 28, 2021 7:21 PM, Bruno Mansur <
> brunommansur at gmail.com> wrote:
>
> > External Email - Use Caution
> >
> > Dear list members,
> >
> > I have the following event dictionary:
> >
> > event_dict = {
> >
> > 'False'
> >
> > :
> >
> > 1
> >
> > ,
> >
> > 'Hit'
> >
> > :
> >
> > 2
> >
> > ,
> >
> > 'MP1'
> >
> > :
> >
> > 3
> >
> > ,
> >
> > 'MP2'
> >
> > :
> >
> > 4
> >
> > ,
> >
> > 'MP3'
> >
> > :
> >
> > 5
> >
> > ,
> >
> > 'M_False'
> >
> > :
> >
> > 6
> >
> > ,
> >
> > 'M_Hit'
> >
> > :
> >
> > 7
> >
> > ,
> >
> > 'OGT'
> >
> > :
> >
> > 8
> >
> > ,
> >
> > 'PMC'
> >
> > :
> >
> > 9
> >
> > ,
> >
> > 'S  4'
> >
> > :
> >
> > 10
> >
> > ,
> >
> > 'actiCAP Data On'
> >
> > :
> >
> > 11
> >
> > ,
> >
> > 'boundary'
> >
> > :
> >
> > 12
> >
> > }
> >
> > and I want to create epochs that contain three events (?Hit?: 2,
> '?M_Hit?: 7, ?OGT?: 8). All three events should be contained in the same
> Epoch.
> >
> > So I first epoch my data passing the entire event_dict:
> >
> > epochs = mne.Epochs(raw_bandpass_ica, events, event_id=event_dict,
> >                     tmin=
> >
> > -0.2
> >
> > , tmax=
> >
> > 6
> >
> > , reject=reject_criteria, preload=
> >
> > True
> >
> > )
> >
> > And then, in order to create my desired epoch, I tried this:
> >
> > OGT = mne.pick_events(events, include=[
> >
> > 8
> >
> > ,
> >
> > 2
> >
> > ,
> >
> > 7
> >
> > ])
> > epochs[
> >
> > 'OGT'
> >
> > ].plot(events=OGT, event_id=event_dict,
> >                    event_color=dict(OGT=
> >
> > 'red'
> >
> > , Hit=
> >
> > 'blue'
> >
> > , M_Hit=
> >
> > 'green'
> >
> > ))
> >
> > However, the output I got was Epochs containing some of the three events
> and not all at the same time.
> >
> > Do you know how could I define Epochs containing concomitant events?
> >
> > I would appreciate any help
> >
> > Best regards,
> >
> > Bruno
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://secure-web.cisco.com/1ttn1ufg9dvrNlTHPiBHMcbXwdvrbrfEzpwHru-h7_NQp8D6zePdUrNyLw4uEJBMB0iz3uqw-o6yuNbME2TH9XpPi0DKogMTZyRPVcmmPKnPf1E3RSMzlQ4B1h9relRQNchU6pdOI5avq2SBzvy-25UBfuNN50VpoLJS-Lrtk_Z72ldi9EHBUasUhdYgUuHJXttaL9XmnBYGFBH2ts-SIYWzFOQu2p1CCX7mOGvvjo3-EIXqy87pXDf5Te4qXSmzA0bCJXgK0dt_G3R74bDB6V6Pbr3CM1Hi87vmsVkm1KGM/http%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fpipermail%2Fmne_analysis%2Fattachments%2F20210130%2F2735a7b5%2Fattachment-0001.html
>
> ------------------------------
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://secure-web.cisco.com/1mKk4hxm3peN3S1A44GP7RZHginKsJ8ILa7R0x9wzuhaUaFWz8FKfIY3Ey8Lz1pL96LuCDbLsDCbmsVvrVQK5DSD_2XjlafTicTeLqhDpGXWc9OiO3MkpDcdsiIGH1bKfyu0UFP2WhpcYYEzocSEvG4bcovH24uqxXvJYQfil5LNox8B7nHEXCB9JuuOIpKTtZc4NgVzb7ZSyFBrFj_W76SY2VYTQpHUdJ4K2hDO0qNQicYFGkjCCgSggxT-PKwcio30zfLDU43CG3UmgHG1I5J_6Z1AHHOxOR4ghGp7dXmU/https%3A%2F%2Fmail.nmr.mgh.harvard.edu%2Fmailman%2Flistinfo%2Fmne_analysis
>
> End of Mne_analysis Digest, Vol 156, Issue 14
> *********************************************
>


-- 
*Bruno de Matos Mansur, M.Sc.*
Neurocybernetics und Rehabilitation
University Hospital Magdeburg
Leipziger Strasse 44, 39120 Magdeburg, Germany
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20210201/6c1a9085/attachment-0001.html 


More information about the Mne_analysis mailing list