Loading tests/lsst_inaf_agile/test_catalog_agn.py +1 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ class TestCatalogAGN(TestCase): FLUXES.pop(key) flux2 = self.catalog_agn.get_flux_agn("lsst-r", False, idxs=id0) self.assertIn(key, FLUXES) self.assertTrue(flux1 == flux2) self.assertAlmostEqual(flux1, flux2) def test_get_flux_agn(self): # range check on flux Loading tests/lsst_inaf_agile/test_catalog_combined.py +24 −10 Original line number Diff line number Diff line Loading @@ -116,16 +116,16 @@ class TestCatalogCombined(TestCase): self.assertTrue(np.all(c["ID"] >= 0)) self.assertTrue(0 in c["ID"]) self.assertTrue(c["ID"].size == np.unique(c["ID"]).size) # check galaxy columns # check some galaxy columns self.assertTrue(np.all(c["Z"] >= 0)) self.assertTrue(np.any(c["Z"] > 0)) self.assertTrue(np.all(c["M"] >= 0)) self.assertTrue(np.any(c["M"] > 0)) self.assertTrue(np.all(c["SFR"] >= 0)) # check agn columns # check some agn columns self.assertTrue(np.all(c["log_lambda_SAR"] >= -100)) self.assertTrue(np.any(c["is_agn"] == 1)) # check stellar flags are false # check that stellar flags are false is_star = ~(c["Z"] > 0) self.assertTrue(np.all(c["is_agn"][is_star] == 0)) self.assertTrue(np.all(c["is_optical_type2"][is_star] == 0)) Loading Loading @@ -158,12 +158,12 @@ class TestCatalogCombined(TestCase): self.assertTrue(np.any(c["magabs_lsst-y_total"] < 0.0)) # range check fluxes and magabs self.assertTrue(np.all(c["lsst-u_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-g_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-r_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-i_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-z_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-y_total"] < 10000.0)) self.assertTrue(np.all(np.isfinite(c["lsst-u_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-g_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-r_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-i_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-z_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-y_total"]))) def test_get_flux_total(self): # observed flux Loading @@ -180,6 +180,20 @@ class TestCatalogCombined(TestCase): mtot = self.catalog_combined.get_flux_total(f"lsst-{b}", rest_frame=True) self.assertTrue(np.allclose(-2.5 * np.log10(10 ** (-0.4 * m1) + 10 ** (-0.4 * m2)), mtot)) def test_band_flux_equals_egg(self): egg = self.catalog_combined.catalog_galaxy.egg bands = egg["BANDS"][0] # loop through all LSST bands for band in "ugrizy": idx = 0 while bands[idx].strip() != f"lsst-{band}": idx += 1 # loop through both galaxy components for comp in "BULGE", "DISK": flux1 = egg[f"FLUX_{comp}"][0, :, idx] flux2 = self.catalog_combined[f"lsst-{band}_{comp.lower()}"] self.assertTrue(np.allclose(flux1, flux2[: flux1.size])) def test_write(self): # check exists filename = self.catalog_combined.get_filename() Loading Loading @@ -266,7 +280,7 @@ class TestCatalogCombined(TestCase): def test_get_area(self): # try with egg.fits area = self.catalog_combined.get_area() self.assertAlmostEqual(area, 0.001) self.assertAlmostEqual(area, 0.01) # try without egg.fits -> defaults to DR1 area os.system("rm -fv data/tests/test_catalog_combined/egg.fits") Loading tests/lsst_inaf_agile/test_catalog_star.py +3 −1 Original line number Diff line number Diff line Loading @@ -49,8 +49,10 @@ class TestCatalogStar(TestCase): self.assertTrue("RA" in catalog.dtype.names) self.assertTrue("lsst-r_point" in catalog.dtype.names) self.assertTrue("pmdec" in catalog.dtype.names) # test for finite fluxes for b in "ugrizy": self.assertTrue(np.all((catalog[f"lsst-{b}_point"] > 1e-9) & (catalog[f"lsst-{b}_point"] < 1e3))) self.assertTrue(np.all(np.isfinite(catalog[f"lsst-{b}_point"]))) def test__getitem__(self): # test [] operator works as expected Loading tests/lsst_inaf_agile/test_egg.py +2 −2 Original line number Diff line number Diff line Loading @@ -47,11 +47,11 @@ class TestEgg(TestCase): def test_get_argument_line(self): argument_line = self.egg.get_argument_line() self.assertIn("area=0.001", argument_line) self.assertIn("area=0.01", argument_line) self.assertIn("mmin=9.5", argument_line) def test_get_area(self): self.assertEqual(self.egg.get_area(), 0.001) self.assertEqual(self.egg.get_area(), 0.01) def test_run(self): # run EGG Loading Loading
tests/lsst_inaf_agile/test_catalog_agn.py +1 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ class TestCatalogAGN(TestCase): FLUXES.pop(key) flux2 = self.catalog_agn.get_flux_agn("lsst-r", False, idxs=id0) self.assertIn(key, FLUXES) self.assertTrue(flux1 == flux2) self.assertAlmostEqual(flux1, flux2) def test_get_flux_agn(self): # range check on flux Loading
tests/lsst_inaf_agile/test_catalog_combined.py +24 −10 Original line number Diff line number Diff line Loading @@ -116,16 +116,16 @@ class TestCatalogCombined(TestCase): self.assertTrue(np.all(c["ID"] >= 0)) self.assertTrue(0 in c["ID"]) self.assertTrue(c["ID"].size == np.unique(c["ID"]).size) # check galaxy columns # check some galaxy columns self.assertTrue(np.all(c["Z"] >= 0)) self.assertTrue(np.any(c["Z"] > 0)) self.assertTrue(np.all(c["M"] >= 0)) self.assertTrue(np.any(c["M"] > 0)) self.assertTrue(np.all(c["SFR"] >= 0)) # check agn columns # check some agn columns self.assertTrue(np.all(c["log_lambda_SAR"] >= -100)) self.assertTrue(np.any(c["is_agn"] == 1)) # check stellar flags are false # check that stellar flags are false is_star = ~(c["Z"] > 0) self.assertTrue(np.all(c["is_agn"][is_star] == 0)) self.assertTrue(np.all(c["is_optical_type2"][is_star] == 0)) Loading Loading @@ -158,12 +158,12 @@ class TestCatalogCombined(TestCase): self.assertTrue(np.any(c["magabs_lsst-y_total"] < 0.0)) # range check fluxes and magabs self.assertTrue(np.all(c["lsst-u_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-g_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-r_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-i_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-z_total"] < 10000.0)) self.assertTrue(np.all(c["lsst-y_total"] < 10000.0)) self.assertTrue(np.all(np.isfinite(c["lsst-u_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-g_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-r_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-i_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-z_total"]))) self.assertTrue(np.all(np.isfinite(c["lsst-y_total"]))) def test_get_flux_total(self): # observed flux Loading @@ -180,6 +180,20 @@ class TestCatalogCombined(TestCase): mtot = self.catalog_combined.get_flux_total(f"lsst-{b}", rest_frame=True) self.assertTrue(np.allclose(-2.5 * np.log10(10 ** (-0.4 * m1) + 10 ** (-0.4 * m2)), mtot)) def test_band_flux_equals_egg(self): egg = self.catalog_combined.catalog_galaxy.egg bands = egg["BANDS"][0] # loop through all LSST bands for band in "ugrizy": idx = 0 while bands[idx].strip() != f"lsst-{band}": idx += 1 # loop through both galaxy components for comp in "BULGE", "DISK": flux1 = egg[f"FLUX_{comp}"][0, :, idx] flux2 = self.catalog_combined[f"lsst-{band}_{comp.lower()}"] self.assertTrue(np.allclose(flux1, flux2[: flux1.size])) def test_write(self): # check exists filename = self.catalog_combined.get_filename() Loading Loading @@ -266,7 +280,7 @@ class TestCatalogCombined(TestCase): def test_get_area(self): # try with egg.fits area = self.catalog_combined.get_area() self.assertAlmostEqual(area, 0.001) self.assertAlmostEqual(area, 0.01) # try without egg.fits -> defaults to DR1 area os.system("rm -fv data/tests/test_catalog_combined/egg.fits") Loading
tests/lsst_inaf_agile/test_catalog_star.py +3 −1 Original line number Diff line number Diff line Loading @@ -49,8 +49,10 @@ class TestCatalogStar(TestCase): self.assertTrue("RA" in catalog.dtype.names) self.assertTrue("lsst-r_point" in catalog.dtype.names) self.assertTrue("pmdec" in catalog.dtype.names) # test for finite fluxes for b in "ugrizy": self.assertTrue(np.all((catalog[f"lsst-{b}_point"] > 1e-9) & (catalog[f"lsst-{b}_point"] < 1e3))) self.assertTrue(np.all(np.isfinite(catalog[f"lsst-{b}_point"]))) def test__getitem__(self): # test [] operator works as expected Loading
tests/lsst_inaf_agile/test_egg.py +2 −2 Original line number Diff line number Diff line Loading @@ -47,11 +47,11 @@ class TestEgg(TestCase): def test_get_argument_line(self): argument_line = self.egg.get_argument_line() self.assertIn("area=0.001", argument_line) self.assertIn("area=0.01", argument_line) self.assertIn("mmin=9.5", argument_line) def test_get_area(self): self.assertEqual(self.egg.get_area(), 0.001) self.assertEqual(self.egg.get_area(), 0.01) def test_run(self): # run EGG Loading