Skip to content

Instantly share code, notes, and snippets.

@agramfort
Created March 16, 2014 08:05
Show Gist options
  • Save agramfort/9579975 to your computer and use it in GitHub Desktop.
Save agramfort/9579975 to your computer and use it in GitHub Desktop.
Test effect of nave on dSPM
returns:
27.0745537031
365.073216463
27.1356784749
import math
import mne
from mne.datasets import sample
from mne.fiff import Evoked
from mne.minimum_norm import apply_inverse, read_inverse_operator
mne.set_log_level('WARNING')
data_path = sample.data_path()
fname_inv = data_path + '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif'
fname_evoked = data_path + '/MEG/sample/sample_audvis-ave.fif'
subjects_dir = data_path + '/subjects'
snr = 3.0
lambda2 = 1.0 / snr ** 2
pick_ori = 'normal'
# pick_ori = None
# Load data
evoked = Evoked(fname_evoked, setno=0, baseline=(None, 0))
inverse_operator = read_inverse_operator(fname_inv)
# Compute inverse solution
stc = apply_inverse(evoked, inverse_operator, lambda2, method='dSPM', pick_ori=pick_ori)
print stc.data.max()
nave = evoked.nave
evoked.nave = 10000
stc = apply_inverse(evoked, inverse_operator, lambda2, method='dSPM', pick_ori=pick_ori)
print stc.data.max()
print stc.data.max() / math.sqrt(evoked.nave / nave)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment