Пример #1
0
sens = [[] for _ in src_res]
fracs = [[] for _ in src_res]
disc_pots = [[] for _ in src_res]
sens_e = [[] for _ in src_res]
disc_e = [[] for _ in src_res]

labels = []

for i, (f_type, res) in enumerate(sorted(src_res.items())):
    for (length, rh_dict) in sorted(res.items()):

        rh = ResultsHandler(rh_dict)

        inj_time = length * (60 * 60 * 24)

        astro_sens, astro_disc = rh.astro_values(
            rh_dict["inj_dict"]["injection_energy_pdf"])

        e_key = "Mean Luminosity (erg/s)"

        sens[i].append(rh.sensitivity * inj_time)
        disc_pots[i].append(rh.disc_potential * inj_time)
        sens_e[i].append(astro_sens[e_key] * inj_time)
        disc_e[i].append(astro_disc[e_key] * inj_time)
        fracs[i].append(length)

    labels.append(f_type)
    # plt.plot(fracs, disc_pots, linestyle="--", color=cols[i])

for j, [fluence, energy] in enumerate([[sens, sens_e], [disc_pots, disc_e]]):

    plt.figure()
                                     ["injection_energy_pdf"]["e_min_gev"])
                    e_max_gev.append(rh_dict["inj_dict"]
                                     ["injection_energy_pdf"]["e_max_gev"])

                    # sensitivity/dp normalized per flux normalization GeV-1 cm-2 s-1
                    sens.append(rh.sensitivity)
                    sens_err_low.append(rh.sensitivity_err[0])
                    sens_err_upp.append(rh.sensitivity_err[1])
                    disc_pot.append(rh.disc_potential)
                    disc_ts_threshold.append(rh.disc_ts_threshold)
                    sens_n.append(rh.sensitivity * rh.flux_to_ns)
                    disc_pot_n.append(rh.disc_potential * rh.flux_to_ns)

                    key = "Energy Flux (GeV cm^{-2} s^{-1})"  # old version: "Total Fluence (GeV cm^{-2} s^{-1})"

                    astro_sens, astro_disc = rh.astro_values(
                        rh_dict["inj_dict"]["injection_energy_pdf"])
                    sens_livetime.append(
                        astro_sens[key])  # fluence=integrated over energy
                    disc_pots_livetime.append(astro_disc[key])

                    # Nu energy flux integrated between 100GeV and 10PeV,
                    # indipendently from the e_min_gev, e_max_gev of the injection
                    rh_dict["inj_dict"]["injection_energy_pdf"][
                        "e_min_gev"] = 100
                    rh_dict["inj_dict"]["injection_energy_pdf"][
                        "e_max_gev"] = 1e7
                    astro_sens_100GeV10PeV, astro_disc_100GeV10PeV = rh.astro_values(
                        rh_dict["inj_dict"]["injection_energy_pdf"])
                    sens_livetime_100GeV10PeV.append(
                        astro_sens_100GeV10PeV[key]
                    )  # fluence=integrated over energy
    src_1_frac = old_div(min(catalogue["Distance (Mpc)"])**-2,np.sum(
        catalogue["Distance (Mpc)"] ** -2
    ))

    for i, (f_type, res) in enumerate(sorted(src_res.items())):

        for (length, rh_dict) in sorted(res.items()):
            try:
                rh = ResultsHandler(rh_dict)

                # Convert flux to fluence and source energy

                inj_time = length * 60 * 60 * 24

                astro_sens, astro_disc = rh.astro_values(
                    rh_dict["inj kwargs"]["Injection Energy PDF"])

                key = "Total Fluence (GeV cm^{-2} s^{-1})"

                e_key = "Mean Luminosity (erg/s)"

                sens[i].append(astro_sens[key] * inj_time)
                disc_pots[i].append(astro_disc[key] * inj_time)

                sens_e[i].append(astro_sens[e_key] * inj_time)
                disc_e[i].append(astro_disc[e_key] * inj_time)

                fracs[i].append(length)

            except OSError:
                pass