@slow_test
@testing.requires_testing_data
def test_io_inverse_operator():
 tempdir = _TempDir()
 inverse_operator = read_inverse_operator(fname_inv)
 x = repr(inverse_operator)
 assert_true(x)
 assert_true(isinstance(inverse_operator['noise_cov'], Covariance))
 _compare_io(inverse_operator, '.gz')
 with warnings.catch_warnings(record=True) as w:
  warnings.simplefilter('always')
  inv_badname = op.join(tempdir, 'test-bad-name.fif.gz')
  write_inverse_operator(inv_badname, inverse_operator)
  read_inverse_operator(inv_badname)
 assert_naming(w, 'test_inverse.py', 2)
 inv_fname = op.join(tempdir, 'test-inv.fif')
 args = (10, (1.0 / 9.0), 'dSPM')
 inv_prep = prepare_inverse_operator(inverse_operator, *args)
 write_inverse_operator(inv_fname, inv_prep)
 inv_read = read_inverse_operator(inv_fname)
 _compare(inverse_operator, inv_read)
 inv_read_prep = prepare_inverse_operator(inv_read, *args)
 _compare(inv_prep, inv_read_prep)
 inv_prep_prep = prepare_inverse_operator(inv_prep, *args)
 _compare(inv_prep, inv_prep_prep)

@ slow_test @ testing . requires_testing_data def test_io_inverse_operator ( ) : tempdir = _TempDir ( ) inverse_operator = read_inverse_operator ( fname_inv ) x = repr ( inverse_operator ) assert_true ( x ) assert_true ( isinstance ( inverse_operator [ 'noise_cov' ] , Covariance ) ) _compare_io ( inverse_operator , '.gz' ) with warnings . catch_warnings ( record = True ) as w : warnings . simplefilter ( 'always' ) inv_badname = op . join ( tempdir , 'test-bad-name.fif.gz' ) write_inverse_operator ( inv_badname , inverse_operator ) read_inverse_operator ( inv_badname ) assert_naming ( w , 'test_inverse.py' , 2 ) inv_fname = op . join ( tempdir , 'test-inv.fif' ) args = ( 10 , ( 1.0 / 9.0 ) , 'dSPM' ) inv_prep = prepare_inverse_operator ( inverse_operator , * args ) write_inverse_operator ( inv_fname , inv_prep ) inv_read = read_inverse_operator ( inv_fname ) _compare ( inverse_operator , inv_read ) inv_read_prep = prepare_inverse_operator ( inv_read , * args ) _compare ( inv_prep , inv_read_prep ) inv_prep_prep = prepare_inverse_operator ( inv_prep , * args ) _compare ( inv_prep , inv_prep_prep )
test io of inverse_operator .