From f29f5d6f9e15027000bc5621dfacf86586a89e2d Mon Sep 17 00:00:00 2001 From: Tomas Bylund Date: Tue, 26 Sep 2023 16:53:03 +0200 Subject: [PATCH 1/3] Put multiplication of possibly NaN sensitivity in a warning context to ignore it --- pyirf/sensitivity.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyirf/sensitivity.py b/pyirf/sensitivity.py index a3d1bc6f2..8e7bfbfb3 100644 --- a/pyirf/sensitivity.py +++ b/pyirf/sensitivity.py @@ -250,8 +250,9 @@ def calculate_sensitivity( k = "reco_energy_" + key s[k] = signal_hist[k] - s["n_signal"] = signal_hist["n"] * rel_sens - s["n_signal_weighted"] = signal_hist["n_weighted"] * rel_sens + with np.errstate(invalid="ignore"): + s["n_signal"] = signal_hist["n"] * rel_sens + s["n_signal_weighted"] = signal_hist["n_weighted"] * rel_sens s["n_background"] = background_hist["n"] s["n_background_weighted"] = background_hist["n_weighted"] From 7a94eb4d0a7af463158d4003ec4c78452510a4bd Mon Sep 17 00:00:00 2001 From: Tomas Bylund Date: Tue, 26 Sep 2023 17:01:58 +0200 Subject: [PATCH 2/3] Add changelog --- docs/changes/264.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/264.rst diff --git a/docs/changes/264.rst b/docs/changes/264.rst new file mode 100644 index 000000000..cde1ec34c --- /dev/null +++ b/docs/changes/264.rst @@ -0,0 +1 @@ +Ignore warnings about invalid floating point operations when calculating `n_signal` and `n_signal_weigthed` because the relative sensitivty is frequently NaN. From ddd0946803375d2ac7b4d29d001072b2b7fc1448 Mon Sep 17 00:00:00 2001 From: Tomas Bylund Date: Tue, 26 Sep 2023 17:05:00 +0200 Subject: [PATCH 3/3] Changelog --- docs/changes/{264.rst => 264.feature.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/changes/{264.rst => 264.feature.rst} (100%) diff --git a/docs/changes/264.rst b/docs/changes/264.feature.rst similarity index 100% rename from docs/changes/264.rst rename to docs/changes/264.feature.rst