def testGainAndReadnoise(self): isrTask = IsrTask() detector = DetectorWrapper().detector raw = afwImage.ExposureF(detector.getBBox()) level = 10 readNoise = 1.5 raw.image.set(level) amp = detector[0] for gain in [-1, 0, 0.1, 1, np.NaN]: # Because amplifiers are immutable, we can't change the gain or # read noise in-place. Instead, we clone, and update the clone. testAmp = Amplifier.Builder() testAmp.assign(amp) testAmp.setReadNoise(readNoise) testAmp.setGain(gain) testAmp.finish() isrTask.updateVariance(raw, testAmp) if gain <= 0: # behave the same way as amp.setGain gain = 1 if math.isnan(gain): gain = 1 self.assertEqual(raw.variance[0, 0, afwImage.LOCAL], level / gain + readNoise**2)
def testGainAndReadnoise(self): import lsst.afw.image as afwImage from lsst.afw.cameraGeom.testUtils import DetectorWrapper from lsst.ip.isr import IsrTask isrTask = IsrTask() detector = DetectorWrapper().detector raw = afwImage.ExposureF(detector.getBBox()) level = 10 readNoise = 1 raw.image.set(level) amp = detector[0] amp.setReadNoise(readNoise) for gain in [-1, 0, 0.1, 1]: amp.setGain(gain) isrTask.updateVariance(raw, amp) if gain <= 0: gain = 1 self.assertEqual(raw.variance[0, 0, afwImage.LOCAL], level / gain + readNoise**2)
def testGainAndReadnoise(self): import lsst.afw.image as afwImage from lsst.afw.cameraGeom.testUtils import DetectorWrapper from lsst.ip.isr import IsrTask isrTask = IsrTask() detector = DetectorWrapper().detector raw = afwImage.ExposureF(detector.getBBox()) level = 10 readNoise = 1 raw.image.set(level) amp = detector[0] amp.setReadNoise(readNoise) for gain in [-1, 0, 0.1, 1]: amp.setGain(gain) isrTask.updateVariance(raw, amp) if gain <= 0: gain = 1 self.assertEqual(raw.variance[0, 0, afwImage.LOCAL], level/gain + readNoise**2)