25 """Back-end for display objects. 30 The display object that we're providing the implementation for 42 """Close the display, cleaning up any allocated resources 44 if hasattr(self,
"verbose")
and self.
verbose and hasattr(self,
"display"):
45 print(
"virtual[%s]._close()" % (self.frame))
47 def _buffer(self, enable=True):
48 """Enable or disable buffering of writes to the display 53 `True` or `False`, as appropriate 56 print(
"virtual[%s]._buffer(%s)" % (self.frame, enable))
58 def _dot(self, symb, c, r, size, ctype, *args, **kwargs):
59 """Draw a symbol at (c, r) 64 The desired symbol. See `dot` for details 70 Size of symbol, in pixels 72 The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11 74 Extra arguments to backend 76 Extra keyword arguments to backend 79 print(
"virtual[%s]._dot('%s', %.2f, %.2f, size=%g, ctype=%s, %s, %s)" %
80 (self.frame, symb, c, r, size, ctype, args, kwargs))
82 def _drawLines(self, points, ctype):
83 """Draw line defined by the list points 87 points : `list` of `tuple` of `float` 88 A list of 0-indexed positions [(x, y), (x, y), ...] 90 The desired color, either e.g. `lsst.afw.display.RED` or a color name known to X11 93 print(
"virtual[%s]._drawLines(%s, ctype=%s)" %
94 (self.frame, points, ctype))
97 """Erase all glyphs drawn on display 100 print(
"virtual[%s]._erase()" % (self.frame))
103 """Flush any I/O buffers 106 print(
"virtual[%s]._flush()" % self.frame)
108 def _setCallback(self, what, func):
110 print(
"setCallback %s -> %s" % (what, func))
113 """Return an event generated by a keypress or mouse click 115 from .interface
import Event
119 print(
"virtual[%s]._getEvent() -> %s" % (self.frame, ev))
123 def _getMaskTransparency(self):
124 """Return the mask transparency for a display 127 print(
"virtual[%s]._getMaskTransparency()" % self.frame)
129 def _mtv(self, image, wcs=None, mask=None, title=""):
130 """Display an image and maybe a mask overlay on a display 134 image : `lsst.afw.image.Image` 135 `~lsst.afw.image.Image` to display 136 mask : `lsst.afw.image.Mask` 137 `~lsst.afw.image.Mask` to display 138 wcs : `lsst.afw.geom.SkyWcs` 139 A Wcs to associate with data 141 Name to display with the data 144 print(
"virtual[%s]._mtv(image=%s, mask=%s, wcs=%s, title=\"%s\")" %
145 (self.frame,
"Image" if image
else None,
146 "Mask" if mask
else None,
"Wcs" if wcs
else None, title))
148 def _setImageColormap(self, cmap):
149 """Set the desired colormap 154 the name of a colormap (e.g. "gray") or a backend-specific object 157 print(
"virtual[%s]._setImageColormap(cmap=\"%s\")" % (self.frame, cmap))
159 def _setMaskTransparency(self, transparency, maskplane):
160 """Set the transparency of a maskplane 164 transparency : `float` 165 The desired transparency, in the range [0, 100] 167 The maskplane to set (None: all) 170 print(
"virtual[%s]._setMaskTransparency(%g, maskplane=\"%s\")" %
171 (self.frame, transparency, maskplane))
173 def _scale(self, algorithm, min, max, *args, unit=None, **kwargs):
174 """Set the scaling from DN to displayed pixels 179 Scaling algorithm (e.g. linear) 181 The minimum value of the stretch (or "zscale" or "minmax") 183 The maximum value of the stretch 185 Units for min and max (e.g. Percent, Absolute, Sigma) 187 Optional arguments to the backend 189 Optional keyword arguments to the backend 192 print(
"virtual[%s]._scale(%s, %s, %s, %s, %s, %s)" % (self.frame, algorithm,
193 min, max, unit, args, kwargs))
196 """Show the requested display 199 print(
"virtual[%s]._show()" % self.frame)
201 def _pan(self, r, c):
202 """Pan to a row and column 207 Desired column (x) position 209 Desired row (y) position 212 print(
"virtual[%s]._pan(%.2f, %.2f)" % (self.frame, r, c))
214 def _zoom(self, zoomfac):
223 print(
"virtual[%s]._zoom(%g)" % (self.frame, zoomfac))
def __init__(self, display, verbose=False)