Exemple #1
0
def test_read_list():
    uv = UVData()
    uv.read_miriad(test_d_file)
    uv.time_array -= 1
    uvf = UVFlag(uv)
    uvf.write(test_outfile, clobber=True)
    uvf.read([test_outfile, test_f_file])
    uvf1 = UVFlag(uv)
    uvf2 = UVFlag(test_f_file)
    nt.assert_true(
        np.array_equal(
            np.concatenate((uvf1.metric_array, uvf2.metric_array), axis=0),
            uvf.metric_array))
    nt.assert_true(
        np.array_equal(
            np.concatenate((uvf1.weights_array, uvf2.weights_array), axis=0),
            uvf.weights_array))
    nt.assert_true(
        np.array_equal(np.concatenate((uvf1.time_array, uvf2.time_array)),
                       uvf.time_array))
    nt.assert_true(
        np.array_equal(
            np.concatenate((uvf1.baseline_array, uvf2.baseline_array)),
            uvf.baseline_array))
    nt.assert_true(
        np.array_equal(np.concatenate((uvf1.ant_1_array, uvf2.ant_1_array)),
                       uvf.ant_1_array))
    nt.assert_true(
        np.array_equal(np.concatenate((uvf1.ant_2_array, uvf2.ant_2_array)),
                       uvf.ant_2_array))
    nt.assert_true(uvf.mode == 'metric')
    nt.assert_true(np.all(uvf.freq_array == uv.freq_array[0]))
    nt.assert_true(np.all(uvf.polarization_array == uv.polarization_array))
Exemple #2
0
def test_read_change_mode():
    uv = UVData()
    uv.read_miriad(test_d_file)
    uvf = UVFlag(uv, mode='flag')
    nt.assert_true(hasattr(uvf, 'flag_array'))
    nt.assert_false(hasattr(uvf, 'metric_array'))
    uvf.write(test_outfile, clobber=True)
    uvf.read(test_f_file)
    nt.assert_true(hasattr(uvf, 'metric_array'))
    nt.assert_false(hasattr(uvf, 'flag_array'))
    uvf.read(test_outfile)
    nt.assert_true(hasattr(uvf, 'flag_array'))
    nt.assert_false(hasattr(uvf, 'metric_array'))
Exemple #3
0
def test_read_change_type():
    uv = UVData()
    uv.read_miriad(test_d_file)
    uvc = UVCal()
    uvc.read_calfits(test_c_file)
    uvf = UVFlag(uvc)
    uvf.write(test_outfile, clobber=True)
    nt.assert_true(hasattr(uvf, 'ant_array'))
    uvf.read(test_f_file)
    nt.assert_false(hasattr(uvf, 'ant_array'))
    nt.assert_true(hasattr(uvf, 'baseline_array'))
    nt.assert_true(hasattr(uvf, 'ant_1_array'))
    nt.assert_true(hasattr(uvf, 'ant_2_array'))
    uvf.read(test_outfile)
    nt.assert_true(hasattr(uvf, 'ant_array'))
    nt.assert_false(hasattr(uvf, 'baseline_array'))
    nt.assert_false(hasattr(uvf, 'ant_1_array'))
    nt.assert_false(hasattr(uvf, 'ant_2_array'))