Skip to content

MNE Sample Data: M/EEG combined processing

Demonstrated features

Feature This example
MEG processing
EEG processing
Maxwell filter
Frequency filter
Artifact regression
SSP
ICA
Evoked contrasts
Time-by-time decoding
Time-generalization decoding
CSP decoding
Time-frequency analysis
BEM surface creation
Template MRI

Dataset source

This dataset was acquired from https://openneuro.org/datasets/ds000248

How to download this dataset

Run in your terminal:

Run in your terminal
openneuro-py download \
             --dataset=ds000248 \
             --include=sub-01 \
             --include=sub-emptyroom \
             --include=derivatives/freesurfer/subjects \
             --exclude=derivatives/freesurfer/subjects/fsaverage/mri/aparc.a2005s+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/fsaverage/mri/aparc+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/fsaverage/mri/aparc.a2009s+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/fsaverage/xhemi/mri/aparc+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc.DKTatlas+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc.DKTatlas+aseg.mgz \
             --exclude=derivatives/freesurfer/subjects/sub-01/mri/aparc.a2009s+aseg.mgz

Note that we have to explicitly exclude files due to a problem with OpenNeuro's storage.

Configuration

Click to expand
Python
.

import mne

bids_root = "~/mne_data/ds000248"
deriv_root = "~/mne_data/derivatives/mne-bids-pipeline/ds000248_base"
subjects_dir = f"{bids_root}/derivatives/freesurfer/subjects"

subjects = ["01"]
rename_events = {"Smiley": "Emoji", "Button": "Switch"}
conditions = ["Auditory", "Visual", "Auditory/Left", "Auditory/Right"]
epochs_metadata_query = "index > 0"  # Just for testing!
contrasts = [("Visual", "Auditory"), ("Auditory/Right", "Auditory/Left")]

time_frequency_conditions = ["Auditory", "Visual"]

ch_types = ["meg", "eeg"]
mf_reference_run = "01"
find_flat_channels_meg = True
find_noisy_channels_meg = True
use_maxwell_filter = True


def noise_cov(bp):
    Estimate the noise covariance.
    # Use pre-stimulus period as noise source
    bp = bp.copy().update(suffix="epo")
    if not bp.fpath.exists():
        bp.update(split="01")
    epo = mne.read_epochs(bp)
    cov = mne.compute_covariance(epo, rank="info", tmax=0)
    return cov


spatial_filter = "ssp"
n_proj_eog = dict(n_mag=1, n_grad=1, n_eeg=1)
n_proj_ecg = dict(n_mag=1, n_grad=1, n_eeg=0)
ssp_meg = "combined"
ecg_proj_from_average = True
eog_proj_from_average = False
epochs_decim = 4

bem_mri_images = "FLASH"
recreate_bem = True

n_jobs = 2


def mri_t1_path_generator(bids_path):
    Return the path to a T1 image.
    # don't really do any modifications – just for testing!
    return bids_path

Generated output

Summary reports

sub-01_task-audiovisual_report.html

sub-average_task-audiovisual_report.html