Import single subject from LIMO data set into MNE-Python

Here we a define function to extract the eeg signal data from the LIMO structures in the LIMO dataset, see 1 and:

The code allows to:

Fetch single subjects epochs data for the LIMO data set. Epochs information (i.e., sampling rate, number of epochs per condition, number and name of EEG channels per subject, etc.) is extracted from the LIMO .mat files stored on disk. If files are not found, the function will automatically download the data from a remote repository. creates a custom info and epochs structure in MNE-Python. Missing channels can be interpolated if desired.



Guillaume, Rousselet. (2016). LIMO EEG Dataset, [dataset]. University of Edinburgh, Centre for Clinical Brain Sciences.

  • ../../_images/sphx_glr_plot_limo_data_001.png
  • ../../_images/sphx_glr_plot_limo_data_002.png
  • ../../_images/sphx_glr_plot_limo_data_003.png
  • ../../_images/sphx_glr_plot_limo_data_004.png
  • ../../_images/sphx_glr_plot_limo_data_005.png


1052 matching events found
No baseline correction applied
Adding metadata with 2 columns
0 projection items activated
0 bad epochs dropped
Computing interpolation matrix from 117 sensor positions
Interpolating 11 sensors
Fitting linear model to epochs, (25728 targets, 3 regressors)

# Authors: Jose C. Garcia Alanis <>
# License: BSD (3-clause)

import numpy as np

import mne
from mne.datasets import limo
from mne.stats import linear_regression


# fetch data from subject 2 and interpolate missing channels
limo_epochs = limo.load_data(subject=2, interpolate=True)

# check distribution of events (should be ordered)

# drop EXG-channels (i.e. eog) as data has already been cleaned
limo_epochs.drop_channels(['EXG1', 'EXG2', 'EXG3', 'EXG4'])

# plot evoked response for conditions A & B
limo_epochs['Face/A'].average().plot_joint(times=[.09, .15])
limo_epochs['Face/B'].average().plot_joint(times=[.09, .15])

# create design matrix for linear regression
design = limo_epochs.metadata
design['Face_Effect'] = np.where(design['Face'] == 'A', 1, 0)
design = design.assign(Intercept=1)
names = ['Intercept', 'Face_Effect', 'Noise']
# check design matrix

# fit linear model
reg = linear_regression(limo_epochs, design[names], names=names)

# plot effect of noise variable
reg['Noise'].beta.plot_joint(title='Effect of Noise',
                             times=[.125, .225])

# plot effect of condition

Total running time of the script: ( 0 minutes 6.154 seconds)

Estimated memory usage: 644 MB

Gallery generated by Sphinx-Gallery