def test_ReadFHD_model(): """FHD to uvfits loopback test with model visibilities.""" fhd_uv = UVData() uvfits_uv = UVData() fhd_uv.read_fhd(testfiles, use_model=True) fhd_uv.write_uvfits(os.path.join(DATA_PATH, 'test/outtest_FHD_1061316296_model.uvfits'), spoof_nonessential=True) uvfits_uv.read_uvfits(os.path.join(DATA_PATH, 'test/outtest_FHD_1061316296_model.uvfits')) nt.assert_equal(fhd_uv, uvfits_uv) del(fhd_uv) del(uvfits_uv)
def test_ReadFHDWriteReadUVFits(): """ FHD to uvfits loopback test. Read in FHD files, write out as uvfits, read back in and check for object equality. """ fhd_uv = UVData() uvfits_uv = UVData() fhd_uv.read_fhd(testfiles) fhd_uv.write_uvfits(os.path.join(DATA_PATH, 'test/outtest_FHD_1061316296.uvfits'), spoof_nonessential=True) uvfits_uv.read_uvfits(os.path.join(DATA_PATH, 'test/outtest_FHD_1061316296.uvfits')) nt.assert_equal(fhd_uv, uvfits_uv) del(fhd_uv) del(uvfits_uv)
def test_ReadMiriadWriteUVFits(): """ Miriad to uvfits loopback test. Read in Miriad files, write out as uvfits, read back in and check for object equality. """ miriad_uv = UVData() uvfits_uv = UVData() miriad_file = os.path.join(DATA_PATH, 'zen.2456865.60537.xy.uvcRREAA') testfile = os.path.join(DATA_PATH, 'test/outtest_miriad.uvfits') miriad_status = uvtest.checkWarnings(miriad_uv.read_miriad, [miriad_file], known_warning='miriad') miriad_uv.write_uvfits(testfile, spoof_nonessential=True, force_phase=True) uvfits_uv.read_uvfits(testfile) nt.assert_true(miriad_status) nt.assert_equal(miriad_uv, uvfits_uv) del(miriad_uv) del(uvfits_uv)
#! /usr/bin/env python import argparse import os.path as op from uvdata import UVData parser = argparse.ArgumentParser() parser.add_argument('uvfits_read', help='name of a uvfits file to read in') parser.add_argument('uvfits_write', help='name of a uvfits file to write out') args = parser.parse_args() uvfits_file_in = args.uvfits_read if not op.isfile(uvfits_file_in): raise IOError('There is no file named {}'.format(args.uvfits_file_in)) uvfits_file_out = args.uvfits_write this_uv = UVData() this_uv.read_uvfits(uvfits_file_in) this_uv.write_uvfits(uvfits_file_out) del(this_uv)