24 """Back-end for display objects.
29 The display object that we're providing the implementation for
41 """Close the display, cleaning up any allocated resources
43 if hasattr(self,
"verbose")
and self.
verbose and hasattr(self,
"display"):
44 print(
"virtual[%s]._close()" % (self.
frame))
47 """Enable or disable buffering of writes to the display
52 `True` or `False`, as appropriate
55 print(
"virtual[%s]._buffer(%s)" % (self.
frame, enable))
57 def _dot(self, symb, c, r, size, ctype, *args, **kwargs):
58 """Draw a symbol at (c, r)
63 The desired symbol. See `dot` for details
69 Size of symbol, in pixels
71 The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11
73 Extra arguments to backend
75 Extra keyword arguments to backend
78 print(
"virtual[%s]._dot('%s', %.2f, %.2f, size=%g, ctype=%s, %s, %s)" %
79 (self.
frame, symb, c, r, size, ctype, args, kwargs))
82 """Draw line defined by the list points
86 points : `list` of `tuple` of `float`
87 A list of 0-indexed positions [(x, y), (x, y), ...]
89 The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11
92 print(
"virtual[%s]._drawLines(%s, ctype=%s)" %
93 (self.
frame, points, ctype))
96 """Erase all glyphs drawn on display
99 print(
"virtual[%s]._erase()" % (self.
frame))
102 """Flush any I/O buffers
105 print(
"virtual[%s]._flush()" % self.
frame)
109 print(
"setCallback %s -> %s" % (what, func))
112 """Return an event generated by a keypress or mouse click
114 from .interface
import Event
118 print(
"virtual[%s]._getEvent() -> %s" % (self.
frame, ev))
123 """Return the mask transparency for a display
126 print(
"virtual[%s]._getMaskTransparency()" % self.
frame)
128 def _mtv(self, image, wcs=None, mask=None, title="", metadata=None):
129 """Display an image and maybe a mask overlay on a display
133 image : `lsst.afw.image.Image`
134 `~lsst.afw.image.Image` to display
135 mask : `lsst.afw.image.Mask`
136 `~lsst.afw.image.Mask` to display
137 wcs : `lsst.afw.geom.SkyWcs`
138 A Wcs to associate with data
140 Name to display with the data
141 metadata : `lsst.daf.base.PropertySet`
145 print(
"virtual[%s]._mtv(image=%s, mask=%s, wcs=%s, title=\"%s\", metadata=\"%s\")" %
146 (self.
frame,
"Image" if image
else None,
147 "Mask" if mask
else None,
"Wcs" if wcs
else None, title,
148 f
"{len(metadata)} cards" if metadata
else "None"))
151 """Set the desired colormap
156 the name of a colormap (e.g. "gray") or a backend-specific object
159 print(
"virtual[%s]._setImageColormap(cmap=\"%s\")" % (self.
frame, cmap))
162 """Set the transparency of a maskplane
166 transparency : `float`
167 The desired transparency, in the range [0, 100]
169 The maskplane to set (None: all)
172 print(
"virtual[%s]._setMaskTransparency(%g, maskplane=\"%s\")" %
173 (self.
frame, transparency, maskplane))
175 def _scale(self, algorithm, min, max, *args, unit=None, **kwargs):
176 """Set the scaling from DN to displayed pixels
181 Scaling algorithm (e.g. linear)
183 The minimum value of the stretch (or "zscale" or "minmax")
185 The maximum value of the stretch
187 Units for min and max (e.g. Percent, Absolute, Sigma)
189 Optional arguments to the backend
191 Optional keyword arguments to the backend
194 print(
"virtual[%s]._scale(%s, %s, %s, %s, %s, %s)" % (self.
frame, algorithm,
195 min, max, unit, args, kwargs))
198 """Show the requested display
201 print(
"virtual[%s]._show()" % self.
frame)
204 """Pan to a row and column
209 Desired column (x) position
211 Desired row (y) position
214 print(
"virtual[%s]._pan(%.2f, %.2f)" % (self.
frame, r, c))
225 print(
"virtual[%s]._zoom(%g)" % (self.
frame, zoomfac))
_setCallback(self, what, func)
_dot(self, symb, c, r, size, ctype, *args, **kwargs)
_setImageColormap(self, cmap)
_getMaskTransparency(self)
_setMaskTransparency(self, transparency, maskplane)
__init__(self, display, verbose=False)
_buffer(self, enable=True)
_drawLines(self, points, ctype)
_mtv(self, image, wcs=None, mask=None, title="", metadata=None)
_scale(self, algorithm, min, max, *args, unit=None, **kwargs)