diff --git a/python/lsst/ts/wep/task/calcZernikesTask.py b/python/lsst/ts/wep/task/calcZernikesTask.py index 4b1c14889..b2617862e 100644 --- a/python/lsst/ts/wep/task/calcZernikesTask.py +++ b/python/lsst/ts/wep/task/calcZernikesTask.py @@ -224,23 +224,24 @@ def estimateZernikes(self, donutStampsExtra, donutStampsIntra): eulerZExtra = -detectorExtra.getOrientation().getYaw().asDegrees() eulerZIntra = -detectorIntra.getOrientation().getYaw().asDegrees() - # NOTE: TS_WEP expects these images to be transposed - # TODO: Look into this blendOffsetsExtra = self.calcBlendOffsets(donutExtra, eulerZExtra) blendOffsetsIntra = self.calcBlendOffsets(donutIntra, eulerZIntra) + # Transform image and coordinates from DVCS + # (Data Visualization Coordinate System) + # to ZCS (Zemax Coordinate System). wfEsti.setImg( - fieldXYExtra, + np.array([-fieldXYExtra[1], fieldXYExtra[0]]), DefocalType.Extra, filterLabel=getFilterTypeFromBandLabel(donutExtra.bandpass), - image=donutExtra.stamp_im.image.array, + image=np.fliplr(donutExtra.stamp_im.image.array.T), blendOffsets=blendOffsetsExtra.tolist(), ) wfEsti.setImg( - fieldXYIntra, + np.array([-fieldXYIntra[1], fieldXYIntra[0]]), DefocalType.Intra, filterLabel=getFilterTypeFromBandLabel(donutIntra.bandpass), - image=donutIntra.stamp_im.image.array, + image=np.fliplr(donutIntra.stamp_im.image.array.T), blendOffsets=blendOffsetsIntra.tolist(), ) wfEsti.reset() diff --git a/python/lsst/ts/wep/task/cutOutDonutsBase.py b/python/lsst/ts/wep/task/cutOutDonutsBase.py index 76a63c751..245e2171e 100644 --- a/python/lsst/ts/wep/task/cutOutDonutsBase.py +++ b/python/lsst/ts/wep/task/cutOutDonutsBase.py @@ -448,7 +448,7 @@ def cutOutStamps(self, exposure, donutCatalog, defocalType, cameraName): ) xCornerList.append(xCorner) yCornerList.append(yCorner) - finalCutout = exposure[finalBBox] + finalCutout = exposure[finalBBox].clone() # Save MaskedImage to stamp finalStamp = finalCutout.getMaskedImage() @@ -487,17 +487,6 @@ def cutOutStamps(self, exposure, donutCatalog, defocalType, cameraName): else: blendCentroidPositions = np.array([["nan"], ["nan"]], dtype=float).T - camera = getCameraFromButlerName(cameraName) - detectorInfo = camera.get(detectorName) - - # Rotate any sensors that are not lined up with the focal plane. - # Mostly just for the corner wavefront sensors. The negative sign - # creates the correct rotation based upon closed loop tests - # with R04 and R40 corner sensors. - eulerZ = -detectorInfo.getOrientation().getYaw().asDegrees() - - finalStamp.image.array = rotate(finalStamp.image.array, eulerZ) - donutStamp = DonutStamp( stamp_im=finalStamp, sky_position=lsst.geom.SpherePoint( @@ -541,11 +530,21 @@ def cutOutStamps(self, exposure, donutCatalog, defocalType, cameraName): shiftedMask -= 1 donutStamp.stamp_im.image.array *= shiftedMask + camera = getCameraFromButlerName(cameraName) + detectorInfo = camera.get(detectorName) + + # Rotate any sensors that are not lined up with the focal plane. + # Mostly just for the corner wavefront sensors. The negative sign + # creates the correct rotation based upon closed loop tests + # with R04 and R40 corner sensors. + eulerZ = -detectorInfo.getOrientation().getYaw().asDegrees() + donutStamp.stamp_im.image.array = rotate(donutStamp.stamp_im.image.array, eulerZ) + # NOTE: TS_WEP expects these images to be transposed # TODO: Look into this - if self.transposeImages: - donutStamp.stamp_im.image.array = donutStamp.stamp_im.image.array.T - donutStamp.mask_comp.array = donutStamp.mask_comp.array.T + # if self.transposeImages: + # finalStamp.image.array = finalStamp.image.array.T + donutStamp.stamp_im.setMask(donutStamp.mask_comp) finalStamps.append(donutStamp)