Tutorials#

These tutorials provide narrative explanations, sample code, and expected output for the most common MNE-Python analysis tasks. The emphasis here is on thorough explanations that get you up to speed quickly, at the expense of covering only a limited number of topics. The sections and tutorials are arranged in a fixed order, so in theory a new user should be able to progress through in order without encountering any cases where background knowledge is assumed and unexplained. More experienced users (i.e., those with significant experience analyzing EEG/MEG signals with different software) can probably skip around to just the topics they need without too much trouble.

Note

If tutorial-scripts contain plots and are run locally, using the interactive flag with python -i tutorial_script.py keeps them open.

Introductory tutorials#

These tutorials cover the basic EEG/MEG pipeline for event-related analysis, introduce the mne.Info, events, and mne.Annotations data structures, discuss how sensor locations are handled, and introduce some of the configuration options available.

Overview of MEG/EEG analysis with MNE-Python

Overview of MEG/EEG analysis with MNE-Python

Overview of MEG/EEG analysis with MNE-Python
Modifying data in-place

Modifying data in-place

Modifying data in-place
Parsing events from raw data

Parsing events from raw data

Parsing events from raw data
The Info data structure

The Info data structure

The Info data structure
Working with sensor locations

Working with sensor locations

Working with sensor locations
Configuring MNE-Python

Configuring MNE-Python

Configuring MNE-Python
Getting started with mne.Report

Getting started with mne.Report

Getting started with mne.Report

Reading data for different recording systems#

These tutorials cover the basics of loading EEG/MEG data into MNE-Python for various recording devices.

Importing data from MEG devices

Importing data from MEG devices

Importing data from MEG devices
Importing data from EEG devices

Importing data from EEG devices

Importing data from EEG devices
Importing data from fNIRS devices

Importing data from fNIRS devices

Importing data from fNIRS devices
Working with CTF data: the Brainstorm auditory dataset

Working with CTF data: the Brainstorm auditory dataset

Working with CTF data: the Brainstorm auditory dataset

Working with continuous data#

These tutorials cover the basics of loading EEG/MEG data into MNE-Python, and how to query, manipulate, annotate, plot, and export continuous data in the Raw format.

The Raw data structure: continuous data

The Raw data structure: continuous data

The Raw data structure: continuous data
Working with events

Working with events

Working with events
Annotating continuous data

Annotating continuous data

Annotating continuous data
Built-in plotting methods for Raw objects

Built-in plotting methods for Raw objects

Built-in plotting methods for Raw objects

Preprocessing#

These tutorials cover various preprocessing techniques for continuous data, as well as some diagnostic plotting methods.

Overview of artifact detection

Overview of artifact detection

Overview of artifact detection
Handling bad channels

Handling bad channels

Handling bad channels
Rejecting bad data spans and breaks

Rejecting bad data spans and breaks

Rejecting bad data spans and breaks
Background information on filtering

Background information on filtering

Background information on filtering
Filtering and resampling data

Filtering and resampling data

Filtering and resampling data
Repairing artifacts with regression

Repairing artifacts with regression

Repairing artifacts with regression
Repairing artifacts with ICA

Repairing artifacts with ICA

Repairing artifacts with ICA
Background on projectors and projections

Background on projectors and projections

Background on projectors and projections
Repairing artifacts with SSP

Repairing artifacts with SSP

Repairing artifacts with SSP
Setting the EEG reference

Setting the EEG reference

Setting the EEG reference
Extracting and visualizing subject head movement

Extracting and visualizing subject head movement

Extracting and visualizing subject head movement
Signal-space separation (SSS) and Maxwell filtering

Signal-space separation (SSS) and Maxwell filtering

Signal-space separation (SSS) and Maxwell filtering
Preprocessing functional near-infrared spectroscopy (fNIRS) data

Preprocessing functional near-infrared spectroscopy (fNIRS) data

Preprocessing functional near-infrared spectroscopy (fNIRS) data

Segmenting continuous data into epochs#

These tutorials cover epoched data, and how it differs from working with continuous data.

The Epochs data structure: discontinuous data

The Epochs data structure: discontinuous data

The Epochs data structure: discontinuous data
Regression-based baseline correction

Regression-based baseline correction

Regression-based baseline correction
Visualizing epoched data

Visualizing epoched data

Visualizing epoched data
Working with Epoch metadata

Working with Epoch metadata

Working with Epoch metadata
Auto-generating Epochs metadata

Auto-generating Epochs metadata

Auto-generating Epochs metadata
Exporting Epochs to Pandas DataFrames

Exporting Epochs to Pandas DataFrames

Exporting Epochs to Pandas DataFrames
Divide continuous data into equally-spaced epochs

Divide continuous data into equally-spaced epochs

Divide continuous data into equally-spaced epochs

Estimating evoked responses#

These tutorials cover estimates of evoked responses (i.e., averages across several repetitions of an experimental condition).

The Evoked data structure: evoked/averaged data

The Evoked data structure: evoked/averaged data

The Evoked data structure: evoked/averaged data
Visualizing Evoked data

Visualizing Evoked data

Visualizing Evoked data
EEG analysis - Event-Related Potentials (ERPs)

EEG analysis - Event-Related Potentials (ERPs)

EEG analysis - Event-Related Potentials (ERPs)
Plotting whitened data

Plotting whitened data

Plotting whitened data

Time-frequency analysis#

These tutorials cover frequency and time-frequency analysis of neural signals.

Frequency and time-frequency sensor analysis

Frequency and time-frequency sensor analysis

Frequency and time-frequency sensor analysis
Frequency-tagging: Basic analysis of an SSVEP/vSSR dataset

Frequency-tagging: Basic analysis of an SSVEP/vSSR dataset

Frequency-tagging: Basic analysis of an SSVEP/vSSR dataset

Forward models and source spaces#

These tutorials cover how the cortical source locations (source spaces) and forward models (AKA leadfield matrices) are defined.

FreeSurfer MRI reconstruction

FreeSurfer MRI reconstruction

FreeSurfer MRI reconstruction
Source alignment and coordinate frames

Source alignment and coordinate frames

Source alignment and coordinate frames
Using an automated approach to coregistration

Using an automated approach to coregistration

Using an automated approach to coregistration
Head model and forward computation

Head model and forward computation

Head model and forward computation
EEG forward operator with a template MRI

EEG forward operator with a template MRI

EEG forward operator with a template MRI
How MNE uses FreeSurfer's outputs

How MNE uses FreeSurfer’s outputs

How MNE uses FreeSurfer's outputs
Fixing BEM and head surfaces

Fixing BEM and head surfaces

Fixing BEM and head surfaces
Computing a covariance matrix

Computing a covariance matrix

Computing a covariance matrix

Source localization and inverses#

These tutorials cover estimation of cortical activity from sensor recordings.

The SourceEstimate data structure

The SourceEstimate data structure

The SourceEstimate data structure
Source localization with equivalent current dipole (ECD) fit

Source localization with equivalent current dipole (ECD) fit

Source localization with equivalent current dipole (ECD) fit
Source localization with MNE, dSPM, sLORETA, and eLORETA

Source localization with MNE, dSPM, sLORETA, and eLORETA

Source localization with MNE, dSPM, sLORETA, and eLORETA
The role of dipole orientations in distributed source localization

The role of dipole orientations in distributed source localization

The role of dipole orientations in distributed source localization
Computing various MNE solutions

Computing various MNE solutions

Computing various MNE solutions
Source reconstruction using an LCMV beamformer

Source reconstruction using an LCMV beamformer

Source reconstruction using an LCMV beamformer
Visualize source time courses (stcs)

Visualize source time courses (stcs)

Visualize source time courses (stcs)
EEG source localization given electrode locations on an MRI

EEG source localization given electrode locations on an MRI

EEG source localization given electrode locations on an MRI
Brainstorm Elekta phantom dataset tutorial

Brainstorm Elekta phantom dataset tutorial

Brainstorm Elekta phantom dataset tutorial
Brainstorm CTF phantom dataset tutorial

Brainstorm CTF phantom dataset tutorial

Brainstorm CTF phantom dataset tutorial
4D Neuroimaging/BTi phantom dataset tutorial

4D Neuroimaging/BTi phantom dataset tutorial

4D Neuroimaging/BTi phantom dataset tutorial

Statistical analysis of sensor data#

These tutorials describe some approaches to statistical analysis of sensor-level data.

Statistical inference

Statistical inference

Statistical inference
Visualising statistical significance thresholds on EEG data

Visualising statistical significance thresholds on EEG data

Visualising statistical significance thresholds on EEG data
Non-parametric 1 sample cluster statistic on single trial power

Non-parametric 1 sample cluster statistic on single trial power

Non-parametric 1 sample cluster statistic on single trial power
Non-parametric between conditions cluster statistic on single trial power

Non-parametric between conditions cluster statistic on single trial power

Non-parametric between conditions cluster statistic on single trial power
Mass-univariate twoway repeated measures ANOVA on single trial power

Mass-univariate twoway repeated measures ANOVA on single trial power

Mass-univariate twoway repeated measures ANOVA on single trial power
Spatiotemporal permutation F-test on full sensor data

Spatiotemporal permutation F-test on full sensor data

Spatiotemporal permutation F-test on full sensor data

Statistical analysis of source estimates#

These tutorials cover within-subject statistical analysis of source estimates.

Permutation t-test on source data with spatio-temporal clustering

Permutation t-test on source data with spatio-temporal clustering

Permutation t-test on source data with spatio-temporal clustering
2 samples permutation test on source data with spatio-temporal clustering

2 samples permutation test on source data with spatio-temporal clustering

2 samples permutation test on source data with spatio-temporal clustering
Repeated measures ANOVA on source data with spatio-temporal clustering

Repeated measures ANOVA on source data with spatio-temporal clustering

Repeated measures ANOVA on source data with spatio-temporal clustering

Machine learning models of neural activity#

These tutorials cover some of the machine learning methods available in MNE-Python.

Spectro-temporal receptive field (STRF) estimation on continuous data

Spectro-temporal receptive field (STRF) estimation on continuous data

Spectro-temporal receptive field (STRF) estimation on continuous data
Decoding (MVPA)

Decoding (MVPA)

Decoding (MVPA)

Clinical applications#

These tutorials illustrate clinical uses of MNE-Python.

Locating intracranial electrode contacts

Locating intracranial electrode contacts

Locating intracranial electrode contacts
Working with sEEG data

Working with sEEG data

Working with sEEG data
Working with ECoG data

Working with ECoG data

Working with ECoG data
Sleep stage classification from polysomnography (PSG) data

Sleep stage classification from polysomnography (PSG) data

Sleep stage classification from polysomnography (PSG) data

Simulation#

These tutorials describe how to populate MNE-Python data structures with arbitrary data, using the array-based constructors and the simulation submodule.

Creating MNE-Python data structures from scratch

Creating MNE-Python data structures from scratch

Creating MNE-Python data structures from scratch
Corrupt known signal with point spread

Corrupt known signal with point spread

Corrupt known signal with point spread
DICS for power mapping

DICS for power mapping

DICS for power mapping

Gallery generated by Sphinx-Gallery