Skip to content

Commit

Permalink
Cleanup display docstrings and exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Oct 18, 2023
1 parent 29afe69 commit aa79511
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions python/lsst/afw/display/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,26 @@ def __addMissingMaskPlanes(self, mask):
self.setDefaultMaskPlaneColor(name, next(colorGenerator))

def mtv(self, data, title="", wcs=None):
"""Display an `~lsst.afw.image.Image` or `~lsst.afw.image.Mask` on a display
"""Display an image on a display, with semi-transparent masks
overlaid, if available.
Parameters
----------
data : `lsst.afw.image.Exposure` or `lsst.afw.image.MaskedImage` or `lsst.afw.image.Image`
Image to display.
title : str, optional
Title for the display window.
wcs : `lsst.afw.geom.SkyWcs`, optional
World Coordinate System to align an `~lsst.afw.image.MaskedImage`
or `~lsst.afw.image.Image` to; raise an exception if ``data``
is an `~lsst.afw.image.Exposure`.
Raises
------
RuntimeError
Raised if an Exposure is passed with a non-None wcs.
TypeError
Raised if data is an incompatible type.
Notes
-----
Expand All @@ -557,8 +576,7 @@ def mtv(self, data, title="", wcs=None):
# it's an Exposure; display the MaskedImage with the WCS
if isinstance(data, afwImage.Exposure):
if wcs:
raise RuntimeError(
"You may not specify a wcs with an Exposure")
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
try:
Expand All @@ -584,7 +602,7 @@ def mtv(self, data, title="", wcs=None):
self.__addMissingMaskPlanes(data.mask)
self._impl._mtv(data.getImage(), data.getMask(), wcs, title)
else:
raise RuntimeError(f"Unsupported type {data!r}")
raise TypeError(f"Unsupported type {data!r}")
#
# Graphics commands
#
Expand Down

0 comments on commit aa79511

Please sign in to comment.