Skip to content
Template for a group study using the MNE Python software
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests config_matchingpennies -> config_eeg_matchingpennies Aug 25, 2019
.gitignore wrap in main() Aug 25, 2019 put logic from main into main func Aug 25, 2019 wrap in main() Aug 25, 2019 put logic from main into main func Aug 25, 2019 put logic from main into main func Aug 25, 2019 put logic from main into main func Aug 25, 2019 put logic from main into main func Aug 25, 2019 wrap in main() Aug 25, 2019 wrap in main() Aug 25, 2019 DOC: improve contrib Aug 25, 2019
Makefile fix links Aug 20, 2019 config_matchingpennies -> config_eeg_matchingpennies Aug 25, 2019



This repository contains an exemplary pipeline for processing MEG/EEG data using MNE-Python and the Brain Imaging Data Structure (BIDS).

The study template expects input data to adhere to BIDS. You can check whether your data complies with the BIDS standard using the BIDS validator.


First, you need to make sure you have MNE-Python installed and working on your system. See the installation instructions. Once this is done, you should be able to run this in a terminal:

$ python -c "import mne; mne.sys_info()"

You can then install the following additional packages via pip. Note that the URL points to the bleeding edge version of mne_bids:

$ pip install



Generally, there is a single file, which contains all parameters for the analysis of the data. Many parameters are automatically inferred from the BIDS structure of the data.

All other scripts should not be edited.


To ease interaction with the study template, there is a Makefile. Simply type make from the root of your study template to see a summary of what you can do, or inspect the file directly.

For Windows users, it might be necessary to install GNU make.

Running on your own data

  1. Make sure your data is formatted in BIDS
  2. Set an environment variable BIDS_ROOT to point to your dataset
  3. (optional) Set an environment variable MNE_BIDS_STUDY_CONFIG to point to a custom config_<dataset_name>.py file that you created to overwrite the standard parameters in the main file.
  4. Use the Makefile to run your analyses

Processing steps

The following table provides a concise summary of each step in the pipeline.

Script Description The only file you need to modify in principle. This file contain all your parameters. Read raw data and apply lowpass or/and highpass filtering. Run maxfilter and do lowpass filter at 40 Hz. Extract events or annotations or markers from the data and save it to disk. Uses events from stimulus channel STI101. Extract epochs. Run Independant Component Analysis (ICA) for artifact correction. Run Signal Subspace Projections (SSP) for artifact correction. These are often also referred to as PCA vectors. As an alternative to ICA, you can use SSP projections to correct for eye blink and heart artifacts. Use either 5a/6a, or 5b/6b. Apply SSP projections and obtain the cleaned epochs. Extract evoked data for each condition. Make a group average of the time domain data. Running a time-by-time decoder with sliding window. Running a time-frequency analysis. Compute forward operators. You will need to have computed the coregistration to obtain the -trans.fif files for each subject. Compute noise covariances for each subject. Compute inverse problem to obtain source estimates. Compute source estimates average over subjects. Compute HTML reports for each subject.


The original pipeline for MEG/EEG data processing with MNE python was build jointly by the Cognition and Brain Dynamics Team and the MNE Python Team, based on scripts originally developed for this publication:

M. Jas, E. Larson, D. A. Engemann, J. Leppäkangas, S. Taulu, M. Hämäläinen, A. Gramfort (2018). A reproducible MEG/EEG group study with the MNE software: recommendations, quality assessments, and good practices. Frontiers in neuroscience, 12.

The current iteration is based on BIDS and relies on the extensions to BIDS for EEG and MEG. See the following two references:

Pernet, C. R., Appelhoff, S., Gorgolewski, K. J., Flandin, G., Phillips, C., Delorme, A., Oostenveld, R. (2019). EEG-BIDS, an extension to the brain imaging data structure for electroencephalography. Scientific Data, 6, 103.

Niso, G., Gorgolewski, K. J., Bock, E., Brooks, T. L., Flandin, G., Gramfort, A., Henson, R. N., Jas, M., Litvak, V., Moreau, J., Oostenveld, R., Schoffelen, J., Tadel, F., Wexler, J., Baillet, S. (2018). MEG-BIDS, the brain imaging data structure extended to magnetoencephalography. Scientific Data, 5, 180110.

You can’t perform that action at this time.