@testing.requires_testing_data
@requires_mne
def test_snr():
 tempdir = _TempDir()
 inv = read_inverse_operator(fname_inv)
 evoked = read_evokeds(fname_evoked, baseline=(None, 0))[0]
 snr = estimate_snr(evoked, inv)[0]
 orig_dir = os.getcwd()
 os.chdir(tempdir)
 try:
  cmd = ['mne_compute_mne', '--inv', fname_inv, '--meas', fname_evoked, '--snronly', '--bmin', '-200', '--bmax', '0']
  run_subprocess(cmd)
 except Exception:
  pass
 finally:
  os.chdir(orig_dir)
 snr_c = np.loadtxt(op.join(tempdir, 'SNR'))[:, 1]
 assert_allclose(snr, snr_c, atol=0.01, rtol=0.01)

@ testing . requires_testing_data @ requires_mne def test_snr ( ) : tempdir = _TempDir ( ) inv = read_inverse_operator ( fname_inv ) evoked = read_evokeds ( fname_evoked , baseline = ( None , 0 ) ) [ 0 ] snr = estimate_snr ( evoked , inv ) [ 0 ] orig_dir = os . getcwd ( ) os . chdir ( tempdir ) try : cmd = [ 'mne_compute_mne' , '--inv' , fname_inv , '--meas' , fname_evoked , '--snronly' , '--bmin' , '-200' , '--bmax' , '0' ] run_subprocess ( cmd ) except Exception : pass finally : os . chdir ( orig_dir ) snr_c = np . loadtxt ( op . join ( tempdir , 'SNR' ) ) [ : , 1 ] assert_allclose ( snr , snr_c , atol = 0.01 , rtol = 0.01 )
test snr calculation .