def test_read_spm_ctf(): """Test CTF reader with omitted samples.""" data_path = spm_face.data_path() raw_fname = op.join(data_path, 'MEG', 'spm', 'SPM_CTF_MEG_example_faces1_3D.ds') raw = read_raw_ctf(raw_fname) extras = raw._raw_extras[0] assert_equal(extras['n_samp'], raw.n_times) assert_false(extras['n_samp'] == extras['n_samp_tot'])
def test_read_spm_ctf(): """Test CTF reader with omitted samples.""" data_path = spm_face.data_path() raw_fname = op.join(data_path, 'MEG', 'spm', 'SPM_CTF_MEG_example_faces1_3D.ds') raw = read_raw_ctf(raw_fname) extras = raw._raw_extras[0] assert_equal(extras['n_samp'], raw.n_times) assert extras['n_samp'] != extras['n_samp_tot'] # Test that LPA, nasion and RPA are correct. coord_frames = np.array([d['coord_frame'] for d in raw.info['dig']]) assert np.all(coord_frames == FIFF.FIFFV_COORD_HEAD) cardinals = {d['ident']: d['r'] for d in raw.info['dig']} assert cardinals[1][0] < cardinals[2][0] < cardinals[3][0] # x coord assert cardinals[1][1] < cardinals[2][1] # y coord assert cardinals[3][1] < cardinals[2][1] # y coord for key in cardinals.keys(): assert_allclose(cardinals[key][2], 0, atol=1e-6) # z coord
import os.path as op import numpy as np from scipy.misc import imread import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import spm_face from mne.minimum_norm import apply_inverse, make_inverse_operator from mne.cov import compute_covariance ############################################################################## # Get data data_path = spm_face.data_path() subjects_dir = data_path + '/subjects' raw_fname = data_path + '/MEG/spm/SPM_CTF_MEG_example_faces%d_3D_raw.fif' raw = io.Raw(raw_fname % 1, preload=True) # Take first run picks = mne.pick_types(raw.info, meg=True, exclude='bads') raw.filter(1, 30, method='iir', n_jobs=1) events = mne.find_events(raw, stim_channel='UPPT001') event_ids = {"faces": 1, "scrambled": 2} tmin, tmax = -0.2, 0.5 baseline = None # no baseline as high-pass is applied reject = dict(mag=3e-12)
import mne from mne.io import read_raw_fif, read_raw_ctf, read_raw_bti, read_raw_kit from mne.io import read_raw_artemis123 from mne.datasets import sample, spm_face, testing from mne.viz import plot_alignment, set_3d_title print(__doc__) bti_path = op.abspath(op.dirname(mne.__file__)) + '/io/bti/tests/data/' kit_path = op.abspath(op.dirname(mne.__file__)) + '/io/kit/tests/data/' raws = { 'Neuromag': read_raw_fif(sample.data_path() + '/MEG/sample/sample_audvis_raw.fif'), 'CTF 275': read_raw_ctf(spm_face.data_path() + '/MEG/spm/SPM_CTF_MEG_example_faces1_3D.ds'), 'Magnes 3600wh': read_raw_bti(op.join(bti_path, 'test_pdf_linux'), op.join(bti_path, 'test_config_linux'), op.join(bti_path, 'test_hs_linux')), 'KIT': read_raw_kit(op.join(kit_path, 'test.sqd')), 'Artemis123': read_raw_artemis123( op.join(testing.data_path(), 'ARTEMIS123', 'Artemis_Data_2017-04-14-10h-38m-59s_Phantom_1k_HPI_1s.bin')), } for system, raw in sorted(raws.items()): meg = ['helmet', 'sensors']
_record_warnings) from mne.datasets import testing, spm_face, brainstorm from mne.io.constants import FIFF ctf_dir = testing.data_path(download=False) / 'CTF' ctf_fname_continuous = 'testdata_ctf.ds' ctf_fname_1_trial = 'testdata_ctf_short.ds' ctf_fname_2_trials = 'testdata_ctf_pseudocontinuous.ds' ctf_fname_discont = 'testdata_ctf_short_discontinuous.ds' ctf_fname_somato = 'somMDYO-18av.ds' ctf_fname_catch = 'catch-alp-good-f.ds' somato_fname = op.join( brainstorm.bst_raw.data_path(download=False), 'MEG', 'bst_raw', 'subj001_somatosensory_20111109_01_AUX-f.ds' ) spm_path = spm_face.data_path(download=False) block_sizes = { ctf_fname_continuous: 12000, ctf_fname_1_trial: 4801, ctf_fname_2_trials: 12000, ctf_fname_discont: 1201, ctf_fname_somato: 313, ctf_fname_catch: 2500, } single_trials = ( ctf_fname_continuous, ctf_fname_1_trial, ) ctf_fnames = tuple(sorted(block_sizes.keys()))
import os.path as op import mne from mne.io import read_raw_fif, read_raw_ctf, read_raw_bti, read_raw_kit from mne.io import read_raw_artemis123 from mne.datasets import sample, spm_face, testing from mne.viz import plot_alignment, set_3d_title print(__doc__) bti_path = op.abspath(op.dirname(mne.__file__)) + '/io/bti/tests/data/' kit_path = op.abspath(op.dirname(mne.__file__)) + '/io/kit/tests/data/' raws = { 'Neuromag': read_raw_fif(sample.data_path() + '/MEG/sample/sample_audvis_raw.fif'), 'CTF 275': read_raw_ctf(spm_face.data_path() + '/MEG/spm/SPM_CTF_MEG_example_faces1_3D.ds'), 'Magnes 3600wh': read_raw_bti(op.join(bti_path, 'test_pdf_linux'), op.join(bti_path, 'test_config_linux'), op.join(bti_path, 'test_hs_linux')), 'KIT': read_raw_kit(op.join(kit_path, 'test.sqd')), 'Artemis123': read_raw_artemis123(op.join( testing.data_path(), 'ARTEMIS123', 'Artemis_Data_2017-04-14-10h-38m-59s_Phantom_1k_HPI_1s.bin')), } for system, raw in sorted(raws.items()): meg = ['helmet', 'sensors'] # We don't have coil definitions for KIT refs, so exclude them if system != 'KIT': meg.append('ref')
# %% # Neuromag # -------- kwargs = dict(eeg=False, coord_frame='meg', show_axes=True, verbose=True) raw = read_raw_fif(sample.data_path() / 'MEG' / 'sample' / 'sample_audvis_raw.fif') fig = plot_alignment(raw.info, meg=('helmet', 'sensors'), **kwargs) set_3d_title(figure=fig, title='Neuromag') # %% # CTF # --- raw = read_raw_ctf(spm_face.data_path() / 'MEG' / 'spm' / 'SPM_CTF_MEG_example_faces1_3D.ds') fig = plot_alignment(raw.info, meg=('helmet', 'sensors', 'ref'), **kwargs) set_3d_title(figure=fig, title='CTF 275') # %% # BTi # --- bti_path = op.abspath(op.dirname(mne.__file__)) + '/io/bti/tests/data/' raw = read_raw_bti(op.join(bti_path, 'test_pdf_linux'), op.join(bti_path, 'test_config_linux'), op.join(bti_path, 'test_hs_linux')) fig = plot_alignment(raw.info, meg=('helmet', 'sensors', 'ref'), **kwargs) set_3d_title(figure=fig, title='Magnes 3600wh')