Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-6391: Masks should respect XY0 #23

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)