def test_check_consistency(self): caltable = CalibratorTable.read(self.calfile, path='table') res = caltable.check_consistency(channel='Feed0_LCP') assert np.all(res) res = caltable.check_consistency(channel='Feed0_RCP') assert np.all(res) res = caltable.check_consistency() assert np.all(res)
def test_calibration_plot_two_cols(self): """Simple calibration from scans.""" caltable = CalibratorTable.read(self.calfile, path='table') caltable.plot_two_columns('RA', "Flux/Counts", xerrcol="RA err", yerrcol="Flux/Counts Err", test=True)
def test_calibration_counts(self): """Simple calibration from scans.""" caltable = CalibratorTable.read(self.calfile, path='table') caltable = caltable[compare_strings(caltable['Source'], 'DummyCal')] caltable_0 = caltable[compare_strings(caltable['Chan'], 'Feed0_LCP')] assert np.all( np.abs(caltable_0['Counts'] - 100.) < 3 * caltable_0['Counts Err']) caltable_1 = caltable[compare_strings(caltable['Chan'], 'Feed0_RCP')] assert np.all( np.abs(caltable_1['Counts'] - 80.) < 3 * caltable_1['Counts Err'])
def test_Jy_over_counts_rough_one_bad_value(self, logger, caplog): caltable = CalibratorTable.read(self.calfile, path='table') flux_quantity = _get_flux_quantity('Jy/beam') caltable[flux_quantity + "/Counts"][0] += \ caltable[flux_quantity + "/Counts Err"][0] * 2000 Jc, Jce = caltable.Jy_over_counts_rough(channel='Feed0_LCP', map_unit='Jy/beam') assert 'Outliers: ' in caplog.text Cj, Cje = caltable.counts_over_Jy(channel='Feed0_LCP') np.testing.assert_allclose(Jc, 1 / Cj)
def test_calibration_width(self): """Simple calibration from scans.""" caltable = CalibratorTable.read(self.calfile, path='table') caltable0 = caltable[compare_strings(caltable['Chan'], 'Feed0_LCP')] assert np.all( np.abs(caltable0['Width'] - 2.5/60.) < 5 * caltable0['Width Err']) caltable1 = caltable[compare_strings(caltable['Chan'], 'Feed0_RCP')] assert np.all( np.abs(caltable1['Width'] - 2.5/60.) < 5 * caltable1['Width Err']) beam, beam_err = caltable.beam_width(channel='Feed0_LCP') assert np.all(beam - np.radians(2.5/60) < 3 * beam_err)
def test_calibrated_crossscans(self): caltable = CalibratorTable.read(self.calfile, path='table') dummy_flux, dummy_flux_err = \ caltable.calculate_src_flux(source='DummySrc', channel='Feed0_LCP') assert (dummy_flux[0] - 0.52) < dummy_flux_err[0] * 3
def test_calibration_show(self): """Simple calibration from scans.""" caltable = CalibratorTable.read(self.calfile, path='table') caltable.show()
def test_Jy_over_counts_and_back(self): caltable = CalibratorTable.read(self.calfile, path='table') Jc, Jce = caltable.Jy_over_counts(channel='Feed0_LCP') Cj, Cje = caltable.counts_over_Jy(channel='Feed0_LCP') np.testing.assert_allclose(Jc, 1 / Cj)
def test_check_class_from_file(self): caltable = CalibratorTable.read(self.calfile, path='table') assert caltable.check_up_to_date()