Skip to content

Commit

Permalink
Merge pull request #23 from lsst/tickets/DM-6391
Browse files Browse the repository at this point in the history
DM-6391: Masks should respect XY0
  • Loading branch information
parejkoj committed Jan 10, 2024
2 parents db4ec4c + 6a99787 commit 16a3bce
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions python/lsst/display/ds9/ds9.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def _mtv(self, image, mask=None, wcs=None, title=""):

planeList = range(nMaskPlanes)
usedPlanes = int(afwMath.makeStatistics(mask, afwMath.SUM).getValue())
mask1 = mask.Factory(mask.getDimensions()) # Mask containing just one bitplane
mask1 = mask.Factory(mask.getBBox()) # Mask containing just one bitplane

colorGenerator = self.display.maskColorGenerator(omitBW=True)
for p in planeList:
Expand Down Expand Up @@ -654,23 +654,20 @@ def _i_mtv(data, wcs, title, isMask):
"""
title = str(title) if title else ""

if True:
if isMask:
xpa_cmd = "xpaset %s fits mask" % getXpaAccessPoint()
# ds9 mis-handles BZERO/BSCALE in uint16 data.
# The following hack works around this.
# This is a copy we're modifying
if data.getArray().dtype == np.uint16:
data |= 0x8000
else:
xpa_cmd = "xpaset %s fits" % getXpaAccessPoint()
if isMask:
xpa_cmd = "xpaset %s fits mask" % getXpaAccessPoint()
# ds9 mis-handles BZERO/BSCALE in uint16 data.
# The following hack works around this.
# This is a copy we're modifying
if data.getArray().dtype == np.uint16:
data |= 0x8000
else:
xpa_cmd = "xpaset %s fits" % getXpaAccessPoint()

if haveGzip:
xpa_cmd = "gzip | " + xpa_cmd
if haveGzip:
xpa_cmd = "gzip | " + xpa_cmd

pfd = os.popen(xpa_cmd, "w")
else:
pfd = open("foo.fits", "w")
pfd = os.popen(xpa_cmd, "w")

ds9Cmd(flush=True, silent=True)

Expand All @@ -688,13 +685,3 @@ def _i_mtv(data, wcs, title, isMask):
pfd.close()
except Exception:
pass


if False:
try:
definedCallbacks
except NameError:
definedCallbacks = True

for k in ('XPA$ERROR',):
interface.setCallback(k)

0 comments on commit 16a3bce

Please sign in to comment.