Display¶
- class lsst.afw.display.Display(frame=None, backend=None, **kwargs)¶
- Bases: - object- Create an object able to display images and overplot glyphs. - Parameters:
- frame
- An identifier for the display. 
- backendstr
- The backend to use (defaults to value set by setDefaultBackend()). 
- **kwargs
- Arguments to pass to the backend. 
 
 - Attributes Summary - The backend's verbosity. - Methods Summary - Return a context manager that will buffer repeated display commands, to e.g. - centroids(catalog, *[, symbol])- Draw the sources from a catalog at their pixel centroid positions as given by - getX()and- getY().- close()- Delete and close all known displays. - dot(symb, c, r[, size, ctype, origin])- Draw a symbol onto the specified display frame. - erase()- Erase the specified display frame. - flush()- Flush any buffering that may be provided by the backend. - getActiveCallbackKeys([onlyActive])- Return all callback keys - Get the default frame for display. - getDisplay([frame, backend, create, verbose])- Return a specific - Display, creating it if need be.- getMaskPlaneColor([name])- Return the color associated with the specified mask plane name. - getMaskTransparency([name])- Return the current display's mask transparency. - image(data[, title, wcs])- Display an image on a display, with semi-transparent masks overlaid, if available. - Increment the default frame for display. - interact()- Enter an interactive loop, listening for key presses or equivalent UI actions in the display and firing callbacks. - line(points[, origin, symbs, ctype, size])- Draw a set of symbols or connect points - maskColorGenerator([omitBW])- A generator for "standard" colors. - mtv(data[, title, wcs])- Display an image on a display, with semi-transparent masks overlaid, if available. - pan([colc, rowc, origin])- Pan to a location. - scale(algorithm, min[, max, unit])- Set the range of the scaling from DN in the image to the image display. - setCallback(k[, func, noRaise])- Set the callback for a key. - setDefaultBackend(backend)- setDefaultFrame([frame])- Set the default frame for display. - setDefaultImageColormap(cmap)- Set the default colormap for images. - setDefaultMaskPlaneColor([name, color])- Set the default mapping from mask plane names to colors. - setDefaultMaskTransparency([...])- setImageColormap(cmap)- Set the colormap to use for images. - setMaskPlaneColor(name[, color])- Request that mask plane name be displayed as color. - setMaskTransparency([transparency, name])- Specify display's mask transparency (percent); or - Noneto not set it when loading masks.- show()- Uniconify and Raise display. - zoom([zoomfac, colc, rowc, origin])- Zoom frame by specified amount, optionally panning also - Attributes Documentation - verbose¶
- The backend’s verbosity. 
 - Methods Documentation - Buffering()¶
- Return a context manager that will buffer repeated display commands, to e.g. speed up displaying points. - Examples - with display.Buffering(): display.dot("+", xc, yc) 
 - centroids(catalog, *, symbol='o', **kwargs)¶
- Draw the sources from a catalog at their pixel centroid positions as given by - getX()and- getY().- See - dotfor an explanation of- symboland available args/kwargs, which are passed to- dot.- Parameters:
- cataloglsst.afw.table.Catalog
- Catalog to display centroids for. Must have valid - slot_Centroid.
 
- catalog
 
 - close()¶
 - static delAllDisplays()¶
- Delete and close all known displays. 
 - dot(symb, c, r, size=2, ctype=None, origin=<ImageOrigin.PARENT: 0>, **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 - BaseCoreinclude- Axesand- Quadrupole.
- Any other value
- Interpreted as a string to be drawn. 
 
- c, rfloat
- The column and row where the symbol is drawn [0-based coordinates]. 
- sizeint
- Size of symbol, in pixels. 
- ctypestr
- The desired color, either e.g. - lsst.afw.display.REDor a color name known to X11
- originlsst.afw.image.ImageOrigin
- Coordinate system for the given positions. 
- **kwargs
- Extra keyword arguments to backend. 
 
 
 - erase()¶
- Erase the specified display frame. 
 - flush()¶
- Flush any buffering that may be provided by the backend. 
 - getActiveCallbackKeys(onlyActive=True)¶
- Return all callback keys 
 - static getDefaultBackend()¶
 - static getDefaultFrame()¶
- Get the default frame for display. 
 - static getDisplay(frame=None, backend=None, create=True, verbose=False, **kwargs)¶
- Return a specific - Display, creating it if need be.- Parameters:
- frame
- The desired frame ( - None=> use defaultFrame (see- setDefaultFrame)).
- backendstr
- 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.
- createbool
- create the display if it doesn’t already exist. 
- verbosebool
- Allow backend to be chatty. 
- **kwargs
- keyword arguments passed to - Displayconstructor.
 
 
 - getMaskPlaneColor(name=None)¶
- Return the color associated with the specified mask plane name. 
 - getMaskTransparency(name=None)¶
- Return the current display’s mask transparency. 
 - image(data, title='', wcs=None)¶
- Display an image on a display, with semi-transparent masks overlaid, if available. - Parameters:
- datalsst.afw.image.Exposureorlsst.afw.image.MaskedImageorlsst.afw.image.Image
- Image to display; Exposure and MaskedImage will show transparent mask planes. 
- titlestr, optional
- Title for the display window. 
- wcslsst.afw.geom.SkyWcs, optional
- World Coordinate System to align an - MaskedImageor- Imageto; raise an exception if- datais an- Exposure.
 
- data
- Raises:
- RuntimeError
- Raised if an Exposure is passed with a non-None wcs when the - wcskwarg is also non-None.
- TypeError
- Raised if data is an incompatible type. 
 
 
 - static incrDefaultFrame()¶
- Increment the default frame for display. 
 - interact()¶
- 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- Truefrom a user-provided callback function.
 - line(points, origin=<ImageOrigin.PARENT: 0>, symbs=False, ctype=None, size=0.5)¶
- Draw a set of symbols or connect points - Parameters:
- pointslist
- A list of (col, row) 
- originlsst.afw.image.ImageOrigin
- Coordinate system for the given positions. 
- symbsboolor sequence
- If - symbsis- True, draw points at the specified points using the desired symbol, otherwise connect the dots.- If - symbssupports indexing (which includes a string – caveat emptor) the elements are used to label the points.
- ctypestr
- ctypeis the name of a color (e.g. ‘red’).
- sizefloat
- Size of points to create if - symbsis passed.
 
- points
 
 - maskColorGenerator(omitBW=True)¶
- A generator for “standard” colors. - Parameters:
- omitBWbool
- Don’t include - BLACKand- WHITE.
 
- omitBW
 - Examples - colorGenerator = interface.maskColorGenerator(omitBW=True) for p in planeList: print(p, next(colorGenerator)) 
 - mtv(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. 
 - pan(colc=None, rowc=None, origin=<ImageOrigin.PARENT: 0>)¶
- Pan to a location. - Parameters:
- colc, rowc
- Coordinates to pan to. 
- originlsst.afw.image.ImageOrigin
- Coordinate system for the given positions. 
 
 - See also 
 - scale(algorithm, min, max=None, unit=None, **kwargs)¶
- Set the range of the scaling from DN in the image to the image display. 
 - setCallback(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. 
 - static setDefaultBackend(backend)¶
 - static setDefaultFrame(frame=0)¶
- Set the default frame for display. 
 - static setDefaultImageColormap(cmap)¶
- Set the default colormap for images. - Parameters:
- cmapstr
- Name of colormap, as interpreted by the backend. 
 
- cmap
 - Notes - The only colormaps that all backends are required to honor (if they pay any attention to setImageColormap) are “gray” and “grey”. 
 - static setDefaultMaskPlaneColor(name=None, color=None)¶
- Set the default mapping from mask plane names to colors. 
 - static setDefaultMaskTransparency(maskPlaneTransparency={})¶
 - setImageColormap(cmap)¶
- Set the colormap to use for images. - Parameters:
- cmapstr
- Name of colormap, as interpreted by the backend. 
 
- cmap
 - Notes - The only colormaps that all backends are required to honor (if they pay any attention to setImageColormap) are “gray” and “grey”. 
 - setMaskPlaneColor(name, color=None)¶
- Request that mask plane name be displayed as color. - Parameters:
- namestrordict
- Name of mask plane or a dictionary of name -> colorName. 
- colorstr
- The name of the color to use (must be - Noneif- nameis 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. 
 
- name
 
 - setMaskTransparency(transparency=None, name=None)¶
- Specify display’s mask transparency (percent); or - Noneto not set it when loading masks.
 - show()¶
- Uniconify and Raise display. - Notes - Throws an exception if frame doesn’t exit. 
 - zoom(zoomfac=None, colc=None, rowc=None, origin=<ImageOrigin.PARENT: 0>)¶
- Zoom frame by specified amount, optionally panning also