def runDataRef(self, sensorRef): r"""Load the post instrument signature removal image \param[in] sensorRef sensor-level butler data reference \return postIsrExposure exposure to be passed to processCcdExposure """ inputExposure = sensorRef.get("eimage", immediate=True) # eimages are int, but computation needs to be done on floating point values inputExposure = inputExposure.convertF() if self.config.doAddNoise: self.addNoise(inputExposure) if self.config.doSetVariance: self.setVariance(inputExposure) if self.config.maskEdgeBorder > 0: self.maskEdges(inputExposure) # eimages are transposed relative to the read direction. # Transpose the image to do interpolation in the serial direction mi = inputExposure.getMaskedImage() mi = isr.transposeMaskedImage(mi) # We may need to ingest the results of the processing and # ingestProcessed.py expects some specific header cards. # Set the header cards to values appropriate for an image # that has not been read out. md = inputExposure.getMetadata() md.add('RDNOISE', 0.) md.add('SATURATE', self.config.sat_val) md.add('GAINEFF', 1.) # Mask saturation isr.makeThresholdMask( maskedImage=mi, threshold=self.config.sat_val, growFootprints=0, maskName='SAT') # Interpolate isr.interpolateFromMask( maskedImage=mi, fwhm=self.config.interp_size, growFootprints=0, maskName='SAT', ) inputExposure.setMaskedImage(isr.transposeMaskedImage(mi)) return pipeBase.Struct(exposure=inputExposure)
def runDataRef(self, sensorRef): """Load the post instrument signature removal image \param[in] sensorRef sensor-level butler data reference \return postIsrExposure exposure to be passed to processCcdExposure """ inputExposure = sensorRef.get("eimage", immediate=True) # eimages are int, but computation needs to be done on floating point values inputExposure = inputExposure.convertF() if self.config.doAddNoise: self.addNoise(inputExposure) if self.config.doSetVariance: self.setVariance(inputExposure) if self.config.maskEdgeBorder > 0: self.maskEdges(inputExposure) # eimages are transposed relative to the read direction. # Transpose the image to do interpolation in the serial direction mi = inputExposure.getMaskedImage() mi = isr.transposeMaskedImage(mi) # We may need to ingest the results of the processing and # ingestProcessed.py expects some specific header cards. # Set the header cards to values appropriate for an image # that has not been read out. md = inputExposure.getMetadata() md.add('RDNOISE', 0.) md.add('SATURATE', self.config.sat_val) md.add('GAINEFF', 1.) # Mask saturation isr.makeThresholdMask( maskedImage=mi, threshold=self.config.sat_val, growFootprints=0, maskName='SAT') # Interpolate isr.interpolateFromMask( maskedImage=mi, fwhm=self.config.interp_size, growFootprints=self.config.growSaturationFootprintSize, maskName='SAT', ) inputExposure.setMaskedImage(isr.transposeMaskedImage(mi)) return pipeBase.Struct(exposure=inputExposure)
def test_transposeMaskedImage(self): """Expect height and width to be exchanged. """ transposed = ipIsr.transposeMaskedImage(self.mi) self.assertEqual(transposed.getImage().getBBox().getHeight(), self.mi.getImage().getBBox().getWidth()) self.assertEqual(transposed.getImage().getBBox().getWidth(), self.mi.getImage().getBBox().getHeight())