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.
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.
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 tom_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.