Last active
February 12, 2020 16:13
-
-
Save wmvanvliet/15e46c4fd6451a942d901b023f6e60be to your computer and use it in GitHub Desktop.
Here's something you shouldn't do with MNE-Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mne | |
from mayavi import mlab | |
data_path = mne.datasets.sample.data_path() | |
subjects_dir = f'{data_path}/subjects' | |
evoked = mne.read_evokeds(f'{data_path}/MEG/sample/sample_audvis-ave.fif', condition='Left Auditory').apply_baseline() | |
noise_cov = mne.read_cov(f'{data_path}/MEG/sample/sample_audvis-cov.fif') | |
bem = mne.make_sphere_model(r0='auto', head_radius='auto', info=evoked.info) | |
src = mne.setup_volume_source_space(bem=bem) | |
fwd = mne.make_forward_solution(evoked.info, trans=None, src=src, bem=bem, meg=True, eeg=False, mindist=5, n_jobs=4) | |
inv = mne.minimum_norm.make_inverse_operator(evoked.info, fwd, noise_cov) | |
stc = mne.minimum_norm.apply_inverse(evoked, inv) | |
peak_time = stc.get_peak(time_as_index=True)[1] | |
mlab.points3d(*fwd['source_rr'].T, stc.data[:, peak_time], scale_factor=1e-4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment