<s> import os <EOL> from numpy import array <EOL> from numpy . testing import assert_allclose <EOL> from nose . tools import assert_equal , assert_false , assert_raises , assert_true <EOL> from mne . datasets import testing <EOL> from mne . io . tests import data_dir as fiff_data_dir <EOL> from mne . utils import ( _TempDir , requires_mne , requires_freesurfer , <EOL> requires_traits ) <EOL> data_path = testing . data_path ( download = False ) <EOL> subjects_dir = os . path . join ( data_path , '<STR_LIT>' ) <EOL> bem_path = os . path . join ( subjects_dir , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> inst_path = os . path . join ( data_path , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> fid_path = os . path . join ( fiff_data_dir , '<STR_LIT>' ) <EOL> @ testing . requires_testing_data <EOL> @ requires_traits <EOL> def test_bem_source ( ) : <EOL> """<STR_LIT>""" <EOL> from mne . gui . _file_traits import BemSource <EOL> bem = BemSource ( ) <EOL> assert_equal ( bem . points . shape , ( <NUM_LIT:0> , <NUM_LIT:3> ) ) <EOL> assert_equal ( bem . tris . shape , ( <NUM_LIT:0> , <NUM_LIT:3> ) ) <EOL> bem . file = bem_path <EOL> assert_equal ( bem . points . shape , ( <NUM_LIT> , <NUM_LIT:3> ) ) <EOL> assert_equal ( bem . tris . shape , ( <NUM_LIT> , <NUM_LIT:3> ) ) <EOL> @ testing . requires_testing_data <EOL> @ requires_traits <EOL> def test_fiducials_source ( ) : <EOL> """<STR_LIT>""" <EOL> from mne . gui . _file_traits import FiducialsSource <EOL> fid = FiducialsSource ( ) <EOL> fid . file = fid_path <EOL> points = array ( [ [ - <NUM_LIT> , - <NUM_LIT> , - <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> , - <NUM_LIT> ] , <EOL> [ <NUM_LIT> , - <NUM_LIT> , - <NUM_LIT> ] ] ) <EOL> assert_allclose ( fid . points , points , <NUM_LIT> ) <EOL> fid . file = '<STR_LIT>' <EOL> assert_equal ( fid . points , None ) <EOL> @ testing . requires_testing_data <EOL> @ requires_traits <EOL> def test_inst_source ( ) : <EOL> """<STR_LIT>""" <EOL> from mne . gui . _file_traits import InstSource <EOL> inst = InstSource ( ) <EOL> assert_equal ( inst . inst_fname , '<STR_LIT:->' ) <EOL> inst . file = inst_path <EOL> assert_equal ( inst . inst_dir , os . path . dirname ( inst_path ) ) <EOL> lpa = array ( [ [ - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> nasion = array ( [ [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> rpa = array ( [ [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> assert_allclose ( inst . lpa , lpa ) <EOL> assert_allclose ( inst . nasion , nasion ) <EOL> assert_allclose ( inst . rpa , rpa ) <EOL> @ testing . requires_testing_data <EOL> @ requires_traits <EOL> def test_subject_source ( ) : <EOL> """<STR_LIT>""" <EOL> from mne . gui . _file_traits import MRISubjectSource <EOL> mri = MRISubjectSource ( ) <EOL> mri . subjects_dir = subjects_dir <EOL> assert_true ( '<STR_LIT>' in mri . subjects ) <EOL> mri . subject = '<STR_LIT>' <EOL> @ testing . requires_testing_data <EOL> @ requires_traits <EOL> @ requires_mne <EOL> @ requires_freesurfer <EOL> def test_subject_source_with_fsaverage ( ) : <EOL> """<STR_LIT>""" <EOL> from mne . gui . _file_traits import MRISubjectSource <EOL> tempdir = _TempDir ( ) <EOL> mri = MRISubjectSource ( ) <EOL> assert_false ( mri . can_create_fsaverage ) <EOL> assert_raises ( RuntimeError , mri . create_fsaverage ) <EOL> mri . subjects_dir = tempdir <EOL> assert_true ( mri . can_create_fsaverage ) <EOL> mri . create_fsaverage ( ) </s>
