From 64f62fa6cecdb90167b2bf9e53631800aaa340c1 Mon Sep 17 00:00:00 2001 From: Peter Drmota Date: Wed, 8 May 2024 15:36:51 +0100 Subject: [PATCH] plots.xy_1d: fixup combined_uncertainty (subtract number of nans) --- ndscan/plots/xy_1d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndscan/plots/xy_1d.py b/ndscan/plots/xy_1d.py index ddb7828d..2d4518c1 100644 --- a/ndscan/plots/xy_1d.py +++ b/ndscan/plots/xy_1d.py @@ -46,8 +46,8 @@ def combined_uncertainty(points: list[SourcePoint], num_samples_per_point=1): where we overestimate the true standard deviation if actually, ``num_samples_per_point > 1``. """ - n = len(points) y = [p.y for p in points] + n = len(y) - np.count_nonzero(np.isnan(y)) total_var = np.nanvar(y) / max(1, num_samples_per_point * n - 1) # max() avoids 0/0 if points[0].y_err is not None: total_var += sum(p.y_err**2 for p in points) / n**2