def test_to_waterfall_bl_flags_or(): uvf = UVFlag(test_f_file) uvf.to_flag() uvf.weights_array = np.ones_like(uvf.weights_array) uvf.to_waterfall(method='or') nt.assert_true(uvf.type == 'waterfall') nt.assert_true(uvf.mode == 'flag') nt.assert_true(uvf.flag_array.shape == (len(uvf.time_array), len(uvf.freq_array), len(uvf.polarization_array))) nt.assert_true( np.array_equal(uvf.weights_array, np.ones_like(uvf.flag_array, np.float))) uvf = UVFlag(test_f_file) uvf.to_flag() uvf.weights_array = np.ones_like(uvf.weights_array) uvf.weights_array[0, 0, 0, 0] = 0.2 uvtest.checkWarnings(uvf.to_waterfall, [], {'method': 'or'}, nwarnings=1, message='Currently weights are') nt.assert_true(uvf.type == 'waterfall') nt.assert_true(uvf.mode == 'flag') nt.assert_true(uvf.flag_array.shape == (len(uvf.time_array), len(uvf.freq_array), len(uvf.polarization_array))) nt.assert_true( np.array_equal(uvf.weights_array, np.ones_like(uvf.flag_array, np.float)))
def test_to_waterfall_waterfall(): uvf = UVFlag(test_f_file) uvf.weights_array = np.ones_like(uvf.weights_array) uvf.to_waterfall() uvtest.checkWarnings(uvf.to_waterfall, [], {}, nwarnings=1, message='This object is already a waterfall')
def test_to_waterfall_bl(): uvf = UVFlag(test_f_file) uvf.weights_array = np.ones_like(uvf.weights_array) uvf.to_waterfall() nt.assert_true(uvf.type == 'waterfall') nt.assert_true(uvf.metric_array.shape == (len(uvf.time_array), len(uvf.freq_array), len(uvf.polarization_array))) nt.assert_true(uvf.weights_array.shape == uvf.metric_array.shape)
def test_to_waterfall_ant(): uvc = UVCal() uvc.read_calfits(test_c_file) uvf = UVFlag(uvc) uvf.weights_array = np.ones_like(uvf.weights_array) uvf.to_waterfall() nt.assert_true(uvf.type == 'waterfall') nt.assert_true(uvf.metric_array.shape == (len(uvf.time_array), len(uvf.freq_array), len(uvf.polarization_array))) nt.assert_true(uvf.weights_array.shape == uvf.metric_array.shape)
def test_to_waterfall_bl_multi_pol(): uvf = UVFlag(test_f_file) uvf.weights_array = np.ones_like(uvf.weights_array) uvf2 = uvf.copy() uvf2.polarization_array[0] = -4 uvf.__add__(uvf2, inplace=True, axis='pol') # Concatenate to form multi-pol object uvf2 = uvf.copy() # Keep a copy to run with keep_pol=False uvf.to_waterfall() nt.assert_true(uvf.type == 'waterfall') nt.assert_true(uvf.metric_array.shape == (len(uvf.time_array), len(uvf.freq_array), len(uvf.polarization_array))) nt.assert_true(uvf.weights_array.shape == uvf.metric_array.shape) nt.assert_true(len(uvf.polarization_array) == 2) # Repeat with keep_pol=False uvf2.to_waterfall(keep_pol=False) nt.assert_true(uvf2.type == 'waterfall') nt.assert_true(uvf2.metric_array.shape == (len(uvf2.time_array), len(uvf.freq_array), 1)) nt.assert_true(uvf2.weights_array.shape == uvf2.metric_array.shape) nt.assert_true(len(uvf2.polarization_array) == 1) nt.assert_true(uvf2.polarization_array[0] == ','.join( map(str, uvf.polarization_array)))