icecube / skyllh

https://icecube.github.io/skyllh/
GNU General Public License v3.0
11 stars 5 forks source link

Fix m_nonzero_bkg definition to avoid overflows. #231

Open juanma-cano-vila opened 2 days ago

juanma-cano-vila commented 2 days ago

Implemented the proposed solution in issue 230.

As a side effect, it will also softer (but not eliminate) the anomalous high TS values for injections where there was no events in the background and kde smoothing was used. The reason is that now the bkg energy pdf is effectively capped to numpy.finfo(np.double).resolution (=1e-15).

This still gives much more margin than the cap_ratio option, which effectively imposes much more restrictive values.

This solution just extends the already solution for the actual zero values when no cap_ratio is present.

https://github.com/icecube/skyllh/blob/6704ef9e796d978e2315425721101badb0e2a0c2/skyllh/analyses/i3/publicdata_ps/pdfratio.py#L230-L237

martwo commented 2 days ago

The fix seems ok. However, I was wondering if the data type (double in this case) should depend on the data type of the PDF values. Because there is the option to compress the data to float32, the limit would also be different in the compressed case.