[Mne_analysis] Creating events with varying durations manually

Dan McCloy dan.mccloy at gmail.com
Wed Aug 28 19:03:47 EDT 2019
Search archives:

        External Email - Use Caution        

Hi Marianna,

To expand a little on Clemens's answer:  In MNE-Python, Epochs have to have
the same length; there is no way around that.  If you want to make Epochs
from variable duration spans, you either need to make all spans the same
length by padding the shorter ones with extra context before and/or after
them, or you need to cut the spans into shorter pieces that are all the
same length (potentially discarding leftover bits when your spans aren't
evenly divided by your chunk length). That said, depending on your analysis
goals, you may not actually need to create an Epochs object. For example,
you could instead extract variable length spans from the raw recording, and
analyze each one using the analysis tools available for Raw objects.

Regardless of what you decide to do, Clemens is right that the first step
is probably to annotate the Raw data with (variable-length) annotations.
The development version of the MNE-Python documentation has a few new or
updated tutorials that talk about events and annotations in detail; I've
provided links to those below.  Those tutorials are tested against the
"latest master" development version of MNE-Python so there's a chance that
they might include one or two commands that don't work in version 0.18, but
I think for the most part the annotations functionality has not changed
since version 0.18 was released so hopefully the tutorials are helpful to
you.

https://mne.tools/dev/auto_tutorials/intro/plot_20_events_from_raw.html
(see esp. section on multiple events per annotation)
https://mne.tools/dev/auto_tutorials/raw/plot_20_event_arrays.html (see
esp. section on equally-spaced event arrays)
https://mne.tools/dev/auto_tutorials/raw/plot_30_annotate_raw.html

-- dan

Daniel McCloy
http://dan.mccloy.info/
Research Engineer
Institute for Learning and Brain Sciences
University of Washington


On Wed, Aug 28, 2019 at 12:12 PM Brunner, Clemens (
clemens.brunner at uni-graz.at) <clemens.brunner at uni-graz.at> wrote:

>         External Email - Use Caution
>
> Hi!
>
> You can create annotations using the given onsets and offsets (which you
> translate into durations) using raw.set_annotations().
>
> Clemens
>
>
> -----Original Message-----
> From: mne_analysis-bounces at nmr.mgh.harvard.edu <
> mne_analysis-bounces at nmr.mgh.harvard.edu> On Behalf Of Marianna Schmidt
> Sent: Wednesday, August 28, 2019 12:50
> To: mne_analysis at nmr.mgh.harvard.edu
> Subject: [Mne_analysis] Creating events with varying durations manually
>
>         External Email - Use Caution
>
> Hai,
>
> Thanks for response.
>
> Our data is pertaining to epileptic seizures. We just have the onset and
> offset of inter-ictal events. Each of the inter-ictal events have different
> duration. We are trying to create the epoch for inter-ictal events.
> How to create the event file in that case? (In our data there is no STIM
> channels). Is that we have to create the numpy array manually?
>
> Thank you
>
>
> _______________________________________________
> 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/20190828/2df17e72/attachment-0001.html 


More information about the Mne_analysis mailing list