How to source localize resting state MEG data with no events and epochs using python-MNE

316 views Asked by At

While performing source localization of MEG resting stage data it ask for epochs and events which I do not have in my data set as it is a resting state data. It is also preprocessed.

1

There are 1 answers

0
Marijn van Vliet On

MNE-Python can do source location for continuous (Raw) data. You just need to think what to use to compute the noise covariance. For resting state data, a good choice for noise covariance is a piece of empty room data. Here is an example using the sample dataset that ships with MNE-Python:

import mne

# Load the sample data
path = mne.datasets.sample.data_path()
raw = mne.io.read_raw_fif(path + '/MEG/sample/sample_audvis_raw.fif', preload=True)

# Make a noise covariance matrix using empty room data
empty_room = mne.io.read_raw_fif(path + '/MEG/sample/ernoise_raw.fif', preload=True)
noise_cov = mne.compute_raw_covariance(empty_room, tmin=0, tmax=None)

# Load the leadfield (=forward operator)
fwd = mne.read_forward_solution(path + '/MEG/sample/sample_audvis-meg-oct-6-fwd.fif')

# Make the inverse operator
inv = mne.minimum_norm.make_inverse_operator(raw.info, fwd, noise_cov)

# Compute MNE source estimate for the continuous resting state data. The result
# is a huge matrix, so let's downsample the original raw a bit.
raw.resample(100)  # Downsample to 100 Hz
resting_state = mne.minimum_norm.apply_inverse_raw(raw, inv, lambda2=1E-4)