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

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

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