Skip to content

Commit

Permalink
Merge pull request #162 from LSSTDESC/161-bug-in-check_statistical_error
Browse files Browse the repository at this point in the history
remove minimum or negative values for stat fit in check_statistical_e…
  • Loading branch information
jeremyneveu authored Dec 4, 2024
2 parents 19c4abb + 17c7d1b commit b92627a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions spectractor/extractor/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b92627a

Please sign in to comment.