icecube / FIRESONG

FIRst Extragalactic Simulation Of Neutrino and Gamma-ray
Other
18 stars 8 forks source link

FluxPDF.py apparently not working #30

Closed itaboada closed 3 years ago

itaboada commented 3 years ago

But Ignacio may be clueless

renereimann commented 3 years ago

See https://github.com/icecube/FIRESONG/blob/base/FluxPDF.py#L89

            # Number of Sources in
            dN = N_sample * luminosity_function.pdf(10**lum) * deltaL * \
                (population.RedshiftDistribution(z)/int_norm) * deltaz

Here we need to calculate dN which depends on the PDF of the luminosity function. However for a standard candle (a delta distribution) a PDF is not correctly defined (it is zero every where and infinity at the standard candle luminosity). We can fix that in two ways: 1) we can not allow to use a standard candle here, catch that and print a error/warning message 2) Because we are doing things discrete here we have luminosity PDF deltaL which is the integral over a bin width. This quantity is correctly defined for a standard candle. The luminosity PDF deltaL is zero except in the bin containing the standard candle luminosity.

I would propose we use the second option in which case we have to make a if / else to calculate dN depending on the type of luminosity function.

We can check correct behavior by comparing the standard candle case with a log-normal distribution with very tiny width.

PS: An even cleaner way would be to add to each luminosity function a function that returns the integral over a bin width which takes bin center luminosity and bin width as parameters. This leaves it to the luminosity function to define the behavior, which can be the difference between CDFs at the bin edges. This behavior should also work in case of a standard candle.

People can express their opinion on which way to go. The implementation should be straight forward in each case.