Skip to content

Commit

Permalink
Cleanup new image method
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Feb 2, 2024
1 parent 6e3365c commit f167b62
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions python/lsst/afw/display/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,9 @@ def image(self, data, title="", wcs=None):
if isinstance(data, afwImage.Exposure):
if wcs:
raise RuntimeError("You may not specify a wcs with an Exposure")
data, wcs = data.getMaskedImage(), data.getWcs()
elif isinstance(data, afwImage.DecoratedImage): # it's a DecoratedImage; display it
data, wcs = data.getMaskedImage(), data.wcs
# it's a DecoratedImage; display it
elif isinstance(data, afwImage.DecoratedImage):
try:
wcs = afwGeom.makeSkyWcs(data.getMetadata())
except TypeError:
Expand All @@ -583,15 +584,13 @@ def image(self, data, title="", wcs=None):
# It's a Mask; display it, bitplane by bitplane.
elif isinstance(data, afwImage.Mask):
self.__addMissingMaskPlanes(data)
#
# Some displays can't display a Mask without an image; so display an Image too,
# with pixel values set to the mask
#
self._impl._mtv(afwImage.ImageI(data.getArray()), data, wcs, title)
# it's a MaskedImage; display Image and overlay Mask
# Some displays can't display a Mask without an image; so display
# an Image too, with pixel values set to the mask.
self._impl._mtv(afwImage.ImageI(data.array), data, wcs, title)
# It's a MaskedImage; display Image and overlay Mask.
elif isinstance(data, afwImage.MaskedImage):
self.__addMissingMaskPlanes(data.mask)
self._impl._mtv(data.getImage(), data.getMask(), wcs, title)
self._impl._mtv(data.image, data.mask, wcs, title)
else:
raise TypeError(f"Unsupported type {data!r}")

Expand Down

0 comments on commit f167b62

Please sign in to comment.