lsst.afw g7b64926daa+e08cd4597e
Loading...
Searching...
No Matches
lsst.afw.display._images_compat Namespace Reference

Functions

 normalize_lsst_images (data, wcs=None)
 

Function Documentation

◆ normalize_lsst_images()

lsst.afw.display._images_compat.normalize_lsst_images ( data,
wcs = None )
Convert an `lsst.images` object to its afw equivalent for display.

Parameters
----------
data : `~typing.Any`
    Data to display.  If this is an `lsst.images.MaskedImage` (including
    subclasses such as `~lsst.images.VisitImage` and
    `~lsst.images.cells.CellCoadd`), `lsst.images.Image`, or
    `lsst.images.Mask`, it is converted to the corresponding
    `lsst.afw.image` type; anything else is returned unchanged.
wcs : `lsst.afw.geom.SkyWcs` or `None`, optional
    WCS supplied by the caller.

Returns
-------
data : `~typing.Any`
    The converted afw object, or the input unchanged.
wcs : `lsst.afw.geom.SkyWcs` or `None`
    The WCS converted from ``data.sky_projection`` if present, else the
    caller-supplied ``wcs``.

Raises
------
RuntimeError
    Raised if ``wcs`` is not `None` and ``data`` has its own
    ``sky_projection``.

Notes
-----
``lsst.images`` is deliberately never imported here: it optionally
depends on afw, so the dependency cannot go the other way.  If the
module has never been imported, the caller cannot be holding one of
its objects, so looking it up in `sys.modules` is sufficient.

Only the image and mask planes are ever forwarded to display backends,
so PSFs, variance, and other components are never serialized for
display.  Mask schemas with more than 31 named planes cannot be
represented as an `lsst.afw.image.Mask` and fail conversion.

Definition at line 30 of file _images_compat.py.