1071 def run(self, exposure, amp, isTransposed=False):
1072 """Measure and remove serial overscan from an amplifier image.
1073
1074 Parameters
1075 ----------
1076 exposure : `lsst.afw.image.Exposure`
1077 Image data that will have the overscan corrections applied.
1078 amp : `lsst.afw.cameraGeom.Amplifier`
1079 Amplifier to use for debugging purposes.
1080 isTransposed : `bool`, optional
1081 Is the image transposed, such that serial and parallel
1082 overscan regions are reversed? Default is False.
1083
1084 Returns
1085 -------
1086 overscanResults : `lsst.pipe.base.Struct`
1087 Result struct with components:
1088
1089 ``imageFit``
1090 Value or fit subtracted from the amplifier image data
1091 (scalar or `lsst.afw.image.Image`).
1092 ``overscanFit``
1093 Value or fit subtracted from the serial overscan image
1094 data (scalar or `lsst.afw.image.Image`).
1095 ``overscanImage``
1096 Image of the serial overscan region with the serial
1097 overscan correction applied
1098 (`lsst.afw.image.Image`). This quantity is used to
1099 estimate the amplifier read noise empirically.
1100 ``overscanMean``
1101 Mean of the fit serial overscan region.
1102 ``overscanMedian``
1103 Median of the fit serial overscan region.
1104 ``overscanSigma``
1105 Sigma of the fit serial overscan region.
1106 ``residualMean``
1107 Mean of the residual of the serial overscan region after
1108 correction.
1109 ``residualMedian``
1110 Median of the residual of the serial overscan region after
1111 correction.
1112 ``residualSigma``
1113 Mean of the residual of the serial overscan region after
1114 correction.
1115
1116 Raises
1117 ------
1118 RuntimeError
1119 Raised if an invalid overscan type is set.
1120 """
1121 serialOverscanBBox = amp.getRawSerialOverscanBBox()
1122 imageBBox = amp.getRawDataBBox()
1123
1124
1125
1126 parallelOverscanBBox = amp.getRawParallelOverscanBBox()
1127 imageBBox = imageBBox.expandedTo(parallelOverscanBBox)
1128
1129 if isTransposed:
1131 geom.Point2I(serialOverscanBBox.getMinX(), imageBBox.getEndY()),
1132 geom.Extent2I(imageBBox.getWidth(), serialOverscanBBox.getHeight()),
1133 )
1134 else:
1137 imageBBox.getMinY()),
1139 imageBBox.getHeight()),
1140 )
1141
1142 results = self.correctOverscan(
1143 exposure,
1144 amp,
1145 imageBBox,
1146 serialOverscanBBox,
1147 isTransposed=isTransposed,
1148 leadingToSkip=self.config.leadingToSkip,
1149 trailingToSkip=self.config.trailingToSkip,
1150 )
1151 overscanMean = results.overscanMean
1152 overscanMedian = results.overscanMedian
1153 overscanSigma = results.overscanSigma
1154 residualMean = results.overscanMeanResidual
1155 residualMedian = results.overscanMedianResidual
1156 residualSigma = results.overscanSigmaResidual
1157
1158 return pipeBase.Struct(
1159 imageFit=results.ampOverscanModel,
1160 overscanFit=results.overscanOverscanModel,
1161 overscanImage=results.overscanImage,
1162 overscanMean=overscanMean,
1163 overscanMedian=overscanMedian,
1164 overscanSigma=overscanSigma,
1165 residualMean=residualMean,
1166 residualMedian=residualMedian,
1167 residualSigma=residualSigma,
1168 )
1169
1170
An integer coordinate rectangle.