Beispiel #1
0
    def nu_astronomy(self, flux, e_pdf_dict):
        """Function to convert a local flux in the detector at 1GeV to physical
        quantities for a source of mean luminosity. The
        fluxes are integrated over an energy range, either specified in
        e_pdf_dict, or by default between 100GeV and 10PeV. They are then
        scaled by the luminosity distance to source, giving the mean
        luminosity of the sources in the catalogue. The assumption is that
        the sources are standard candles, so this value would be the same for
        each source, and is thus only calculated once. To convert further from
        this mean luminosity to the luminosity of a specific source,
        the values must be multiplied by the "relative injection weight" of
        the source, which has a mean of 1.

        :param flux: Flux to be converted
        :param e_pdf_dict: Dictionary containing energy PDF information
        :return: Value for the neutrino luminosity
        """
        return calculate_astronomy(flux, e_pdf_dict, self.sources)
                    # disc_e.append(astro_disc[e_key] * inj_time)
                    # disc_25_e.append(astro_disc[e_key] * inj_time * disc_convert)

                    cat = load_catalogue(rh_dict["catalogue"])

                    try:

                        guess = k_to_flux(
                            rh_dict["scale"] / 1.5
                        )

                    except KeyError:
                        guess = np.nan

                    astro_guess = calculate_astronomy(
                        guess, rh_dict["inj_dict"]["injection_energy_pdf"], cat
                    )

                    guess_disc.append(astro_guess[key] * inj_time)
                    guess_disc_e.append(astro_guess[e_key] * inj_time)

                    dist.append(max(cat["distance_mpc"]))
                    n.append(float(len(cat)))

                try:
                    os.makedirs(os.path.dirname(savedir))
                except OSError:
                    pass

                pairs = [
                    (guess_disc, guess_disc_e),