[Mne_analysis] 1. Redefine Onset

Dan McCloy dan.mccloy at gmail.com
Mon Nov 4 19:06:52 EST 2019
Search archives:

        External Email - Use Caution        

OK, so tell us what you tried (exact line(s) of code you used), what you
wanted to happen, and what happened instead.

On Mon, Nov 4, 2019 at 3:49 PM Geller, Jason <jason-geller at uiowa.edu> wrote:

>         External Email - Use Caution
>
> Thanks for the quick reply! My epochs are aligned to a specific event
> (onset of audio file). There is 500 ms of silence at the start of each
> file.  What I need is a new time zero that starts at 500 ms. I can provide
> more information, if needed.
>
>
> Jason Geller, Ph.D.
> Postdoctoral Scholar
> The University of Iowa
>
>
> ------------------------------
> *From:* mne_analysis-bounces at nmr.mgh.harvard.edu <
> mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of
> mne_analysis-request at nmr.mgh.harvard.edu <
> mne_analysis-request at nmr.mgh.harvard.edu>
> *Sent:* Monday, November 4, 2019 5:37 PM
> *To:* mne_analysis at nmr.mgh.harvard.edu
> *Subject:* [External] Mne_analysis Digest, Vol 142, Issue 5
>
> 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://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_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: Redefine Onset (Geller, Jason)
>    2. Re: Redefine Onset (Dan McCloy)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 4 Nov 2019 20:36:47 +0000
> From: "Geller, Jason" <jason-geller at uiowa.edu>
> Subject: Re: [Mne_analysis] Redefine Onset
> To: "mne_analysis at nmr.mgh.harvard.edu"
>         <mne_analysis at nmr.mgh.harvard.edu>
> Message-ID: <BEA1BBD3-CC81-45CC-8CE9-9DBF918AC3DC at uiowa.edu>
> Content-Type: text/plain; charset="us-ascii"
>
>         External Email - Use Caution
>
> Hello,
>
> I have an issue where I need to realign the zero point of epochs (there is
> 500 ms of silence at the start of an audio event). Is there an MNE function
> that will allow me to do this? I thought shift_time might get me what I
> need, but it does not.
>
>
>
> > On Nov 4, 2019, at 11:00 AM, mne_analysis-request at nmr.mgh.harvard.edu
> wrote:
> >
> > 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://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_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: How to edit time attribute in a raw object (Eric Larson)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Mon, 4 Nov 2019 09:21:41 -0500
> > From: Eric Larson <larson.eric.d at gmail.com>
> > Subject: Re: [Mne_analysis] How to edit time attribute in a raw object
> > To: Discussion and support forum for the users of MNE Software
> >        <mne_analysis at nmr.mgh.harvard.edu>
> > Message-ID:
> >        <
> CAGu2niUwUAU4ZUGeLYEqKCih1VN1fXBisVecpe0ii4ynrmPb8g at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> >        External Email - Use Caution
> >
> > If the time of recording start is properly encoded in the file and read
> by
> > MNE (which is hopefully the case), then you should be able to use it. You
> > can manually convert from relative (starting from zero) to absolute time
> by
> > looking at `raw.info['meas_date']` and `raw.first_samp`. But the eaiser
> > thing to do would be to construct an Annotations
> > <https://mne.tools/stable/generated/mne.Annotations.html> class with
> your
> > behavioral/pupil events (in whatever starting time frame you prefer),
> then
> > set `raw.annotations = my_annotations`, which should convert it to the
> raw
> > object's time reference in `raw.info['meas_date']`. Check out the
> > Annotations tutorials -- such as this one
> > <
> https://mne.tools/dev/auto_tutorials/raw/plot_30_annotate_raw.html#creating-annotations-programmatically
> >
> > -- and if it's not clear from them how to do it, we should improve the
> > documentation.
> >
> > We do not allow modifying the `raw.times` attribute intentionally. A lot
> of
> > downstream code (e.g., epoching) would break, loudly or (worse) silently,
> > in unexpected and unpredictable if users could do this.
> >
> > Eric
> >
> >
> > On Mon, Nov 4, 2019 at 6:03 AM vahid.bokharaie at tuebingen.mpg.de <
> > vahid.bokharaie at tuebingen.mpg.de> wrote:
> >
> >>        External Email - Use Caution
> >>
> >> Hi Philip
> >> Thanks for your sharp response. It calarified the situation for me.
> >> And to answer to your question, for rat EEG, we record behavioural data
> in
> >> a go/no-go task, pupil diameters and EEG. I define Events based on
> >> behavioural and pupil size, and then should convert them into proper
> format
> >> to be read in mne. So it is important that time stamps match. Of course
> >> this is something that can be handled easily, but I could not believe
> such
> >> a simple feature is not incorporated into mne. Hence spent too much time
> >> trying to find the right function.
> >> Regards,
> >> Vahid
> >>
> >>
> >> -------- Original Message --------
> >> Subject: Re: [Mne_analysis] How to edit time attribute in a raw object
> >> From: Phillip Alday
> >> To: Discussion and support forum for the users of MNE Software ,Vahid
> >> Bokharaie
> >> CC:
> >>
> >>
> >> The time in the raw recordings (the Raw object) are assumed to be
> >> arbitrary and just a measure of time elapsed since the beginning of the
> >> recording, so there's not really a way to set or manipulate them. Why do
> >> you need absolute time here? Are you concatenating Raw objects?
> >>
> >> Best,
> >> Phillip
> >>
> >> On 4/11/19 10:55 am, Vahid Bokharaie wrote:
> >>>        External Email - Use Caution
> >>>
> >>> Hi all
> >>> I posted this question in stackoverflow but seems MNE community is not
> >>> active there, hence I searched for MNE mailing list and joined it.
> >>> I use MNE for analysis of both rat and human EEG recordings. The system
> >>> we have for rat EEG is from a company called NeuroNexus, and they have
> >>> their own Matlab script to convert the EEG recordings and the time
> >>> stamps into mat files. And then I import them in python and use MNE to
> >>> analyse and visualise them. This means I have to establish my EEG raw
> >>> objects from the scratch and save them to file, which I can do. But a
> >>> seemingly trivial thing that I have not managed to find out how to do
> is
> >>> to incorporate the time array into the EEG raw object. When I create
> and
> >>> save the EEG raw object, it automatically set the initial time to 0,
> but
> >>> my initial recording time is not 0 and I need to offset that. It is
> >>> important to correct this, because the time stamps of EEG and
> >>> behavioural data should match.
> >>> Simply typing |raw.times = new_array| leads to |AttributeError: can't
> >>> set attribute. ||This should be a very simple thing to do, but I have
> >>> not been able to find it although I have looked into the documentation.
> >>> So, I thought to ask it in here and if it is not really possible, then
> >>> dig into the source code to fix it myself. Thanks in advance.
> >>> Regards,
> >>> Vahid
> >>> |
> >>>
> >>> --
> >>>
> >>
> ---------------------------------------------------------------------------------------
> >>> Vahid S. Bokharaie, PhD
> >>> Senior Research Scientist
> >>> Max Planck Institute for Biological Cybernetics
> >>> Department of Physiology of Cognitive Processes
> >>> Max Planck Ring 8, 72076 Tuebingen, Germany
> >>> +49 (0)7071 - 601-1644
> >>> vahid.bokharaie at tuebingen.mpg.de
> >>> https://www.kyb.tuebingen.mpg.de/person/59086/84548
> >>>
> >>
> --------------------------------------------------------------------------------------
> >>>
> >>>
> >>> _______________________________________________
> >>> Mne_analysis mailing list
> >>> Mne_analysis at nmr.mgh.harvard.edu
> >>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >>>
> >>
> >> _______________________________________________
> >> 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/20191104/909850d3/attachment-0001.html
> >
> > ------------------------------
> >
> > _______________________________________________
> > Mne_analysis mailing list
> > Mne_analysis at nmr.mgh.harvard.edu
> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> >
> > End of Mne_analysis Digest, Vol 142, Issue 4
> > ********************************************
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 4 Nov 2019 15:36:28 -0800
> From: Dan McCloy <dan.mccloy at gmail.com>
> Subject: Re: [Mne_analysis] Redefine Onset
> To: Discussion and support forum for the users of MNE Software
>         <mne_analysis at nmr.mgh.harvard.edu>
> Message-ID:
>         <
> CAOE0pYkNMYVb63URz1b5wR7m1BfRS_RDB81aCeDKAWTqhk6Gwg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
>         External Email - Use Caution
>
> Do you mean that you created epochs, but now you want the epochs to include
> different samples (i.e., start earlier and/or end later)?  If so, you have
> to go back to the Raw data and re-do epoching with different tmin/tmax
> values.
>
> Or do you mean that the *data* in the epochs is what you want, but you just
> want to change the *time labels* associated with each sample?  If so,
> `epochs.shift_time()` should do what you want; please say more about why it
> does not get you what you need.  Note that behavior of `shift_time` is
> currently being changed in the development version of MNE-Python;
> previously time shifts were forced to be integer multiples of the sampling
> period, but soon (as soon as
> https://github.com/mne-tools/mne-python/pull/6996 gets merged) it will be
> possible on the development version to shift by any arbitrary amount of
> time.
>
>
> On Mon, Nov 4, 2019 at 12:37 PM Geller, Jason <jason-geller at uiowa.edu>
> wrote:
>
> >         External Email - Use Caution
> >
> > Hello,
> >
> > I have an issue where I need to realign the zero point of epochs (there
> is
> > 500 ms of silence at the start of an audio event). Is there an MNE
> function
> > that will allow me to do this? I thought shift_time might get me what I
> > need, but it does not.
> >
> >
> >
> > > On Nov 4, 2019, at 11:00 AM, mne_analysis-request at nmr.mgh.harvard.edu
> > wrote:
> > >
> > > 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://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_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: How to edit time attribute in a raw object (Eric Larson)
> > >
> > >
> > > ----------------------------------------------------------------------
> > >
> > > Message: 1
> > > Date: Mon, 4 Nov 2019 09:21:41 -0500
> > > From: Eric Larson <larson.eric.d at gmail.com>
> > > Subject: Re: [Mne_analysis] How to edit time attribute in a raw object
> > > To: Discussion and support forum for the users of MNE Software
> > >       <mne_analysis at nmr.mgh.harvard.edu>
> > > Message-ID:
> > >       <
> > CAGu2niUwUAU4ZUGeLYEqKCih1VN1fXBisVecpe0ii4ynrmPb8g at mail.gmail.com>
> > > Content-Type: text/plain; charset="utf-8"
> > >
> > >        External Email - Use Caution
> > >
> > > If the time of recording start is properly encoded in the file and read
> > by
> > > MNE (which is hopefully the case), then you should be able to use it.
> You
> > > can manually convert from relative (starting from zero) to absolute
> time
> > by
> > > looking at `raw.info['meas_date']` and `raw.first_samp`. But the
> eaiser
> > > thing to do would be to construct an Annotations
> > > <https://mne.tools/stable/generated/mne.Annotations.html> class with
> > your
> > > behavioral/pupil events (in whatever starting time frame you prefer),
> > then
> > > set `raw.annotations = my_annotations`, which should convert it to the
> > raw
> > > object's time reference in `raw.info['meas_date']`. Check out the
> > > Annotations tutorials -- such as this one
> > > <
> >
> https://mne.tools/dev/auto_tutorials/raw/plot_30_annotate_raw.html#creating-annotations-programmatically
> > >
> > > -- and if it's not clear from them how to do it, we should improve the
> > > documentation.
> > >
> > > We do not allow modifying the `raw.times` attribute intentionally. A
> lot
> > of
> > > downstream code (e.g., epoching) would break, loudly or (worse)
> silently,
> > > in unexpected and unpredictable if users could do this.
> > >
> > > Eric
> > >
> > >
> > > On Mon, Nov 4, 2019 at 6:03 AM vahid.bokharaie at tuebingen.mpg.de <
> > > vahid.bokharaie at tuebingen.mpg.de> wrote:
> > >
> > >>        External Email - Use Caution
> > >>
> > >> Hi Philip
> > >> Thanks for your sharp response. It calarified the situation for me.
> > >> And to answer to your question, for rat EEG, we record behavioural
> data
> > in
> > >> a go/no-go task, pupil diameters and EEG. I define Events based on
> > >> behavioural and pupil size, and then should convert them into proper
> > format
> > >> to be read in mne. So it is important that time stamps match. Of
> course
> > >> this is something that can be handled easily, but I could not believe
> > such
> > >> a simple feature is not incorporated into mne. Hence spent too much
> time
> > >> trying to find the right function.
> > >> Regards,
> > >> Vahid
> > >>
> > >>
> > >> -------- Original Message --------
> > >> Subject: Re: [Mne_analysis] How to edit time attribute in a raw object
> > >> From: Phillip Alday
> > >> To: Discussion and support forum for the users of MNE Software ,Vahid
> > >> Bokharaie
> > >> CC:
> > >>
> > >>
> > >> The time in the raw recordings (the Raw object) are assumed to be
> > >> arbitrary and just a measure of time elapsed since the beginning of
> the
> > >> recording, so there's not really a way to set or manipulate them. Why
> do
> > >> you need absolute time here? Are you concatenating Raw objects?
> > >>
> > >> Best,
> > >> Phillip
> > >>
> > >> On 4/11/19 10:55 am, Vahid Bokharaie wrote:
> > >>>        External Email - Use Caution
> > >>>
> > >>> Hi all
> > >>> I posted this question in stackoverflow but seems MNE community is
> not
> > >>> active there, hence I searched for MNE mailing list and joined it.
> > >>> I use MNE for analysis of both rat and human EEG recordings. The
> system
> > >>> we have for rat EEG is from a company called NeuroNexus, and they
> have
> > >>> their own Matlab script to convert the EEG recordings and the time
> > >>> stamps into mat files. And then I import them in python and use MNE
> to
> > >>> analyse and visualise them. This means I have to establish my EEG raw
> > >>> objects from the scratch and save them to file, which I can do. But a
> > >>> seemingly trivial thing that I have not managed to find out how to do
> > is
> > >>> to incorporate the time array into the EEG raw object. When I create
> > and
> > >>> save the EEG raw object, it automatically set the initial time to 0,
> > but
> > >>> my initial recording time is not 0 and I need to offset that. It is
> > >>> important to correct this, because the time stamps of EEG and
> > >>> behavioural data should match.
> > >>> Simply typing |raw.times = new_array| leads to |AttributeError: can't
> > >>> set attribute. ||This should be a very simple thing to do, but I have
> > >>> not been able to find it although I have looked into the
> documentation.
> > >>> So, I thought to ask it in here and if it is not really possible,
> then
> > >>> dig into the source code to fix it myself. Thanks in advance.
> > >>> Regards,
> > >>> Vahid
> > >>> |
> > >>>
> > >>> --
> > >>>
> > >>
> >
> ---------------------------------------------------------------------------------------
> > >>> Vahid S. Bokharaie, PhD
> > >>> Senior Research Scientist
> > >>> Max Planck Institute for Biological Cybernetics
> > >>> Department of Physiology of Cognitive Processes
> > >>> Max Planck Ring 8, 72076 Tuebingen, Germany
> > >>> +49 (0)7071 - 601-1644
> > >>> vahid.bokharaie at tuebingen.mpg.de
> > >>> https://www.kyb.tuebingen.mpg.de/person/59086/84548
> > >>>
> > >>
> >
> --------------------------------------------------------------------------------------
> > >>>
> > >>>
> > >>> _______________________________________________
> > >>> Mne_analysis mailing list
> > >>> Mne_analysis at nmr.mgh.harvard.edu
> > >>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > >>>
> > >>
> > >> _______________________________________________
> > >> 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/20191104/909850d3/attachment-0001.html
> > >
> > > ------------------------------
> > >
> > > _______________________________________________
> > > Mne_analysis mailing list
> > > Mne_analysis at nmr.mgh.harvard.edu
> > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
> > >
> > > End of Mne_analysis Digest, Vol 142, Issue 4
> > > ********************************************
> >
> >
> >
> > _______________________________________________
> > 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/20191104/a0c9f388/attachment.html
>
> ------------------------------
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
> End of Mne_analysis Digest, Vol 142, Issue 5
> ********************************************
> _______________________________________________
> 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/20191104/d7f9cef0/attachment-0001.html 


More information about the Mne_analysis mailing list