Tutorial 15: Import epochs

Authors: Francois Tadel, Elizabeth Bock, Sylvain Baillet

We can consider that our datasets are clean from any major artifact. We will now proceed to the analysis of the brain signals we recorded in response to the auditory stimulation. There are two major types of processing workflows for MEG/EEG, depending on whether we are dealing with an event-related paradigm or a steady-state/resting-state study.

This tutorial will only focus on the event-related case: series of stimuli are sent to the subject and we have the corresponding triggers marked in the recordings. We will base our analysis on these triggers, import short epochs around each of them and average them. You will find in the advanced tutorials a scenario of MEG resting-state analysis.

Import in database

Until now, we've only been looking at data that was read from continuous files. The raw file viewer provides rapid access to the recordings, but many operations can only be applied to short segments of recordings that have been imported in the database. We will refer to these as "epochs" or "trials".

One new folder appears in Subject01. It contains a channel file and two trial groups.

Review the individual trials

After reviewing the continuous file with the "columns" view (channels one below the other) it can be useful to also review the imported trials with the "butterfly" view (all the channels superimposed).

To manually tag a trial as bad, you have three options:

Raster plot

You can also get an overview of the values of one specific sensor over all the trials at once.

Run #02

Repeat the same operations for the second dataset:


Epoch length

We imported epochs of 600ms (100ms baseline + 500ms post-stimulus) but did not justify this choice.
The length of the epochs you import should be chosen very carefully. If you realize later your epochs are too short or too long, you would have to start over your analysis from this point.
The epoch length to consider depends on:

The experimental design

The processing pipeline

You may have to artificially extend the epochs of interest for technical reasons. Most filters cause edge effects, ie. unreliable segments of data at the beginning and the end of the signal. When applied on short epochs, they might destroy all the data of interest.

For avoiding this, you can add a few hundred milliseconds before and after your epoch of interest. It doesn't matter if it overlaps with the previous or the next epoch. After running the operations that required longer signals, you can cut your epochs back to the desired epoch length. Examples:

In this tutorial, we decided to work with very short epochs (600ms only) so that all the analysis would run on most computers, including personal laptops. For any type of frequency analysis on the recordings, this will be too short. When processing your own recordings, you should increase the size of the epochs beyond the segment that you are actually planning to study.


On the hard drive

Right-click on any imported epoch > File > View file contents:

Structure of the imported epochs: data_*.mat

File history

Right-click on any imported epoch > File > View file history:

List of bad trials

Useful functions

Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):

Tutorials/Epoching (last edited 2021-12-02 14:23:59 by FrancoisTadel)