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.
verboseverbose
and hasattr(self,
"display"):
44 print(
"virtual[%s]._close()" % (self.frame))
46 def _buffer(self, enable=True):
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))
81 def _drawLines(self, points, ctype):
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)
107 def _setCallback(self, what, func):
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))
122 def _getMaskTransparency(self):
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=""):
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
143 print(
"virtual[%s]._mtv(image=%s, mask=%s, wcs=%s, title=\"%s\")" %
144 (self.frame,
"Image" if image
else None,
145 "Mask" if mask
else None,
"Wcs" if wcs
else None, title))
147 def _setImageColormap(self, cmap):
148 """Set the desired colormap
153 the name of a colormap (e.g. "gray") or a backend-specific object
156 print(
"virtual[%s]._setImageColormap(cmap=\"%s\")" % (self.frame, cmap))
158 def _setMaskTransparency(self, transparency, maskplane):
159 """Set the transparency of a maskplane
163 transparency : `float`
164 The desired transparency, in the range [0, 100]
166 The maskplane to set (None: all)
169 print(
"virtual[%s]._setMaskTransparency(%g, maskplane=\"%s\")" %
170 (self.frame, transparency, maskplane))
172 def _scale(self, algorithm, min, max, *args, unit=None, **kwargs):
173 """Set the scaling from DN to displayed pixels
178 Scaling algorithm (e.g. linear)
180 The minimum value of the stretch (or "zscale" or "minmax")
182 The maximum value of the stretch
184 Units for min and max (e.g. Percent, Absolute, Sigma)
186 Optional arguments to the backend
188 Optional keyword arguments to the backend
191 print(
"virtual[%s]._scale(%s, %s, %s, %s, %s, %s)" % (self.frame, algorithm,
192 min, max, unit, args, kwargs))
195 """Show the requested display
198 print(
"virtual[%s]._show()" % self.frame)
200 def _pan(self, r, c):
201 """Pan to a row and column
206 Desired column (x) position
208 Desired row (y) position
211 print(
"virtual[%s]._pan(%.2f, %.2f)" % (self.frame, r, c))
213 def _zoom(self, zoomfac):
222 print(
"virtual[%s]._zoom(%g)" % (self.frame, zoomfac))
def __init__(self, display, verbose=False)