Exemplo n.º 1
0
 def setUp(self):
     """Setup for tests of basic methods."""
     self.uv_object = UVData()
     self.testfile = os.path.join(DATA_PATH, 'day2_TDEM0003_10s_norx_1src_1spw.uvfits')
     uvtest.checkWarnings(self.uv_object.read_uvfits, [self.testfile],
                          message='Telescope EVLA is not')
     self.uv_object2 = copy.deepcopy(self.uv_object)
Exemplo n.º 2
0
def test_noSPW():
    """Test reading in a PAPER uvfits file with no spw axis."""
    UV = UVData()
    testfile_no_spw = os.path.join(DATA_PATH, 'zen.2456865.60537.xy.uvcRREAAM.uvfits')
    status = uvtest.checkWarnings(UV.read_uvfits, [testfile_no_spw],
                                  known_warning='paper_uvfits')
    nt.assert_true(status)
    del(UV)
Exemplo n.º 3
0
def test_writePAPER():
    """Test reading & writing PAPER Miriad file."""
    UV = UVData()
    testfile = os.path.join(DATA_PATH, 'zen.2456865.60537.xy.uvcRREAA')
    write_file = os.path.join(DATA_PATH, 'test/outtest_miriad.uv')
    status = uvtest.checkWarnings(UV.read_miriad, [testfile],
                                  known_warning='miriad')
    UV.write_miriad(write_file, clobber=True)
    nt.assert_true(status)
    del(UV)
Exemplo n.º 4
0
 def test_antnums_to_baselines(self):
     """Test antums to baseline conversion for 256 & larger conventions."""
     nt.assert_equal(self.uv_object.antnums_to_baseline(0, 0), 67585)
     nt.assert_equal(self.uv_object.antnums_to_baseline(257, 256), 592130)
     # Check attempt256
     nt.assert_equal(self.uv_object.antnums_to_baseline(0, 0, attempt256=True), 257)
     nt.assert_equal(self.uv_object.antnums_to_baseline(257, 256), 592130)
     nt.assert_true(uvtest.checkWarnings(self.uv_object.antnums_to_baseline,
                                         [257, 256], {'attempt256': True},
                                         message='found > 256 antennas'))
     nt.assert_raises(StandardError, self.uv_object2.antnums_to_baseline, 0, 0)
Exemplo n.º 5
0
def test_phase_unphaseHERA():
    """
    Read in drift data, phase to an RA/DEC, unphase and check for object equality.
    """
    testfile = os.path.join(DATA_PATH, 'hera_testfile')
    UV_raw = UVData()
    # Note the RA/DEC values in the raw file were calculated from the lat/long
    # in the file, which don't agree with our known_telescopes.
    # So for this test we use the lat/lon in the file.
    status = uvtest.checkWarnings(UV_raw.read_miriad, [testfile],
                                  {'correct_lat_lon': False}, known_warning='miriad')

    UV_phase = UVData()
    status = uvtest.checkWarnings(UV_phase.read_miriad, [testfile],
                                  {'correct_lat_lon': False}, known_warning='miriad')
    UV_phase.phase(0., 0., ephem.J2000)
    UV_phase.unphase_to_drift()

    nt.assert_equal(UV_raw, UV_phase)
    del(UV_phase)
    del(UV_raw)
Exemplo n.º 6
0
def test_ReadNRAO():
    """Test reading in a CASA tutorial uvfits file."""
    UV = UVData()
    testfile = os.path.join(DATA_PATH, 'day2_TDEM0003_10s_norx_1src_1spw.uvfits')
    expected_extra_keywords = ['OBSERVER', 'SORTORD', 'SPECSYS',
                               'RESTFREQ', 'ORIGIN']
    status = uvtest.checkWarnings(UV.read_uvfits, [testfile],
                                  message='Telescope EVLA is not')
    nt.assert_true(status)
    nt.assert_equal(expected_extra_keywords.sort(),
                    UV.extra_keywords.keys().sort())
    del(UV)
Exemplo n.º 7
0
def test_ReadUVFitsWriteMiriad():
    """
    read uvfits, write miriad test.
    Read in uvfits file, write out as miriad, read back in and check for
    object equality.
    """
    uvfits_uv = UVData()
    miriad_uv = UVData()
    uvfits_file = os.path.join(DATA_PATH, 'day2_TDEM0003_10s_norx_1src_1spw.uvfits')
    testfile = os.path.join(DATA_PATH, 'test/outtest_miriad')
    read_status = uvtest.checkWarnings(uvfits_uv.read_uvfits, [uvfits_file],
                                       message='Telescope EVLA is not')
    uvfits_uv.write_miriad(testfile, clobber=True)
    miriad_read_status = uvtest.checkWarnings(miriad_uv.read_miriad, [testfile],
                                              message='Telescope EVLA is not')
    nt.assert_true(read_status)
    nt.assert_true(miriad_read_status)

    nt.assert_equal(miriad_uv, uvfits_uv)
    del(uvfits_uv)
    del(miriad_uv)
Exemplo n.º 8
0
def test_readwriteread():
    """
    CASA tutorial uvfits loopback test.

    Read in uvfits file, write out new uvfits file, read back in and check for
    object equality.
    """
    uv_in = UVData()
    uv_out = UVData()
    testfile = os.path.join(DATA_PATH, 'day2_TDEM0003_10s_norx_1src_1spw.uvfits')
    write_file = os.path.join(DATA_PATH, 'test/outtest_casa.uvfits')
    read_status = uvtest.checkWarnings(uv_in.read_uvfits, [testfile],
                                       message='Telescope EVLA is not')
    uv_in.write_uvfits(write_file)
    write_status = uvtest.checkWarnings(uv_out.read_uvfits, [write_file],
                                        message='Telescope EVLA is not')
    nt.assert_true(read_status)
    nt.assert_true(write_status)
    nt.assert_equal(uv_in, uv_out)
    del(uv_in)
    del(uv_out)
Exemplo n.º 9
0
def test_breakReadFHD():
    """Try various cases of incomplete file lists."""
    fhd_uv = UVData()
    nt.assert_raises(StandardError, fhd_uv.read_fhd, testfiles[1:])  # Missing flags
    del(fhd_uv)
    fhd_uv = UVData()
    subfiles = [item for sublist in [testfiles[0:2], testfiles[3:]] for item in sublist]
    nt.assert_raises(StandardError, fhd_uv.read_fhd, subfiles)  # Missing params
    del(fhd_uv)
    fhd_uv = UVData()
    nt.assert_raises(StandardError, fhd_uv.read_fhd, ['foo'])  # No data files
    del(fhd_uv)
    fhd_uv = UVData()
    nt.assert_true(uvtest.checkWarnings(fhd_uv.read_fhd, [testfiles[:-1]],
                                        message=['No settings']))
    nt.assert_equal(fhd_uv.history, '')  # Check empty history with no settings
    del(fhd_uv)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
def test_readWriteReadMiriad():
    """
    PAPER file Miriad loopback test.

    Read in Miriad PAPER file, write out as new Miriad file, read back in and
    check for object equality.
    """
    uv_in = UVData()
    uv_out = UVData()
    testfile = os.path.join(DATA_PATH, 'zen.2456865.60537.xy.uvcRREAA')
    write_file = os.path.join(DATA_PATH, 'test/outtest_miriad.uv')
    status = uvtest.checkWarnings(uv_in.read_miriad, [testfile],
                                  known_warning='miriad')
    uv_in.write_miriad(write_file, clobber=True)
    uv_out.read_miriad(write_file)

    nt.assert_true(status)
    nt.assert_equal(uv_in, uv_out)
    del(uv_in)
    del(uv_out)