From 17c7d1b65f92976e06a28debebc3cdc58dc42f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Neveu?= Date: Wed, 4 Dec 2024 08:59:17 +0000 Subject: [PATCH] remove minimum or negative values for stat fit in check_statistical_error() --- spectractor/extractor/images.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spectractor/extractor/images.py b/spectractor/extractor/images.py index 7e8af86f..a0527d1b 100644 --- a/spectractor/extractor/images.py +++ b/spectractor/extractor/images.py @@ -421,10 +421,8 @@ def check_statistical_error(self): raise AttributeError(f"Noise map must be in ADU units to be plotted and analyzed. " f"Currently self.units={self.units}.") data = np.copy(self.data) - min_noz = np.min(data[data > 0]) - data[data <= 0] = min_noz - y = self.err.flatten() ** 2 - x = data.flatten() + y = self.err[data > 0].flatten() ** 2 + x = data[data > 0].flatten() fit, cov, model = fit_poly1d(x, y, order=1) gain = 1 / fit[0] read_out = np.sqrt(fit[1]) * gain