def get_stacked_sens_dict(pdf_type):
    base = raw_output_dir + f"/calculate_sensitivity_ps-v002p03/{mh_name}/{pdf_type}/"
    file = limit_sens(base)
    logging.debug(f"loading {file}")
    with open(file, "rb") as f:
        stacked_sens_flux_dictionary = pickle.load(f)
    return stacked_sens_flux_dictionary
Exemple #2
0
                    logging.debug('y: ' + str(y))

                    # ax.set_ylim(0.95 * min(y),
                    #             1.1 * max(y))

                plt.title("Stacked " + ["Sensitivity", "Discovery Potential"][j] +
                          " for " + cat_name + " SNe")

                plt.tight_layout()
                plt.savefig(plot_output_dir(name) + "/spectral_index_" +
                            ["sens", "disc"][j] + "_" + cat_name + ".pdf")
                plt.close()

    # ================================       save sensitivities        ============================== #

    with open(limit_sens(mh_name, pdf_type), 'wb') as f:
        pickle.dump(stacked_sens_flux, f)

    # =================================        make final plots       =============================== #

    # loop over gammas to make a plots for each spectral indice
    for gamma in gammas:

        # -------------    plot sensitivity against box length   ------------------- #
        flux_fig, flux_ax = plt.subplots()

        # loop over SN catalogues and plot the sensitivities against the decay length
        for cat_name, cat_dict in stacked_sens_flux.items():

            x_raw = [float(key) for key in cat_dict.keys()]
            x = np.array(x_raw)[np.argsort(x_raw)] / 364.25
Exemple #3
0
def get_stacked_sens_dict(pdf_type):
    file = limit_sens(mh_name, pdf_type)
    logging.debug(f'loading {file}')
    with open(file, 'rb') as f:
        stacked_sens_flux_dictionary = pickle.load(f)
    return stacked_sens_flux_dictionary
Exemple #4
0
                    # ax.set_ylim(0.95 * min(y),
                    #             1.1 * max(y))

                plt.title("Stacked " +
                          ["Sensitivity", "Discovery Potential"][j] + " for " +
                          cat_name + " SNe")

                plt.tight_layout()
                plt.savefig(
                    plot_output_dir(name) + "/spectral_index_" +
                    ["sens", "disc"][j] + "_" + cat_name + ".pdf")
                plt.close()

    # ================================       save sensitivities        ============================== #

    with open(limit_sens(raw), "wb") as f:
        pickle.dump(stacked_sens_flux, f)

    # =================================        make final plots       =============================== #

    # loop over gammas to make a plots for each spectral indice
    for gamma in gammas:

        # -------------    plot sensitivity against box length   ------------------- #
        flux_fig, flux_ax = plt.subplots()

        # loop over SN catalogues and plot the sensitivities against the box length
        for cat_name, cat_dict in stacked_sens_flux.items():

            x_raw = [float(key) for key in cat_dict.keys()]
            x = np.array(x_raw)[np.argsort(x_raw)]