@testing.requires_testing_data
def test_io_trans():
 tempdir = _TempDir()
 os.mkdir(op.join(tempdir, 'sample'))
 assert_raises(RuntimeError, _find_trans, 'sample', subjects_dir=tempdir)
 trans0 = read_trans(fname)
 fname1 = op.join(tempdir, 'sample', 'test-trans.fif')
 trans0.save(fname1)
 assert_true((fname1 == _find_trans('sample', subjects_dir=tempdir)))
 trans1 = read_trans(fname1)
 assert_true((trans0['from'] == trans1['from']))
 assert_true((trans0['to'] == trans1['to']))
 assert_array_equal(trans0['trans'], trans1['trans'])
 assert_raises(IOError, read_trans, fname_eve)
 with warnings.catch_warnings(record=True) as w:
  fname2 = op.join(tempdir, 'trans-test-bad-name.fif')
  write_trans(fname2, trans0)
 assert_naming(w, 'test_transforms.py', 1)

@ testing . requires_testing_data def test_io_trans ( ) : tempdir = _TempDir ( ) os . mkdir ( op . join ( tempdir , 'sample' ) ) assert_raises ( RuntimeError , _find_trans , 'sample' , subjects_dir = tempdir ) trans0 = read_trans ( fname ) fname1 = op . join ( tempdir , 'sample' , 'test-trans.fif' ) trans0 . save ( fname1 ) assert_true ( ( fname1 == _find_trans ( 'sample' , subjects_dir = tempdir ) ) ) trans1 = read_trans ( fname1 ) assert_true ( ( trans0 [ 'from' ] == trans1 [ 'from' ] ) ) assert_true ( ( trans0 [ 'to' ] == trans1 [ 'to' ] ) ) assert_array_equal ( trans0 [ 'trans' ] , trans1 [ 'trans' ] ) assert_raises ( IOError , read_trans , fname_eve ) with warnings . catch_warnings ( record = True ) as w : fname2 = op . join ( tempdir , 'trans-test-bad-name.fif' ) write_trans ( fname2 , trans0 ) assert_naming ( w , 'test_transforms.py' , 1 )
test reading and writing of trans files .