Esempio n. 1
0
    def test_tde_rates(self):

        for evolution in tde_evolutions.keys():
            for rate in local_tde_rates.keys():
                f = get_rate("tde", evolution_name=evolution, rate_name=rate)
                f(zrange)

        f = get_rate("tde", evolution_name="biehl_18_jetted", m=-2)
        true = 2.e-07 / (u.Mpc**3 * u.yr)

        self.assertAlmostEqual(f(1.0)/true, 1.0, delta=0.05)
Esempio n. 2
0
    def test_grn_rates(self):

        for evolution in grb_evolutions.keys():
            for rate in local_grb_rates.keys():
                f = get_rate("grb", evolution_name=evolution, rate_name=rate)
                f(zrange)

        f = get_rate("grb", evolution_name="lien_14")
        true = 1.7635240284867526e-09 / (u.Mpc**3 * u.yr)

        self.assertAlmostEqual(f(1.0)/true, 1.0, delta=0.05)
Esempio n. 3
0
    def test_sfr_rates(self):

        for evolution in sfr_evolutions.keys():
            for rate in local_sfr_rates.keys():
                f = get_rate("sfr", evolution_name=evolution, rate_name=rate)
                f(zrange)

        f = get_rate("sfr")
        true = 0.08687592762508031 * u.solMass / (u.Mpc**3 * u.yr)

        self.assertAlmostEqual(f(1.0)/true, 1.0, delta=0.05)
Esempio n. 4
0
    def test_sim_catalogue(self):

        logging.info("Testing simulate_transient_catalogue util functions.")

        key = "strolger_15"

        ccsn_rate = get_rate("ccsn", evolution_name=key, rate_name=key)

        all_cat_names = simulate_transient_catalogue(
            mh_dict,
            ccsn_rate,
            cat_name="test_sim_cat",
            n_entries=3,
            seed=1111,
            resimulate=True,
        )

        cat = load_catalogue(all_cat_names["Northern"][0])

        print(cat)

        for i, x in enumerate(cat):

            for j, y in enumerate(list(tuple(x))):
                ref = list(default_cat[i])[j]
                if y == 0.0:
                    self.assertEqual(y, ref)
                elif isinstance(y, float):
                    self.assertAlmostEqual(y / ref, 1.0, delta=0.1)
                else:
                    self.assertEqual(y, ref)

        logging.info("Calculated values {0}".format(cat))
        logging.info("Reference  values {0}".format(default_cat))
Esempio n. 5
0
    def test_frb_rates(self):

        for evolution in sfr_evolutions.keys():
            for rate in local_frb_rates.keys():
                f = get_rate("frb", evolution_name=evolution, rate_name=rate)
                f(zrange)

        f_mid, f_low, f_high = get_rate("frb", with_range=True)
        true = [
            0.418741971152887 / (u.Mpc**3 * u.yr),
            0.0637090135917256 / (u.Mpc**3 * u.yr),
            0.9272557341850235 / (u.Mpc**3 * u.yr),
        ]

        for i, f in enumerate([f_mid, f_low, f_high]):
            self.assertAlmostEqual(f(1.0) / true[i], 1.0, delta=0.05)
Esempio n. 6
0
    def test_get_rates(self):

        logging.info("Testing get_rates util functions.")

        for vals in source_maps.values():
            for val in vals:
                f = get_rate(val)
                f(1.0)
Esempio n. 7
0
    def test_ccsn_rates(self):

        for kcc_name in kcc_rates.keys():
            for (subclass_fractions_name, (sn_type, _)) in sn_subclass_rates.items():
                for sn_subclass in sn_type.keys():
                    f = get_rate(
                        "ccsn",
                        kcc_name=kcc_name,
                        sn_subclass=sn_subclass,
                        subclass_fractions_name=subclass_fractions_name
                    )
                    f(zrange)

        f = get_rate("ccsn", sn_subclass="Ibc", fraction=0.5)

        true = 7.236764771169189e-05 / (u.Mpc**3 * u.yr)

        self.assertAlmostEqual(f(1.0)/true, 1.0, delta=0.05)
Esempio n. 8
0
    def test_grb_rates(self):

        for evolution in grb_evolutions.keys():
            for rate in local_grb_rates.keys():
                f = get_rate("grb", evolution_name=evolution, rate_name=rate)
                f(zrange)

        f_mid, f_low, f_high = get_rate(
            "grb", evolution_name="lien_14", with_range=True
        )
        true = [
            1.7635240284867526e-09 / (u.Mpc**3 * u.yr),
            1.6290956630551653e-09 / (u.Mpc**3 * u.yr),
            1.9705101110066845e-09 / (u.Mpc**3 * u.yr),
        ]

        for i, f in enumerate([f_mid, f_low, f_high]):
            self.assertAlmostEqual(f(1.0) / true[i], 1.0, delta=0.05)
Esempio n. 9
0
    def test_tde_rates(self):

        for evolution in tde_evolutions.keys():
            for rate in local_tde_rates.keys():
                f = get_rate("tde", evolution_name=evolution, rate_name=rate)
                f(zrange)

        f_mid, f_low, f_high = get_rate(
            "tde", evolution_name="biehl_18_jetted", m=-2, with_range=True
        )
        true = [
            2.0e-07 / (u.Mpc**3 * u.yr),
            1.0e-07 / (u.Mpc**3 * u.yr),
            3.0e-07 / (u.Mpc**3 * u.yr),
        ]

        for i, f in enumerate([f_mid, f_low, f_high]):
            self.assertAlmostEqual(f(1.0) / true[i], 1.0, delta=0.05)