Created
March 23, 2020 15:03
-
-
Save larsoner/8d672f7aa0f7bbe501551c2cce3c6a81 to your computer and use it in GitHub Desktop.
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 os.path as op | |
import mne | |
from mne import compute_rank | |
from mne.beamformer import make_lcmv | |
data_path = mne.datasets.testing.data_path() | |
fname_raw = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc_raw.fif') | |
fname_fwd = op.join(data_path, 'MEG', 'sample', | |
'sample_audvis_trunc-meg-eeg-oct-4-fwd.fif') | |
raw = mne.io.read_raw_fif(fname_raw).fix_mag_coil_types() | |
raw_sss = mne.preprocessing.maxwell_filter(raw) | |
events = mne.find_events(raw_sss) | |
del raw | |
raw_sss.pick_types('mag') | |
assert len(raw_sss.ch_names) == 102 | |
epochs = mne.Epochs(raw_sss, events) | |
data_cov = mne.compute_covariance(epochs, tmin=0) | |
fwd = mne.read_forward_solution(fname_fwd) | |
rank = compute_rank(data_cov, info=epochs.info) | |
assert rank == {'mag': 71} | |
# XXX should be broken on `master`? | |
make_lcmv(epochs.info, fwd, data_cov, noise_cov=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment