1027 Mask SATURATED and SUSPECT pixels and check if any amplifiers
1032 badAmpDict : `str` [`bool`]
1033 Dictionary of amplifiers, keyed by name, value is True if
1034 amplifier is fully masked.
1035 ccdExposure : `lsst.afw.image.Exposure`
1036 Input exposure to be masked.
1037 detector : `lsst.afw.cameraGeom.Detector`
1039 defects : `lsst.ip.isr.Defects`
1040 List of defects. Used to determine if an entire
1042 detectorConfig : `lsst.ip.isr.OverscanDetectorConfig`
1043 Per-amplifier configurations.
1044 ptc : `lsst.ip.isr.PhotonTransferCurveDataset`, optional
1045 PTC dataset (used if configured to use PTCTURNOFF).
1049 badAmpDict : `str`[`bool`]
1050 Dictionary of amplifiers, keyed by name.
1052 maskedImage = ccdExposure.getMaskedImage()
1054 metadata = ccdExposure.metadata
1056 if self.config.doSaturation
and self.config.defaultSaturationSource ==
"PTCTURNOFF" and ptc
is None:
1057 raise RuntimeError(
"Must provide ptc if using PTCTURNOFF as saturation source.")
1058 if self.config.doSuspect
and self.config.defaultSuspectSource ==
"PTCTURNOFF" and ptc
is None:
1059 raise RuntimeError(
"Must provide ptc if using PTCTURNOFF as suspect source.")
1061 for amp
in detector:
1062 ampName = amp.getName()
1064 ampConfig = detectorConfig.getOverscanAmpConfig(amp)
1066 if badAmpDict[ampName]:
1072 if self.config.doSaturation:
1073 if self.config.defaultSaturationSource ==
"PTCTURNOFF":
1074 limits.update({self.config.saturatedMaskName: ptc.ptcTurnoff[amp.getName()]})
1075 elif self.config.defaultSaturationSource ==
"CAMERAMODEL":
1077 limits.update({self.config.saturatedMaskName: amp.getSaturation()})
1078 elif self.config.defaultSaturationSource ==
"NONE":
1079 limits.update({self.config.saturatedMaskName: numpy.inf})
1082 if math.isfinite(ampConfig.saturation):
1083 limits.update({self.config.saturatedMaskName: ampConfig.saturation})
1084 metadata[f
"LSST ISR SATURATION LEVEL {ampName}"] = limits[self.config.saturatedMaskName]
1086 if self.config.doSuspect:
1087 if self.config.defaultSuspectSource ==
"PTCTURNOFF":
1088 limits.update({self.config.suspectMaskName: ptc.ptcTurnoff[amp.getName()]})
1089 elif self.config.defaultSuspectSource ==
"CAMERAMODEL":
1091 limits.update({self.config.suspectMaskName: amp.getSuspectLevel()})
1092 elif self.config.defaultSuspectSource ==
"NONE":
1093 limits.update({self.config.suspectMaskName: numpy.inf})
1096 if math.isfinite(ampConfig.suspectLevel):
1097 limits.update({self.config.suspectMaskName: ampConfig.suspectLevel})
1098 metadata[f
"LSST ISR SUSPECT LEVEL {ampName}"] = limits[self.config.suspectMaskName]
1100 for maskName, maskThreshold
in limits.items():
1101 if not math.isnan(maskThreshold):
1102 dataView = maskedImage.Factory(maskedImage, amp.getRawBBox())
1103 toMask = (dataView.image.array >= maskThreshold)
1104 dataView.mask.array[toMask] |= dataView.mask.getPlaneBitMask(maskName)
1108 maskView = afwImage.Mask(maskedImage.getMask(), amp.getRawDataBBox(),
1110 maskVal = maskView.getPlaneBitMask([self.config.saturatedMaskName,
1111 self.config.suspectMaskName])
1112 if numpy.all(maskView.getArray() & maskVal > 0):
1113 self.log.warning(
"Amplifier %s is bad (completely SATURATED or SUSPECT)", ampName)
1114 badAmpDict[ampName] =
True
1115 maskView |= maskView.getPlaneBitMask(
"BAD")
2044 deferredChargeCalib=None,
2047 gainCorrection=None,
2051 electroBfDistortionMatrix=None,
2056 """Run the IsrTaskLSST task.
2060 ccdExposure : `lsst.afw.image.Exposure`
2061 Exposure to run ISR.
2062 dnlLUT : `None`, optional
2063 DNL lookup table; placeholder, unused.
2064 bias : `lsst.afw.image.Exposure`, optional
2066 deferredChargeCalib : `lsst.ip.isr.DeferredChargeCalib`, optional
2067 Deferred charge calibration.
2068 linearizer : `lsst.ip.isr.Linearizer`, optional
2069 Linearizer calibration.
2070 ptc : `lsst.ip.isr.PhotonTransferCurveDataset`, optional
2072 gainCorrection : `lsst.ip.isr.GainCorrection`, optional
2073 Gain correction dataset.
2074 crosstalk : `lsst.ip.isr.CrosstalkCalib`, optional
2075 Crosstalk calibration dataset.
2076 defects : `lsst.ip.isr.Defects`, optional
2078 bfKernel : `lsst.ip.isr.BrighterFatterKernel`, optional
2079 Brighter-fatter kernel dataset.
2080 dark : `lsst.afw.image.Exposure`, optional
2082 flat : `lsst.afw.image.Exposure`, optional
2084 camera : `lsst.afw.cameraGeom.Camera`, optional
2089 result : `lsst.pipe.base.Struct`
2091 ``exposure``: `lsst.afw.image.Exposure`
2092 Calibrated exposure.
2093 ``outputBin1Exposure``: `lsst.afw.image.Exposure`
2094 Binned exposure (bin1 config).
2095 ``outputBin2Exposure``: `lsst.afw.image.Exposure`
2096 Binned exposure (bin2 config).
2097 ``outputExposure``: `lsst.afw.image.Exposure`
2098 Calibrated exposure (same as ``exposure``).
2099 ``outputStatistics``: `lsst.ip.isr.isrStatistics`
2100 Calibrated exposure statistics.
2102 detector = ccdExposure.getDetector()
2104 overscanDetectorConfig = self.config.overscanCamera.getOverscanDetectorConfig(detector)
2106 if self.config.doBootstrap:
2108 self.log.warning(
"Task configured with doBootstrap=True. Ignoring provided PTC.")
2111 if self.config.useGainsFrom ==
"LINEARIZER":
2112 if linearizer
is None:
2113 raise RuntimeError(
"doBootstrap==False and useGainsFrom == 'LINEARIZER' but "
2114 "no linearizer provided.")
2115 elif self.config.useGainsFrom ==
"PTC":
2117 raise RuntimeError(
"doBootstrap==False and useGainsFrom == 'PTC' but no PTC provided.")
2120 exposureMetadata = ccdExposure.metadata
2121 doRaise = self.config.doRaiseOnCalibMismatch
2122 keywords = self.config.cameraKeywordsToCompare
2123 if not self.config.doBootstrap:
2124 if self.config.useGainsFrom ==
"LINEARIZER":
2126 "LINEARIZER", log=self.log)
2127 elif self.config.useGainsFrom ==
"PTC":
2131 if self.config.doCorrectGains
and gainCorrection
is not None:
2141 if self.config.doCorrectGains:
2142 raise RuntimeError(
"doCorrectGains is True but no ptc provided.")
2143 if self.config.doDiffNonLinearCorrection:
2145 raise RuntimeError(
"doDiffNonLinearCorrection is True but no dnlLUT provided.")
2147 if self.config.doLinearize:
2148 if linearizer
is None:
2149 raise RuntimeError(
"doLinearize is True but no linearizer provided.")
2151 if self.config.doBias:
2153 raise RuntimeError(
"doBias is True but no bias provided.")
2156 if self.config.doCrosstalk:
2157 if crosstalk
is None:
2158 raise RuntimeError(
"doCrosstalk is True but no crosstalk provided.")
2160 if self.config.doDeferredCharge:
2161 if deferredChargeCalib
is None:
2162 raise RuntimeError(
"doDeferredCharge is True but no deferredChargeCalib provided.")
2167 deferredChargeCalib,
2171 if self.config.doDefect:
2173 raise RuntimeError(
"doDefect is True but no defects provided.")
2175 if self.config.doDark:
2177 raise RuntimeError(
"doDark is True but no dark frame provided.")
2180 if self.config.doBrighterFatter:
2181 if self.config.brighterFatterCorrectionMethod
in [
"ASTIER23",
"ASTIER23+FILTERCORRECTION"]:
2182 if electroBfDistortionMatrix
is None:
2183 raise RuntimeError(
"Must supply an electroBfDistortionMatrix if BF "
2184 "correction method is ASTIER23*.")
2186 electroBfDistortionMatrix,
"bf", log=self.log)
2187 elif self.config.brighterFatterCorrectionMethod
in [
"COULTON18",
"COULTON18_FLUX_CONSERVING"]:
2188 if bfKernel
is None:
2189 raise RuntimeError(
"Must supply an kernel if BF correction method is COULTON*.")
2192 raise ValueError(
"%s is not a known brighter-fatter correction "
2193 "method." % self.config.brighterFatterCorrectionMethod)
2194 if self.config.doFlat:
2196 raise RuntimeError(
"doFlat is True but no flat provided.")
2199 if self.config.doSaturation:
2200 if self.config.defaultSaturationSource
in [
"PTCTURNOFF",]:
2203 "doSaturation is True and defaultSaturationSource is "
2204 f
"{self.config.defaultSaturationSource}, but no ptc provided."
2206 if self.config.doSuspect:
2207 if self.config.defaultSuspectSource
in [
"PTCTURNOFF",]:
2210 "doSuspect is True and defaultSuspectSource is "
2211 f
"{self.config.defaultSuspectSource}, but no ptc provided."
2214 if self.config.doCheckUnprocessableData
and self.config.bssVoltageMinimum > 0.0:
2221 exposureMetadata[
"LSST ISR UNITS"] =
"adu"
2222 exposureMetadata[
"LSST ISR GAINCORRECTION APPLIED"] =
False
2223 exposureMetadata[
"LSST ISR CROSSTALK APPLIED"] =
False
2224 exposureMetadata[
"LSST ISR OVERSCANLEVEL CHECKED"] =
False
2225 exposureMetadata[
"LSST ISR NOISE CHECKED"] =
False
2226 exposureMetadata[
"LSST ISR LINEARIZER APPLIED"] =
False
2227 exposureMetadata[
"LSST ISR CTI APPLIED"] =
False
2228 exposureMetadata[
"LSST ISR BIAS APPLIED"] =
False
2229 exposureMetadata[
"LSST ISR DARK APPLIED"] =
False
2230 exposureMetadata[
"LSST ISR BF APPLIED"] =
False
2231 exposureMetadata[
"LSST ISR FLAT APPLIED"] =
False
2232 exposureMetadata[
"LSST ISR DEFECTS APPLIED"] =
False
2234 if self.config.doBootstrap:
2235 self.log.info(
"Configured using doBootstrap=True; using gain of 1.0 (adu units)")
2237 for amp
in detector:
2238 ptc.gain[amp.getName()] = 1.0
2239 ptc.noise[amp.getName()] = 0.0
2240 ptc.ptcTurnoff[amp.getName()] = numpy.inf
2241 elif self.config.useGainsFrom ==
"LINEARIZER":
2242 self.log.info(
"Using gains from linearizer.")
2245 for amp
in detector:
2246 ptc.gain[amp.getName()] = linearizer.inputGain[amp.getName()]
2247 ptc.noise[amp.getName()] = 0.0
2248 ptc.ptcTurnoff[amp.getName()] = linearizer.inputTurnoff[amp.getName()]
2250 exposureMetadata[
"LSST ISR BOOTSTRAP"] = self.config.doBootstrap
2253 gains = copy.copy(ptc.gain)
2257 for amp
in detector:
2258 if not math.isnan(gain := overscanDetectorConfig.getOverscanAmpConfig(amp).gain):
2259 gains[amp.getName()] = gain
2261 "Overriding gain for amp %s with configured value of %.3f.",
2268 self.log.debug(
"Converting exposure to floating point values.")
2280 if self.config.doDiffNonLinearCorrection:
2291 if overscanDetectorConfig.doAnySerialOverscan:
2294 overscanDetectorConfig,
2300 if self.config.doBootstrap
or self.config.useGainsFrom ==
"LINEARIZER":
2302 for amp, serialOverscan
in zip(detector, serialOverscans):
2303 if serialOverscan
is None:
2304 ptc.noise[amp.getName()] = 0.0
2312 ptc.noise[amp.getName()] = serialOverscan.residualSigma * gains[amp.getName()]
2314 serialOverscans = [
None]*len(detector)
2326 overscanDetectorConfig,
2332 if self.config.doCorrectGains
and gainCorrection
is not None:
2333 self.log.info(
"Correcting gains based on input GainCorrection.")
2334 gainCorrection.correctGains(gains, exposure=ccdExposure)
2335 exposureMetadata[
"LSST ISR GAINCORRECTION APPLIED"] =
True
2336 elif self.config.doCorrectGains:
2337 self.log.info(
"Skipping gain correction because no GainCorrection available.")
2342 if self.config.doApplyGains:
2343 self.log.info(
"Using gain values to convert from adu to electron units.")
2344 isrFunctions.applyGains(ccdExposure, normalizeGains=
False, ptcGains=gains, isTrimmed=
False)
2346 exposureMetadata[
"LSST ISR UNITS"] =
"electron"
2350 for amp
in detector:
2351 ampName = amp.getName()
2352 if (key := f
"LSST ISR SATURATION LEVEL {ampName}")
in exposureMetadata:
2353 exposureMetadata[key] *= gains[ampName]
2354 if (key := f
"LSST ISR SUSPECT LEVEL {ampName}")
in exposureMetadata:
2355 exposureMetadata[key] *= gains[ampName]
2358 metadata = ccdExposure.metadata
2359 metadata[
"LSST ISR READNOISE UNITS"] =
"electron"
2360 metadata[
"LSST ISR PTCTURNOFF UNITS"] =
"electron"
2361 metadata[
"LSST ISR GAIN SOURCE"] = self.config.useGainsFrom
2362 for amp
in detector:
2364 metadata[f
"LSST ISR GAIN {amp.getName()}"] = gains[amp.getName()]
2367 metadata[f
"LSST ISR READNOISE {amp.getName()}"] = ptc.noise[amp.getName()]
2370 turnoff = ptc.ptcTurnoff[amp.getName()] * gains[amp.getName()]
2371 metadata[f
"LSST ISR PTCTURNOFF {amp.getName()}"] = turnoff
2375 if self.config.doCrosstalk:
2376 self.log.info(
"Applying crosstalk corrections to full amplifier region.")
2377 if self.config.doBootstrap
and numpy.any(crosstalk.fitGains != 0):
2378 crosstalkGains =
None
2380 crosstalkGains = gains
2383 crosstalk=crosstalk,
2384 gains=crosstalkGains,
2386 badAmpDict=badAmpDict,
2387 ignoreVariance=
True,
2389 ccdExposure.metadata[
"LSST ISR CROSSTALK APPLIED"] =
True
2392 if numpy.isfinite(self.config.serialOverscanMedianShiftSigmaThreshold):
2394 ccdExposure.metadata[
"LSST ISR OVERSCANLEVEL CHECKED"] =
True
2396 if numpy.isfinite(self.config.ampNoiseThreshold):
2397 badAmpDict = self.
checkAmpNoise(badAmpDict, ccdExposure, ptc)
2398 ccdExposure.metadata[
"LSST ISR NOISE CHECKED"] =
True
2400 if numpy.isfinite(self.config.serialOverscanMedianShiftSigmaThreshold)
or \
2401 numpy.isfinite(self.config.ampNoiseThreshold):
2406 parallelOverscans =
None
2407 if overscanDetectorConfig.doAnyParallelOverscan:
2411 overscanDetectorConfig,
2419 if self.config.doLinearize:
2420 self.log.info(
"Applying linearizer.")
2424 if exposureMetadata[
"LSST ISR UNITS"] ==
"electron":
2425 linearityGains = gains
2427 linearityGains =
None
2428 linearizer.applyLinearity(
2429 image=ccdExposure.image,
2432 gains=linearityGains,
2434 ccdExposure.metadata[
"LSST ISR LINEARIZER APPLIED"] =
True
2439 if self.config.doDeferredCharge:
2440 if self.config.doBootstrap:
2441 self.log.info(
"Applying deferred charge correction with doBootstrap=True: "
2442 "will need to use deferredChargeCalib.inputGain to apply "
2443 "CTI correction in electron units.")
2444 deferredChargeGains = deferredChargeCalib.inputGain
2445 if numpy.all(numpy.isnan(list(deferredChargeGains.values()))):
2446 self.log.warning(
"All gains contained in the deferredChargeCalib are "
2447 "NaN, approximating with gain of 1.0.")
2448 deferredChargeGains = gains
2450 deferredChargeGains = gains
2451 self.deferredChargeCorrection.
run(
2453 deferredChargeCalib,
2454 gains=deferredChargeGains,
2456 ccdExposure.metadata[
"LSST ISR CTI APPLIED"] =
True
2460 untrimmedCcdExposure =
None
2461 if self.config.isrStats.doCtiStatistics:
2462 untrimmedCcdExposure = ccdExposure.clone()
2466 if self.config.doAssembleCcd:
2467 self.log.info(
"Assembling CCD from amplifiers.")
2468 ccdExposure = self.assembleCcd.assembleCcd(ccdExposure)
2470 if self.config.expectWcs
and not ccdExposure.getWcs():
2471 self.log.warning(
"No WCS found in input exposure.")
2474 if self.config.doE2VEdgeBleedMask
and detector.getPhysicalType() ==
"E2V":
2475 isrFunctions.maskE2VEdgeBleed(
2476 exposure=ccdExposure,
2477 e2vEdgeBleedSatMinArea=self.config.e2vEdgeBleedSatMinArea,
2478 e2vEdgeBleedSatMaxArea=self.config.e2vEdgeBleedSatMaxArea,
2479 e2vEdgeBleedYMax=self.config.e2vEdgeBleedYMax,
2480 saturatedMaskName=self.config.saturatedMaskName,
2485 for maskPlane
in self.config.itlDipMaskPlanes:
2486 if maskPlane
not in ccdExposure.mask.getMaskPlaneDict():
2487 self.log.info(
"Adding %s mask plane to image.", maskPlane)
2488 ccdExposure.mask.addMaskPlane(maskPlane)
2490 if self.config.doITLDipMask:
2491 isrFunctions.maskITLDip(
2492 exposure=ccdExposure,
2493 detectorConfig=overscanDetectorConfig,
2495 maskPlaneNames=self.config.itlDipMaskPlanes,
2498 if (self.config.doITLSatSagMask
or self.config.doITLEdgeBleedMask) \
2499 and detector.getPhysicalType() ==
'ITL':
2501 badAmpDict=badAmpDict)
2505 if self.config.doBias:
2506 self.log.info(
"Applying bias correction.")
2509 isrFunctions.biasCorrection(
2510 ccdExposure.maskedImage,
2512 imageOnly=
not self.config.doVariance,
2514 ccdExposure.metadata[
"LSST ISR BIAS APPLIED"] =
True
2518 if self.config.doDark:
2519 self.log.info(
"Applying dark subtraction.")
2523 ccdExposure.metadata[
"LSST ISR DARK APPLIED"] =
True
2529 if self.config.doDefect:
2530 self.log.info(
"Applying defect masking.")
2532 ccdExposure.metadata[
"LSST ISR DEFECTS APPLIED"] =
True
2534 self.log.info(
"Adding UNMASKEDNAN mask plane to image.")
2535 ccdExposure.mask.addMaskPlane(
"UNMASKEDNAN")
2536 if self.config.doNanMasking:
2537 self.log.info(
"Masking non-finite (NAN, inf) value pixels.")
2540 if self.config.doWidenSaturationTrails:
2541 self.log.info(
"Widening saturation trails.")
2542 isrFunctions.widenSaturationTrails(ccdExposure.getMaskedImage().getMask())
2546 if self.config.doBrighterFatter:
2547 if "ASTIER23" in self.config.brighterFatterCorrectionMethod:
2549 self.log.info(
"Applying electrostatic brighter-fatter "
2551 bfCalib = electroBfDistortionMatrix
2552 bfGains = electroBfDistortionMatrix.gain
2554 elif self.config.brighterFatterCorrectionMethod ==
"COULTON18":
2556 self.log.info(
"Applying brighter-fatter correction.")
2561 elif self.config.brighterFatterCorrectionMethod ==
"COULTON18_FLUX_CONSERVING":
2568 raise RuntimeError(
"Cannot perform brighter-fatter correction with unknown"
2573 if exposureMetadata[
"LSST ISR UNITS"] ==
"electron":
2574 brighterFatterApplyGain =
False
2576 brighterFatterApplyGain =
True
2578 if brighterFatterApplyGain
and (ptc
is not None)
and (bfGains != gains):
2585 self.log.warning(
"Need to apply gain for brighter-fatter, but the stored"
2586 "gains in the kernel are not the same as the gains used"
2587 f
"by {self.config.useGainsFrom}. Using the gains stored"
2591 ccdExposure = bfCorrFunction(
2596 brighterFatterApplyGain,
2600 ccdExposure.metadata[
"LSST ISR BF APPLIED"] =
True
2601 ccdExposure.metadata[
"LSST ISR BF CORR METHOD"] = self.config.brighterFatterCorrectionMethod
2605 if self.config.doVariance:
2612 if self.config.doFlat:
2613 self.log.info(
"Applying flat correction.")
2614 isrFunctions.flatCorrection(
2615 maskedImage=ccdExposure.maskedImage,
2616 flatMaskedImage=flat.maskedImage,
2617 scalingType=self.config.flatScalingType,
2618 userScale=self.config.flatUserScale,
2619 imageOnly=
not self.config.doVariance,
2626 if (validPolygon := flat.info.getValidPolygon())
is not None:
2627 ccdExposure.info.setValidPolygon(validPolygon)
2629 noData = (ccdExposure.mask.array & ccdExposure.mask.getPlaneBitMask(
"NO_DATA")) > 0
2630 ccdExposure.image.array[noData] = 0.0
2631 ccdExposure.variance.array[noData] = self.config.noDataVariance
2633 ccdExposure.metadata[
"LSST ISR FLAT APPLIED"] =
True
2634 ccdExposure.metadata[
"LSST ISR FLAT SOURCE"] = flat.metadata.get(
"FLATSRC",
"UNKNOWN")
2638 if self.config.doSaveInterpPixels:
2639 preInterpExp = ccdExposure.clone()
2641 if self.config.doSetBadRegions:
2642 self.log.info(
'Setting values in large contiguous bad regions.')
2645 if self.config.doInterpolate:
2646 self.log.info(
"Interpolating masked pixels.")
2647 isrFunctions.interpolateFromMask(
2648 maskedImage=ccdExposure.getMaskedImage(),
2649 fwhm=self.config.brighterFatterFwhmForInterpolation,
2650 growSaturatedFootprints=self.config.growSaturationFootprintSize,
2651 maskNameList=list(self.config.maskListToInterpolate),
2652 useLegacyInterp=self.config.useLegacyInterp,
2656 if self.config.doAmpOffset:
2657 if self.config.ampOffset.doApplyAmpOffset:
2658 self.log.info(
"Measuring and applying amp offset corrections.")
2660 self.log.info(
"Measuring amp offset corrections only, without applying them.")
2661 self.ampOffset.
run(ccdExposure)
2664 if self.config.doStandardStatistics:
2665 metadata = ccdExposure.metadata
2666 for amp
in detector:
2667 ampExposure = ccdExposure.Factory(ccdExposure, amp.getBBox())
2668 ampName = amp.getName()
2669 metadata[f
"LSST ISR MASK SAT {ampName}"] = isrFunctions.countMaskedPixels(
2670 ampExposure.getMaskedImage(),
2671 [self.config.saturatedMaskName]
2673 metadata[f
"LSST ISR MASK BAD {ampName}"] = isrFunctions.countMaskedPixels(
2674 ampExposure.getMaskedImage(),
2677 metadata[f
"LSST ISR MASK SUSPECT {ampName}"] = isrFunctions.countMaskedPixels(
2678 ampExposure.getMaskedImage(),
2681 qaStats = afwMath.makeStatistics(ampExposure.getImage(),
2682 afwMath.MEAN | afwMath.MEDIAN | afwMath.STDEVCLIP)
2684 metadata[f
"LSST ISR FINAL MEAN {ampName}"] = qaStats.getValue(afwMath.MEAN)
2685 metadata[f
"LSST ISR FINAL MEDIAN {ampName}"] = qaStats.getValue(afwMath.MEDIAN)
2686 metadata[f
"LSST ISR FINAL STDEV {ampName}"] = qaStats.getValue(afwMath.STDEVCLIP)
2688 k1 = f
"LSST ISR FINAL MEDIAN {ampName}"
2689 k2 = f
"LSST ISR OVERSCAN SERIAL MEDIAN {ampName}"
2690 if overscanDetectorConfig.doAnySerialOverscan
and k1
in metadata
and k2
in metadata:
2691 metadata[f
"LSST ISR LEVEL {ampName}"] = metadata[k1] - metadata[k2]
2693 metadata[f
"LSST ISR LEVEL {ampName}"] = numpy.nan
2696 outputStatistics =
None
2697 if self.config.doCalculateStatistics:
2698 outputStatistics = self.isrStats.
run(ccdExposure,
2699 untrimmedInputExposure=untrimmedCcdExposure,
2700 serialOverscanResults=serialOverscans,
2701 parallelOverscanResults=parallelOverscans,
2702 bias=bias, dark=dark, flat=flat,
2703 ptc=ptc, defects=defects).results
2706 outputBin1Exposure =
None
2707 outputBin2Exposure =
None
2708 if self.config.doBinnedExposures:
2709 self.log.info(
"Creating binned exposures.")
2710 outputBin1Exposure = self.binning.
run(
2712 binFactor=self.config.binFactor1,
2714 outputBin2Exposure = self.binning.
run(
2716 binFactor=self.config.binFactor2,
2719 return pipeBase.Struct(
2720 exposure=ccdExposure,
2722 outputBin1Exposure=outputBin1Exposure,
2723 outputBin2Exposure=outputBin2Exposure,
2725 preInterpExposure=preInterpExp,
2726 outputExposure=ccdExposure,
2727 outputStatistics=outputStatistics,