icecube / skyllh

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

Overflow in pdf ratio with KDE smoothing for public data with injection. #230

Open juanma-cano-vila opened 2 days ago

juanma-cano-vila commented 2 days ago

When injecting events in an analysis instance with the option kde_smoothing=True, it can happen sometimes that the kde smoothing assigns extremely low values to the bkg pdf, of the order of 1e-200 or lower. This can produce for some injected events to run in an overflow when computing the pdf ratio.

In the current implementation we have https://github.com/icecube/skyllh/blob/6704ef9e796d978e2315425721101badb0e2a0c2/skyllh/analyses/i3/publicdata_ps/pdfratio.py#L216-L228

The m_nonzero_bkg = bkg_pd > 0 is not enough when appliying kde smoothing. I suggest to change it to m_nonzero_bkg = bkg_pd > np.finfo(np.double).resolution. This will assign this close to 0 values the same treatment as expected with no kde smoothing.