lsst.afw g9c22b2923f+53520f316c
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
lsst.afw.display.interface.Display Class Reference

Classes

class  _Buffering
 

Public Member Functions

 __init__ (self, frame=None, backend=None, **kwargs)
 
 __enter__ (self)
 
 __exit__ (self, *args)
 
 __del__ (self)
 
 __getattr__ (self, name)
 
 close (self)
 
 verbose (self)
 
 verbose (self, value)
 
 __str__ (self)
 
 setImageColormap (self, cmap)
 
 maskColorGenerator (self, omitBW=True)
 
 setMaskPlaneColor (self, name, color=None)
 
 getMaskPlaneColor (self, name=None)
 
 setMaskTransparency (self, transparency=None, name=None)
 
 getMaskTransparency (self, name=None)
 
 show (self)
 
 image (self, data, title="", wcs=None)
 
 mtv (self, data, title="", wcs=None)
 
 Buffering (self)
 
 flush (self)
 
 erase (self)
 
 centroids (self, catalog, *symbol="o", **kwargs)
 
 dot (self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, **kwargs)
 
 line (self, points, origin=afwImage.PARENT, symbs=False, ctype=None, size=0.5)
 
 scale (self, algorithm, min, max=None, unit=None, **kwargs)
 
 zoom (self, zoomfac=None, colc=None, rowc=None, origin=afwImage.PARENT)
 
 pan (self, colc=None, rowc=None, origin=afwImage.PARENT)
 
 interact (self)
 
 setCallback (self, k, func=None, noRaise=False)
 
 getActiveCallbackKeys (self, onlyActive=True)
 

Static Public Member Functions

 setDefaultBackend (backend)
 
 getDefaultBackend ()
 
 setDefaultFrame (frame=0)
 
 getDefaultFrame ()
 
 incrDefaultFrame ()
 
 setDefaultMaskTransparency (maskPlaneTransparency={})
 
 setDefaultMaskPlaneColor (name=None, color=None)
 
 setDefaultImageColormap (cmap)
 
 getDisplay (frame=None, backend=None, create=True, verbose=False, **kwargs)
 
 delAllDisplays ()
 

Public Attributes

 frame
 
 name
 

Protected Attributes

 _impl
 
 _xy0
 
 _maskPlaneColors
 
 _callbacks
 

Static Protected Attributes

dict _displays = {}
 
 _defaultBackend = None
 
int _defaultFrame = 0
 
 _defaultMaskPlaneColor
 
dict _defaultMaskTransparency = {}
 
str _defaultImageColormap = "gray"
 

Detailed Description

Create an object able to display images and overplot glyphs.

Parameters
----------
frame
    An identifier for the display.
backend : `str`
    The backend to use (defaults to value set by setDefaultBackend()).
**kwargs
    Arguments to pass to the backend.

Definition at line 126 of file interface.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.afw.display.interface.Display.__init__ ( self,
frame = None,
backend = None,
** kwargs )

Definition at line 158 of file interface.py.

◆ __del__()

lsst.afw.display.interface.Display.__del__ ( self)

Definition at line 215 of file interface.py.

Member Function Documentation

◆ __enter__()

lsst.afw.display.interface.Display.__enter__ ( self)
Support for python's with statement.

Definition at line 205 of file interface.py.

◆ __exit__()

lsst.afw.display.interface.Display.__exit__ ( self,
* args )
Support for python's with statement.

Definition at line 210 of file interface.py.

◆ __getattr__()

lsst.afw.display.interface.Display.__getattr__ ( self,
name )
Return the attribute of ``self._impl``, or ``._impl`` if it is
requested.

Parameters:
-----------
name : `str`
    name of the attribute requested.

Returns:
--------
attribute : `object`
    the attribute of self._impl for the requested name.

Definition at line 218 of file interface.py.

◆ __str__()

lsst.afw.display.interface.Display.__str__ ( self)

Definition at line 265 of file interface.py.

◆ Buffering()

lsst.afw.display.interface.Display.Buffering ( self)
Return a context manager that will buffer repeated display
commands, to e.g. speed up displaying points.

Examples
--------
.. code-block:: py

   with display.Buffering():
       display.dot("+", xc, yc)

Definition at line 621 of file interface.py.

◆ centroids()

lsst.afw.display.interface.Display.centroids ( self,
catalog,
* symbol = "o",
** kwargs )
Draw the sources from a catalog at their pixel centroid positions
as given by `~lsst.afw.table.Catalog.getX()` and
`~lsst.afw.table.Catalog.getY()`.

See `dot` for an explanation of ``symbol`` and available args/kwargs,
which are passed to `dot`.

Parameters
----------
catalog : `lsst.afw.table.Catalog`
    Catalog to display centroids for. Must have valid `slot_Centroid`.

Definition at line 644 of file interface.py.

◆ close()

lsst.afw.display.interface.Display.close ( self)

Definition at line 245 of file interface.py.

◆ delAllDisplays()

lsst.afw.display.interface.Display.delAllDisplays ( )
static
Delete and close all known displays.

Definition at line 402 of file interface.py.

◆ dot()

lsst.afw.display.interface.Display.dot ( self,
symb,
c,
r,
size = 2,
ctype = None,
origin = afwImage.PARENT,
** kwargs )
Draw a symbol onto the specified display frame.

Parameters
----------
symb
    Possible values are:

        ``"+"``
            Draw a +
        ``"x"``
            Draw an x
        ``"*"``
            Draw a *
        ``"o"``
            Draw a circle
        ``"@:Mxx,Mxy,Myy"``
            Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
        `lsst.afw.geom.ellipses.BaseCore`
            Draw the ellipse (argument size is ignored). N.b. objects
            derived from `~lsst.afw.geom.ellipses.BaseCore` include
            `~lsst.afw.geom.ellipses.Axes` and `~lsst.afw.geom.ellipses.Quadrupole`.
        Any other value
            Interpreted as a string to be drawn.
c, r : `float`
    The column and row where the symbol is drawn [0-based coordinates].
size : `int`
    Size of symbol, in pixels.
ctype : `str`
    The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11
origin : `lsst.afw.image.ImageOrigin`
    Coordinate system for the given positions.
**kwargs
    Extra keyword arguments to backend.

Definition at line 664 of file interface.py.

◆ erase()

lsst.afw.display.interface.Display.erase ( self)
Erase the specified display frame.

Definition at line 639 of file interface.py.

◆ flush()

lsst.afw.display.interface.Display.flush ( self)
Flush any buffering that may be provided by the backend.

Definition at line 634 of file interface.py.

◆ getActiveCallbackKeys()

lsst.afw.display.interface.Display.getActiveCallbackKeys ( self,
onlyActive = True )
Return all callback keys

Parameters
----------
onlyActive : `bool`
    If `True` only return keys that do something

Definition at line 882 of file interface.py.

◆ getDefaultBackend()

lsst.afw.display.interface.Display.getDefaultBackend ( )
static

Definition at line 281 of file interface.py.

◆ getDefaultFrame()

lsst.afw.display.interface.Display.getDefaultFrame ( )
static
Get the default frame for display.

Definition at line 291 of file interface.py.

◆ getDisplay()

lsst.afw.display.interface.Display.getDisplay ( frame = None,
backend = None,
create = True,
verbose = False,
** kwargs )
static
Return a specific `Display`, creating it if need be.

Parameters
----------
frame
    The desired frame (`None` => use defaultFrame
    (see `~Display.setDefaultFrame`)).
backend : `str`
    create the specified frame using this backend (or the default if
    `None`) if it doesn't already exist. If ``backend == ""``, it's an
    error to specify a non-existent ``frame``.
create : `bool`
    create the display if it doesn't already exist.
verbose : `bool`
    Allow backend to be chatty.
**kwargs
    keyword arguments passed to `Display` constructor.

Definition at line 368 of file interface.py.

◆ getMaskPlaneColor()

lsst.afw.display.interface.Display.getMaskPlaneColor ( self,
name = None )
Return the color associated with the specified mask plane name.

Parameters
----------
name : `str`
    Desired mask plane; if `None`, return entire dict.

Definition at line 468 of file interface.py.

◆ getMaskTransparency()

lsst.afw.display.interface.Display.getMaskTransparency ( self,
name = None )
Return the current display's mask transparency.

Definition at line 507 of file interface.py.

◆ image()

lsst.afw.display.interface.Display.image ( self,
data,
title = "",
wcs = None )
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; Exposure and MaskedImage will show transparent
    mask planes.
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 when the
    ``wcs`` kwarg is also non-None.
TypeError
    Raised if data is an incompatible type.

Definition at line 538 of file interface.py.

◆ incrDefaultFrame()

lsst.afw.display.interface.Display.incrDefaultFrame ( )
static
Increment the default frame for display.

Definition at line 297 of file interface.py.

◆ interact()

lsst.afw.display.interface.Display.interact ( self)
Enter an interactive loop, listening for key presses or equivalent
UI actions in the display and firing callbacks.

Exit with ``q``, ``CR``, ``ESC``, or any equivalent UI action provided
in the display. The loop may also be exited by returning `True` from a
user-provided callback function.

Definition at line 823 of file interface.py.

◆ line()

lsst.afw.display.interface.Display.line ( self,
points,
origin = afwImage.PARENT,
symbs = False,
ctype = None,
size = 0.5 )
Draw a set of symbols or connect points

Parameters
----------
points : `list`
    A list of (col, row)
origin : `lsst.afw.image.ImageOrigin`
    Coordinate system for the given positions.
symbs : `bool` or sequence
    If ``symbs`` is `True`, draw points at the specified points using
    the desired symbol, otherwise connect the dots.

    If ``symbs`` supports indexing (which includes a string -- caveat
    emptor) the elements are used to label the points.
ctype : `str`
    ``ctype`` is the name of a color (e.g. 'red').
size : `float`
    Size of points to create if `symbs` is passed.

Definition at line 721 of file interface.py.

◆ maskColorGenerator()

lsst.afw.display.interface.Display.maskColorGenerator ( self,
omitBW = True )
A generator for "standard" colors.

Parameters
----------
omitBW : `bool`
    Don't include `BLACK` and `WHITE`.

Examples
--------

.. code-block:: py

   colorGenerator = interface.maskColorGenerator(omitBW=True)
   for p in planeList:
       print(p, next(colorGenerator))

Definition at line 409 of file interface.py.

◆ mtv()

lsst.afw.display.interface.Display.mtv ( self,
data,
title = "",
wcs = None )
Display an image on a display, with semi-transparent masks
overlaid, if available.

Notes
-----
Historical note: the name "mtv" comes from Jim Gunn's forth imageprocessing
system, Mirella (named after Mirella Freni); The "m" stands for Mirella.

Definition at line 597 of file interface.py.

◆ pan()

lsst.afw.display.interface.Display.pan ( self,
colc = None,
rowc = None,
origin = afwImage.PARENT )
Pan to a location.

Parameters
----------
colc, rowc
    Coordinates to pan to.
origin : `lsst.afw.image.ImageOrigin`
    Coordinate system for the given positions.

See also
--------
Display.zoom

Definition at line 807 of file interface.py.

◆ scale()

lsst.afw.display.interface.Display.scale ( self,
algorithm,
min,
max = None,
unit = None,
** kwargs )
Set the range of the scaling from DN in the image to the image
display.

Parameters
----------
algorithm : `str`
    Desired scaling (e.g. "linear" or "asinh").
min
    Minimum value, or "minmax" or "zscale".
max
    Maximum value (must be `None` for minmax|zscale).
unit
    Units for min and max (e.g. Percent, Absolute, Sigma; `None` if
    min==minmax|zscale).
**kwargs
    Optional keyword arguments to the backend.

Definition at line 760 of file interface.py.

◆ setCallback()

lsst.afw.display.interface.Display.setCallback ( self,
k,
func = None,
noRaise = False )
Set the callback for a key.

Backend displays may provide an equivalent graphical UI action, but
must make the associated key letter visible in the UI in some way.

Parameters
----------
k : `str`
    The key to assign the callback to.
func : callable
    The callback assigned to ``k``.
noRaise : `bool`
    Do not raise if ``k`` is already in use.

Returns
-------
oldFunc : callable
    The callback previously assigned to ``k``.

Definition at line 848 of file interface.py.

◆ setDefaultBackend()

lsst.afw.display.interface.Display.setDefaultBackend ( backend)
static

Definition at line 271 of file interface.py.

◆ setDefaultFrame()

lsst.afw.display.interface.Display.setDefaultFrame ( frame = 0)
static
Set the default frame for display.

Definition at line 285 of file interface.py.

◆ setDefaultImageColormap()

lsst.afw.display.interface.Display.setDefaultImageColormap ( cmap)
static
Set the default colormap for images.

Parameters
----------
cmap : `str`
    Name of colormap, as interpreted by the backend.

Notes
-----
The only colormaps that all backends are required to honor
(if they pay any attention to setImageColormap) are "gray" and "grey".

Definition at line 335 of file interface.py.

◆ setDefaultMaskPlaneColor()

lsst.afw.display.interface.Display.setDefaultMaskPlaneColor ( name = None,
color = None )
static
Set the default mapping from mask plane names to colors.

Parameters
----------
name : `str` or `dict`
    Name of mask plane, or a dict mapping names to colors
    If name is `None`, use the hard-coded default dictionary.
color
    Desired color, or `None` if name is a dict.

Definition at line 311 of file interface.py.

◆ setDefaultMaskTransparency()

lsst.afw.display.interface.Display.setDefaultMaskTransparency ( maskPlaneTransparency = {})
static

Definition at line 304 of file interface.py.

◆ setImageColormap()

lsst.afw.display.interface.Display.setImageColormap ( self,
cmap )
Set the colormap to use for images.

 Parameters
----------
cmap : `str`
    Name of colormap, as interpreted by the backend.

Notes
-----
The only colormaps that all backends are required to honor
(if they pay any attention to setImageColormap) are "gray" and "grey".

Definition at line 351 of file interface.py.

◆ setMaskPlaneColor()

lsst.afw.display.interface.Display.setMaskPlaneColor ( self,
name,
color = None )
Request that mask plane name be displayed as color.

Parameters
----------
name : `str` or `dict`
    Name of mask plane or a dictionary of name -> colorName.
color : `str`
    The name of the color to use (must be `None` if ``name`` is a
    `dict`).

    Colors may be specified as any X11-compliant string (e.g.
    `"orchid"`), or by one of the following constants in
    `lsst.afw.display` : `BLACK`, `WHITE`, `RED`, `BLUE`,
    `GREEN`, `CYAN`, `MAGENTA`, `YELLOW`.

    If the color is "ignore" (or `IGNORE`) then that mask plane is not
    displayed.

    The advantage of using the symbolic names is that the python
    interpreter can detect typos.

Definition at line 438 of file interface.py.

◆ setMaskTransparency()

lsst.afw.display.interface.Display.setMaskTransparency ( self,
transparency = None,
name = None )
Specify display's mask transparency (percent); or `None` to not set
it when loading masks.

Definition at line 486 of file interface.py.

◆ show()

lsst.afw.display.interface.Display.show ( self)
Uniconify and Raise display.

Notes
-----
Throws an exception if frame doesn't exit.

Definition at line 512 of file interface.py.

◆ verbose() [1/2]

lsst.afw.display.interface.Display.verbose ( self)
The backend's verbosity.

Definition at line 255 of file interface.py.

◆ verbose() [2/2]

lsst.afw.display.interface.Display.verbose ( self,
value )

Definition at line 261 of file interface.py.

◆ zoom()

lsst.afw.display.interface.Display.zoom ( self,
zoomfac = None,
colc = None,
rowc = None,
origin = afwImage.PARENT )
Zoom frame by specified amount, optionally panning also

Definition at line 786 of file interface.py.

Member Data Documentation

◆ _callbacks

lsst.afw.display.interface.Display._callbacks
protected

Definition at line 181 of file interface.py.

◆ _defaultBackend

lsst.afw.display.interface.Display._defaultBackend = None
staticprotected

Definition at line 139 of file interface.py.

◆ _defaultFrame

int lsst.afw.display.interface.Display._defaultFrame = 0
staticprotected

Definition at line 140 of file interface.py.

◆ _defaultImageColormap

str lsst.afw.display.interface.Display._defaultImageColormap = "gray"
staticprotected

Definition at line 156 of file interface.py.

◆ _defaultMaskPlaneColor

lsst.afw.display.interface.Display._defaultMaskPlaneColor
staticprotected
Initial value:
= dict(
BAD=RED,
CR=MAGENTA,
EDGE=YELLOW,
INTERPOLATED=GREEN,
SATURATED=GREEN,
DETECTED=BLUE,
DETECTED_NEGATIVE=CYAN,
SUSPECT=YELLOW,
NO_DATA=ORANGE,
# deprecated names
INTRP=GREEN,
SAT=GREEN,
)

Definition at line 141 of file interface.py.

◆ _defaultMaskTransparency

dict lsst.afw.display.interface.Display._defaultMaskTransparency = {}
staticprotected

Definition at line 155 of file interface.py.

◆ _displays

dict lsst.afw.display.interface.Display._displays = {}
staticprotected

Definition at line 138 of file interface.py.

◆ _impl

lsst.afw.display.interface.Display._impl
protected

Definition at line 172 of file interface.py.

◆ _maskPlaneColors

lsst.afw.display.interface.Display._maskPlaneColors
protected

Definition at line 177 of file interface.py.

◆ _xy0

lsst.afw.display.interface.Display._xy0
protected

Definition at line 175 of file interface.py.

◆ frame

lsst.afw.display.interface.Display.frame

Definition at line 171 of file interface.py.

◆ name

lsst.afw.display.interface.Display.name

Definition at line 173 of file interface.py.


The documentation for this class was generated from the following file: