Skip to content

brainthemind/CogBrainDyn_MEG_Pipeline

 
 

Repository files navigation

CircleCI

0 Credits

This example 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.

1 Make sure MNE-python is installed

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

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

Get the scripts through git:

$ git clone https://github.com/brainthemind/CogBrainDyn_MEG_Pipeline.git

If you do not know how to use git, download the scripts here.

For source analysis you'll also need freesurfer, follow the instructions on their website.

2 Set your data to a proper place

For a complete example, we can use the .fif raw data you can find here

The name of this study is "Localizer".

You can create a folder called "ExampleData" wherever you want on your computer.

In the ExampleData folder, you need to create three subfolders: "MEG", "system_calibration_files" and "subjects" as follow:

xx

The "MEG" folder will contain a folder for each participant The "system_calibration_files" folder will contain the calibration files (download them from OSF) The "subjects" folder will contain participant MRI files.

Here is an example of what the MEG folder should contain if you have 3 subjects called SB01, SB02 and SB03:

xx

Then you can put the raw data for each subject in their own folder. You can name the raw data files as this: subjectID_StudyName_raw.fif

or, if your data has multiple runs: subjectID_StudyName_run01_raw.fif

xx

3 Adapt config.py

All specific settings to be used in your analysis are defined in config.py. See the comments for explanations and recommendations.

4 Processing steps

Script Description
config.py The only file you need to modify in principle. This file contain all your parameters.
00-visual_inspection.py Read raw data and plot it to inspect bad channels.
01-import_and_maxwell_filter.py Read raw data and apply maxwell filter.
02-apply_frequency_filter.py Apply high- and lowpass filter to the continuous data.
03-extract_events.py Extract events or annotations or markers from the data and save it to disk. Uses events from stimulus channel STI101.
04-make_epochs.py Extract epochs.
05a-run_ica.py Run Independant Component Analysis (ICA) for artifact correction.
05b-run_ssp.py Run Signal Subspace Projections (SSP) for artifact correction. These are often also referred to as PCA vectors.
06a-apply_ica.py 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.
06b-apply_ssp.py Apply SSP projections and obtain the cleaned epochs.
07-make_evoked.py Extract evoked data for each condition.
08-group_average_sensors.py Make a group average of the time domain data.
09-sliding_estimator.py Running a time-by-time decoder with sliding window.
10-time_frequency.py Running a time-frequency analysis.
11-make_forward.py Compute forward operators. You will need to have computed the coregistration to obtain the -trans.fif files for each subject.
12-make_cov.py Compute noise covariances for each subject.
13-make_inverse.py Compute inverse problem to obtain source estimates.
14-group_average_source.py Compute source estimates average over subjects.
99-make_reports.py Compute HTML reports for each subject.

About

Template for a group study using the MNE Python software

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.7%
  • Makefile 3.3%