Unverified Commit 177eed1b authored by Akke Viitanen's avatar Akke Viitanen
Browse files

add AGN SED test

parent 99be3af5
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -290,3 +290,39 @@ class TestCatalogAGN(TestCase):
        Ngal = self.catalog_agn["M"].size
        has_bh = self.catalog_agn.get_has_bh()
        self.assertLess(has_bh.sum(), Ngal)

    def test_agn_sed(self):
        from mock_catalog_SED.qsogen_4_catalog import qsosed

        dlog_wav = 7.65e-4
        wavlen = 10 ** np.arange(np.log10(500), np.log10(250000) + dlog_wav, dlog_wav)
        wavlen = np.append(wavlen, [1450, 4400, 5007, 150000])
        wavlen = np.sort(wavlen)

        for i in range(len(self.catalog_agn.catalog)):
            print(i)
            agn_sed = qsosed.Quasar_sed(
                LogL2500=self.catalog_agn["log_L_2500"][i],
                AGN_type=1 + self.catalog_agn["is_optical_type2"][i],
                ebv=self.catalog_agn["E_BV"][i],
                physical_units=True,
                wavlen=wavlen,
                LogL2kev=self.catalog_agn["log_L_2_keV"][i],
                add_NL=self.catalog_agn["is_optical_type2"][i],
                NL_normalization="lamastra",
                Av_lines=self.catalog_galaxy["AVLINES_BULGE"][i] + self.catalog_galaxy["AVLINES_DISK"][i],
                **dict(
                    zip(
                        self.catalog_agn.qsogen_posterior_distribution.parameter_names,
                        *self.catalog_agn.qsogen_posterior_distribution.posterior_distribution.sample().values,
                        strict=False,
                    )
                ),
            )
            x1 = 10 ** self.catalog_agn["log_LX_2_10"][i]
            x2 = 10 ** self.catalog_agn["log_L_2_keV"][i]
            y1 = agn_sed.Lbol / x1
            y2 = agn_sed.Lbol / x2

            # NOTE: implement some test?
            print("%6.2f" % x1, "%6.2f" % y1, "%6.2f" % x2, "%6.2f" % y2)