Skip to content

Commit

Permalink
Always use empirical noise when testing bad column crosstalk.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Sep 12, 2024
1 parent a6641f2 commit dea8b19
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions tests/test_isrTaskLSST.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_isrBootstrapBias(self):
self.assertIn(key, metadata)
self.assertEqual(metadata[key], self.saturation_adu)

self._check_bad_column_crosstalk_correction(result.exposure, units="adu")
self._check_bad_column_crosstalk_correction(result.exposure)

def test_isrBootstrapDark(self):
"""Test processing of a ``bootstrap`` dark frame.
Expand Down Expand Up @@ -226,7 +226,7 @@ def test_isrBootstrapDark(self):
self.assertIn(key, metadata)
self.assertEqual(metadata[key], "adu")

self._check_bad_column_crosstalk_correction(result.exposure, units="adu")
self._check_bad_column_crosstalk_correction(result.exposure)

def test_isrBootstrapFlat(self):
"""Test processing of a ``bootstrap`` flat frame.
Expand Down Expand Up @@ -325,7 +325,7 @@ def test_isrBootstrapFlat(self):
self.assertIn(key, metadata)
self.assertEqual(metadata[key], "adu")

self._check_bad_column_crosstalk_correction(result.exposure, empirical_sigma=True, units="adu")
self._check_bad_column_crosstalk_correction(result.exposure)

def test_isrBias(self):
"""Test processing of a bias frame."""
Expand Down Expand Up @@ -534,7 +534,7 @@ def test_isrFlat(self):
ratio = result2.exposure.image.array / result.exposure.image.array
self.assertFloatsAlmostEqual(ratio, flat_nodefects.image.array, atol=1e-4)

self._check_bad_column_crosstalk_correction(result.exposure, empirical_sigma=True)
self._check_bad_column_crosstalk_correction(result.exposure)

def test_isrNoise(self):
"""Test the recorded noise and gain in the metadata."""
Expand Down Expand Up @@ -1397,8 +1397,6 @@ def _check_bad_column_crosstalk_correction(
self,
exp,
nsigma_cut=5.0,
empirical_sigma=False,
units="electron",
):
"""Test bad column crosstalk correction.
Expand All @@ -1413,19 +1411,10 @@ def _check_bad_column_crosstalk_correction(
Input exposure.
nsigma_cut : `float`, optional
Number of sigma to check for outliers.
empirical_sigma : `bool`, optional
Use empirical sigma? Otherwise use read noise.
units : `str`, optional
Image units?
"""
amp = self.detector[0]
amp_image = exp[amp.getBBox()].image.array
if empirical_sigma:
sigma = median_abs_deviation(amp_image.ravel(), scale="normal")
elif units == "electron":
sigma = self.ptc.noise[amp.getName()]
else:
sigma = self.ptc.noise[amp.getName()] / self.ptc.gain[amp.getName()]
sigma = median_abs_deviation(amp_image.ravel(), scale="normal")

med = np.median(amp_image.ravel())
self.assertLess(amp_image.max(), med + nsigma_cut*sigma)
Expand Down

0 comments on commit dea8b19

Please sign in to comment.