895 def run(self, exposure, amp, isTransposed=False):
896 """Measure and remove serial/parallel overscan from an amplifier image.
897
898 This will be deprecated.
899
900 Parameters
901 ----------
902 exposure : `lsst.afw.image.Exposure`
903 Image data that will have the overscan corrections applied.
904 amp : `lsst.afw.cameraGeom.Amplifier`
905 Amplifier to use for debugging purposes.
906 isTransposed : `bool`, optional
907 Is the image transposed, such that serial and parallel
908 overscan regions are reversed? Default is False.
909
910 Returns
911 -------
912 overscanResults : `lsst.pipe.base.Struct`
913 Result struct with components:
914
915 ``imageFit``
916 Value or fit subtracted from the amplifier image data
917 (scalar or `lsst.afw.image.Image`).
918 ``overscanFit``
919 Value or fit subtracted from the serial overscan image
920 data (scalar or `lsst.afw.image.Image`).
921 ``overscanImage``
922 Image of the serial overscan region with the serial
923 overscan correction applied
924 (`lsst.afw.image.Image`). This quantity is used to
925 estimate the amplifier read noise empirically.
926 ``parallelOverscanFit``
927 Value or fit subtracted from the parallel overscan
928 image data (scalar, `lsst.afw.image.Image`, or None).
929 ``parallelOverscanImage``
930 Image of the parallel overscan region with the
931 parallel overscan correction applied
932 (`lsst.afw.image.Image` or None).
933 ``overscanMean``
934 Mean of the fit serial overscan region.
935 This and the following values will be tuples of
936 (serial, parallel) if doParallelOverscan=True.
937 ``overscanMedian``
938 Median of the fit serial overscan region.
939 ``overscanSigma``
940 Sigma of the fit serial overscan region.
941 ``residualMean``
942 Mean of the residual of the serial overscan region after
943 correction.
944 ``residualMedian``
945 Median of the residual of the serial overscan region after
946 correction.
947 ``residualSigma``
948 Mean of the residual of the serial overscan region after
949 correction.
950
951
952 Raises
953 ------
954 RuntimeError
955 Raised if an invalid overscan type is set.
956 """
957
958 serialOverscanBBox = amp.getRawSerialOverscanBBox()
959 imageBBox = amp.getRawDataBBox()
960
961 if self.config.doParallelOverscan:
962
963
964 parallelOverscanBBox = amp.getRawParallelOverscanBBox()
965 imageBBox = imageBBox.expandedTo(parallelOverscanBBox)
966
967 if isTransposed:
969 geom.Point2I(serialOverscanBBox.getMinX(), imageBBox.getEndY()),
970 geom.Extent2I(imageBBox.getWidth(), serialOverscanBBox.getHeight()),
971 )
972 else:
975 imageBBox.getMinY()),
977 imageBBox.getHeight()),
978 )
979
980 serialResults = self.correctOverscan(
981 exposure,
982 amp,
983 imageBBox,
984 serialOverscanBBox,
985 isTransposed=isTransposed,
986 leadingToSkip=self.config.leadingColumnsToSkip,
987 trailingToSkip=self.config.trailingColumnsToSkip,
988 )
989 overscanMean = serialResults.overscanMean
990 overscanMedian = serialResults.overscanMedian
991 overscanSigma = serialResults.overscanSigma
992 residualMean = serialResults.overscanMeanResidual
993 residualMedian = serialResults.overscanMedianResidual
994 residualSigma = serialResults.overscanSigmaResidual
995
996
997 parallelResults = None
998 if self.config.doParallelOverscan:
999
1000
1001 parallelOverscanBBox = amp.getRawParallelOverscanBBox()
1002 imageBBox = amp.getRawDataBBox()
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014 parallelResults = self.correctOverscan(
1015 exposure,
1016 amp,
1017 imageBBox,
1018 parallelOverscanBBox,
1019 isTransposed=not isTransposed,
1020 leadingToSkip=self.config.leadingRowsToSkip,
1021 trailingToSkip=self.config.trailingRowsToSkip,
1022 )
1023 overscanMean = (overscanMean, parallelResults.overscanMean)
1024 overscanMedian = (overscanMedian, parallelResults.overscanMedian)
1025 overscanSigma = (overscanSigma, parallelResults.overscanSigma)
1026 residualMean = (residualMean, parallelResults.overscanMeanResidual)
1027 residualMedian = (residualMedian, parallelResults.overscanMedianResidual)
1028 residualSigma = (residualSigma, parallelResults.overscanSigmaResidual)
1029
1030 parallelOverscanFit = parallelResults.overscanOverscanModel if parallelResults else None
1031 parallelOverscanImage = parallelResults.overscanImage if parallelResults else None
1032
1033 return pipeBase.Struct(imageFit=serialResults.ampOverscanModel,
1034 overscanFit=serialResults.overscanOverscanModel,
1035 overscanImage=serialResults.overscanImage,
1036
1037 parallelOverscanFit=parallelOverscanFit,
1038 parallelOverscanImage=parallelOverscanImage,
1039 overscanMean=overscanMean,
1040 overscanMedian=overscanMedian,
1041 overscanSigma=overscanSigma,
1042 residualMean=residualMean,
1043 residualMedian=residualMedian,
1044 residualSigma=residualSigma)
1045
1046
An integer coordinate rectangle.