Skip to content

Commit

Permalink
Fixed bug where original mask bits aren't persisted in stamps.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcrenshaw committed Oct 27, 2024
1 parent bc080a1 commit 1b0cbea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion python/lsst/ts/wep/task/cutOutDonutsBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ def calculateSN(self, stamp):
A dictionary of calculated quantities
"""

stamp.makeMask(self.instConfigFile, self.opticalModel)
imageArray = stamp.stamp_im.image.array
mask = stamp.stamp_im.mask
varianceArray = stamp.stamp_im.variance.array
Expand Down Expand Up @@ -437,6 +436,7 @@ def calculateSN(self, stamp):
"ttl_noise_bkgnd_variance": ttlNoiseBkgndVariance,
"ttl_noise_donut_variance": ttlNoiseDonutVariance,
}

return snDict

def filterBadRecentering(self, xShifts, yShifts):
Expand Down Expand Up @@ -672,6 +672,9 @@ def cutOutStamps(self, exposure, donutCatalog, defocalType, cameraName):
archive_element=linear_wcs,
)

# Create image mask
donutStamp.makeMask(self.instConfigFile, self.opticalModel)

# Calculate the S/N per stamp
snQuant.append(self.calculateSN(donutStamp))

Expand Down
10 changes: 4 additions & 6 deletions python/lsst/ts/wep/task/donutStamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,7 @@ def makeMask(
):
"""Create the mask for the image.
Note the mask is returned in the original coordinate system of the info
that came from the butler (i.e. the DVCS, and the CWFSs are rotated
with respect to the science sensors). See sitcomtn-003.lsst.io for more
information.
Also note that technically the image masks depend on the optical
Note that technically the image masks depend on the optical
aberrations, but this function assumes the aberrations are zero.
Parameters
Expand Down Expand Up @@ -363,6 +358,9 @@ def makeMask(
nRot = int(eulerZ // 90)
stampMask = np.rot90(stampMask, -nRot)

# Add back to the original mask
stampMask += self.stamp_im.mask.array

# Save mask
self.stamp_im.setMask(afwImage.Mask(stampMask.copy()))

Expand Down

0 comments on commit 1b0cbea

Please sign in to comment.