Table 5.
Inverse modeling using the LCMV beamformer.
import mne
# load raw data and create epochs and evoked objects as in Table 1, but picking
# only MEG channels using mne.fiff.pick_types(raw.info, meg=True, eeg=False)
# compute noise and data covariance
noise_cov = mne.compute_covariance(epochs, tmax=0.0)
noise_cov = mne.cov.regularize (noise_cov, evoked.info,
mag=0.05, grad=0.05, eeg=0.1, proj=True)
data_cov = mne.compute_covariance (epochs, tmin=0.04, tmax=0.15)
# compute LCMV inverse solution
fwd_fname = 'sample_audvis-meg-vol-7-fwd.fif'
fwd = mne.read_forward_solution (fwd_fname, surf_ori=True)
stc = mne.beamformer.lcmv(evoked, fwd, noise_cov, data_cov, reg=0.1,
pick_ori='max-power')
# save result in 4D nifti file for plotting with Freesurfer
stc.save_as_volume('lcmv.nii.gz', fwd['src'], mri_resolution=False)
|