Ejemplo n.º 1
0
 def test_xrfi_h1c_run_uvfits_no_xrfi_path(self):
     # test uvfits file and no xrfi path
     uvd = UVData()
     uvd.read_miriad(test_d_file)
     outtest = test_uvfits_file + '.flags.h5'
     if os.path.exists(outtest):
         os.remove(outtest)
     if os.path.exists(test_uvfits_file + '.waterfall.flags.h5'):
         os.remove(test_uvfits_file + '.waterfall.flags.h5')
     g_temp = os.path.join(xrfi_path, os.path.basename(test_c_file) + '.g.flags.h5')
     x_temp = os.path.join(xrfi_path, os.path.basename(test_c_file) + '.x.flags.h5')
     os.rename(test_c_file + '.g.flags.h5', g_temp)
     os.rename(test_c_file + '.x.flags.h5', x_temp)
     xrfi.xrfi_h1c_run(test_uvfits_file, infile_format='uvfits',
                       history='Just a test.', kt_size=3, model_file=test_d_file,
                       model_file_format='miriad', calfits_file=test_c_file)
     nt.assert_true(os.path.exists(outtest))
     os.remove(outtest)
     if os.path.exists(test_uvfits_file + '.waterfall.flags.h5'):
         os.remove(test_uvfits_file + '.waterfall.flags.h5')
     if os.path.exists(test_c_file + '.x.flags.h5'):
         os.remove(test_c_file + '.x.flags.h5')
     if os.path.exists(test_d_file + '.flags.h5'):
         os.remove(test_d_file + '.flags.h5')
     os.rename(g_temp, test_c_file + '.g.flags.h5')
     os.rename(x_temp, test_c_file + '.x.flags.h5')
Ejemplo n.º 2
0
 def test_xrfi_h1c_run_uvfits_xrfi_path(self):
     # test uvfits file with xrfi path
     uvd = UVData()
     uvd.read_miriad(test_d_file)
     outtest = os.path.join(xrfi_path, os.path.basename(test_uvfits_file)) + '.flags.h5'
     if os.path.exists(outtest):
         os.remove(outtest)
     xrfi.xrfi_h1c_run(test_uvfits_file, infile_format='uvfits',
                       history='Just a test.', kt_size=3, xrfi_path=xrfi_path)
     nt.assert_true(os.path.exists(outtest))
     os.remove(outtest)
Ejemplo n.º 3
0
 def test_xrfi_h1c_run_uvfits_model(self):
     # uvfits model file test
     uvd = UVData()
     uvd.read_miriad(test_d_file)
     ext = '.flag'
     outtest = os.path.join(xrfi_path, os.path.basename(test_uvfits_file)) + ext
     if os.path.exists(outtest):
         os.remove(outtest)
     xrfi.xrfi_h1c_run(uvd, history='Just a test.', filename=test_d_file,
                       extension=ext, summary=True, model_file=test_uvfits_file,
                       model_file_format='uvfits', xrfi_path=xrfi_path, kt_size=3)
     nt.assert_true(os.path.exists(outtest))
Ejemplo n.º 4
0
    def test_xrfi_h1c_run(self):
        # run with bad antennas specified
        uvd = UVData()
        uvd.read_miriad(test_d_file)
        xrfi.xrfi_h1c_run(test_d_file, filename=test_d_file,
                          history='Just a test.', ex_ants='1,2', xrfi_path=xrfi_path,
                          kt_size=3)

        # catch no provided data file for flagging
        uvtest.checkWarnings(xrfi.xrfi_h1c_run, [None],
                             {'filename': test_d_file, 'history': 'Just a test.',
                              'model_file': test_d_file, 'model_file_format': 'miriad',
                              'xrfi_path': xrfi_path}, nwarnings=191,
                              message=['indata is None'] + 190 * ['Kt value 8'])
Ejemplo n.º 5
0
 def test_xrfi_h1c_run_input_calfits(self):
     # input calfits
     uvd = UVData()
     uvd.read_miriad(test_d_file)
     ext = '.flag'
     outtest1 = os.path.join(xrfi_path, os.path.basename(test_c_file)) + '.x' + ext
     outtest2 = os.path.join(xrfi_path, os.path.basename(test_c_file)) + '.g' + ext
     if os.path.exists(outtest1):
         os.remove(outtest1)
     if os.path.exists(outtest2):
         os.remove(outtest2)
     xrfi.xrfi_h1c_run(uvd, history='Just a test.', filename=test_d_file,
                       extension=ext, summary=True, model_file=test_d_file,
                       model_file_format='miriad', calfits_file=test_c_file,
                       xrfi_path=xrfi_path, kt_size=3)
     nt.assert_true(os.path.exists(outtest1))
     nt.assert_true(os.path.exists(outtest2))
Ejemplo n.º 6
0
                tol=args.tol,
                window=args.window,
                skip_wgt=args.skip_wgt,
                maxiter=args.maxiter,
                **kwargs)
io.update_uvdata(dfil.input_data,
                 data=dfil.filtered_residuals,
                 flags=dfil.flags)

# Run xrfi
xrfi.xrfi_h1c_run(dfil.input_data,
                  history,
                  infile_format=args.infile_format,
                  extension=args.extension,
                  summary=args.summary,
                  summary_ext=args.summary_ext,
                  xrfi_path=args.xrfi_path,
                  model_file=args.model_file,
                  model_file_format=args.model_file_format,
                  calfits_file=args.calfits_file,
                  kt_size=args.kt_size,
                  kf_size=args.kf_size,
                  sig_init=args.sig_init,
                  sig_adj=args.sig_adj,
                  px_threshold=args.px_threshold,
                  freq_threshold=args.freq_threshold,
                  time_threshold=args.time_threshold,
                  ex_ants=args.ex_ants,
                  metrics_file=args.metrics_file,
                  filename=args.filename)