LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
LSSTDataManagementBasePackage
interface.py
Go to the documentation of this file.
1 from __future__ import print_function
2 from builtins import range
3 from builtins import object
4 #
5 # LSST Data Management System
6 # Copyright 2008, 2009, 2010, 2015 LSST Corporation.
7 #
8 # This product includes software developed by the
9 # LSST Project (http://www.lsst.org/).
10 #
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the LSST License Statement and
22 # the GNU General Public License along with this program. If not,
23 # see <http://www.lsstcorp.org/LegalNotices/>.
24 #
25 
26 ##
27 ## \file
28 ## \brief Support for talking to image displays from python
29 
30 import re
31 import sys
32 import importlib
33 import lsst.afw.geom as afwGeom
34 import lsst.afw.image as afwImage
35 import lsst.log
36 
37 logger = lsst.log.Log.getLogger("afw.display.interface")
38 
39 __all__ = (
40  "WHITE", "BLACK", "RED", "GREEN", "BLUE", "CYAN", "MAGENTA", "YELLOW", "ORANGE",
41  "Display", "Event", "noop_callback", "h_callback",
42  "setDefaultBackend", "getDefaultBackend",
43  "setDefaultFrame", "getDefaultFrame", "incrDefaultFrame",
44  "setDefaultMaskTransparency", "setDefaultMaskPlaneColor",
45  "getDisplay", "delAllDisplays",
46 )
47 
48 #
49 # Symbolic names for mask/line colours. N.b. ds9 supports any X11 colour for masks
50 #
51 WHITE = "white"
52 BLACK = "black"
53 RED = "red"
54 GREEN = "green"
55 BLUE = "blue"
56 CYAN = "cyan"
57 MAGENTA = "magenta"
58 YELLOW = "yellow"
59 ORANGE = "orange"
60 
61 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
62 
63 def _makeDisplayImpl(display, backend, *args, **kwargs):
64  """!Return the DisplayImpl for the named backend
65 
66  \param backend Name of device. Should be importable, either absolutely or relative to lsst.display
67  \param frame Identifier for this instance of the backend
68  \param args Arguments passed to DisplayImpl.__init__
69  \param kwrgs Keywords arguments passed to DisplayImpl.__init__
70 
71  E.g.
72  import lsst.afw.display as afwDisplay
73  display = afwDisplay.Display("ds9", frame=1)
74  would call
75  _makeDisplayImpl(..., "ds9", 1)
76  and import the ds9 implementation of DisplayImpl from lsst.display.ds9
77  """
78  _disp = None
79  exc = None
80  for dt in (backend, ".%s" % backend, "lsst.afw.display.%s" % backend):
81  exc = None
82  # only specify the root package if we are not doing an absolute import
83  impargs = {}
84  if dt.startswith("."):
85  impargs["package"] = "lsst.display"
86  try:
87  _disp = importlib.import_module(dt, **impargs)
88  break
89  except (ImportError, SystemError) as e:
90  # SystemError can be raised in Python 3.5 if a relative import
91  # is attempted when the root package, lsst.display, does not exist.
92  # Copy the exception into outer scope
93  exc = e
94 
95  if not _disp:
96  if exc is not None:
97  # re-raise the final exception
98  raise exc
99  else:
100  raise ImportError("Could not load the requested backend: {}".format(backend))
101 
102  return _disp.DisplayImpl(display, *args, **kwargs)
103 
104 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
105 
106 class Display(object):
107  _displays = {}
108  _defaultBackend = None
109  _defaultFrame = 0
110  _defaultMaskPlaneColor = dict(
111  BAD=RED,
112  CR=MAGENTA,
113  EDGE=YELLOW,
114  INTERPOLATED=GREEN,
115  SATURATED=GREEN,
116  DETECTED=BLUE,
117  DETECTED_NEGATIVE=CYAN,
118  SUSPECT=YELLOW,
119  NO_DATA=ORANGE,
120  # deprecated names
121  INTRP=GREEN,
122  SAT=GREEN,
123  )
124  _defaultMaskTransparency = {}
125 
126  def __init__(self, frame, backend=None, *args, **kwargs):
127  """!Create an object able to display images and overplot glyphs
128 
129  \param frame An identifier for the display
130  \param backend The backend to use (defaults to value set by setDefaultBackend())
131  \param args Arguments to pass to the backend
132  \param kwargs Arguments to pass to the backend
133  """
134  if backend is None:
135  if Display._defaultBackend is None:
136  try:
137  setDefaultBackend("ds9")
138  except RuntimeError:
139  setDefaultBackend("virtualDevice")
140 
141  backend = Display._defaultBackend
142 
143  self.frame = frame
144  self._impl = _makeDisplayImpl(self, backend, *args, **kwargs)
145 
146  self._xy0 = None # the data displayed on the frame's XY0
147  self.setMaskTransparency(Display._defaultMaskTransparency)
149  self.setMaskPlaneColor(Display._defaultMaskPlaneColor)
150 
151  self._callbacks = {}
152 
153  for ik in range(ord('a'), ord('z') + 1):
154  k = "%c" % ik
155  self.setCallback(k, noRaise=True)
156  self.setCallback(k.upper(), noRaise=True)
157 
158  for k in ('Return', 'Shift_L', 'Shift_R'):
159  self.setCallback(k)
160 
161  for k in ('q', 'Escape'):
162  self.setCallback(k, lambda k, x, y: True)
163 
164  def _h_callback(k, x, y):
165  h_callback(k, x, y)
166 
167  for k in sorted(self._callbacks.keys()):
168  doc = self._callbacks[k].__doc__
169  print(" %-6s %s" % (k, doc.split("\n")[0] if doc else "???"))
170 
171  self.setCallback('h', _h_callback)
172 
173  def __enter__(self):
174  """!Support for python's with statement"""
175  return self
176 
177  def __exit__(self, *args):
178  """!Support for python's with statement"""
179  self.close()
180 
181  def __del__(self):
182  self.close()
183 
184  def close(self):
185  if hasattr(self, "_impl") and self._impl:
186  del self._impl
187  self._impl = None
188 
189  if self.frame in Display._displays:
190  del Display._displays[self.frame]
191 
192  @property
193  def verbose(self):
194  """!The backend's verbosity"""
195  return self._impl.verbose
196 
197  @verbose.setter
198  def verbose(self, value):
199  if self._impl:
200  self._impl.verbose = value
201 
202  def __str__(self):
203  return "Display[%s]" % (self.frame)
204 
205  #
206  # Handle Displays, including the default one (the frame to use when a user specifies None)
207  #
208  @staticmethod
209  def setDefaultBackend(backend):
210  try:
211  _makeDisplayImpl(None, backend)
212  except Exception as e:
213  raise RuntimeError("Unable to set backend to %s: \"%s\"" % (backend, e))
214 
215  Display._defaultBackend = backend
216 
217  @staticmethod
219  return Display._defaultBackend
220 
221  @staticmethod
222  def setDefaultFrame(frame=0):
223  """Set the default frame for display"""
224  Display._defaultFrame = frame
225 
226  @staticmethod
228  """Get the default frame for display"""
229  return Display._defaultFrame
230 
231  @staticmethod
233  """Increment the default frame for display"""
234  Display._defaultFrame += 1
235  return Display._defaultFrame
236 
237  @staticmethod
238  def setDefaultMaskTransparency(maskPlaneTransparency={}):
239  if hasattr(maskPlaneTransparency, "copy"):
240  maskPlaneTransparency = maskPlaneTransparency.copy()
241 
242  Display._defaultMaskTransparency = maskPlaneTransparency
243 
244  @staticmethod
245  def setDefaultMaskPlaneColor(name=None, color=None):
246  """!Set the default mapping from mask plane names to colours
247  \param name name of mask plane, or a dict mapping names to colours
248  \param color Desired color, or None if name is a dict
249 
250  If name is None, use the hard-coded default dictionary
251  """
252 
253  if name is None:
254  name = Display._defaultMaskPlaneColor
255 
256  if isinstance(name, dict):
257  assert color == None
258  for k, v in name.items():
260  return
261  #
262  # Set the individual colour values
263  #
264  Display._defaultMaskPlaneColor[name] = color
265 
266  @staticmethod
267  def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
268  """!Return the Display indexed by frame, creating it if needs be
269 
270  \param frame The desired frame (None => use defaultFrame (see setDefaultFrame))
271  \param backend create the specified frame using this backend (or the default if None) \
272  if it doesn't already exist. If backend == "", it's an error to specify a non-existent frame
273  \param create create the display if it doesn't already exist.
274  \param verbose Allow backend to be chatty
275  \param args arguments passed to Display constructor
276  \param kwargs keyword arguments passed to Display constructor
277  """
278 
279  if frame is None:
280  frame = Display._defaultFrame
281 
282  if not frame in Display._displays:
283  if backend == "":
284  raise RuntimeError("Frame %s does not exist" % frame)
285 
286  Display._displays[frame] = Display(frame, backend, verbose=verbose, *args, **kwargs)
287 
288  Display._displays[frame].verbose = verbose
289  return Display._displays[frame]
290 
291  @staticmethod
293  """!Delete and close all known display
294  """
295  for disp in list(Display._displays.values()):
296  disp.close()
297  Display._displays = {}
298 
299  def maskColorGenerator(self, omitBW=True):
300  """!A generator for "standard" colours
301 
302  \param omitBW Don't include Black and White
303 
304  e.g.
305  colorGenerator = interface.maskColorGenerator(omitBW=True)
306  for p in planeList:
307  print p, next(colorGenerator)
308  """
309  _maskColors = [WHITE, BLACK, RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, ORANGE]
310 
311  i = -1
312  while True:
313  i += 1
314  color = _maskColors[i%len(_maskColors)]
315  if omitBW and color in (BLACK, WHITE):
316  continue
317 
318  yield color
319 
320  def setMaskPlaneColor(self, name, color=None):
321  """!Request that mask plane name be displayed as color
322 
323  \param name Name of mask plane or a dictionary of name -> colourName
324  \param color The name of the colour to use (must be None if name is a dict)
325 
326  Colours may be specified as any X11-compliant string (e.g. <tt>"orchid"</tt>), or by one
327  of the following constants defined in \c afwDisplay: \c BLACK, \c WHITE, \c RED, \c BLUE,
328  \c GREEN, \c CYAN, \c MAGENTA, \c YELLOW.
329 
330  The advantage of using the symbolic names is that the python interpreter can detect typos.
331 
332  """
333 
334  if isinstance(name, dict):
335  assert color == None
336  for k, v in name.items():
337  self.setMaskPlaneColor(k, v)
338  return
339 
340  self._maskPlaneColors[name] = color
341 
342  def getMaskPlaneColor(self, name):
343  """!Return the colour associated with the specified mask plane name"""
344 
345  return self._maskPlaneColors.get(name)
346 
347  def setMaskTransparency(self, transparency=None, name=None):
348  """!Specify display's mask transparency (percent); or None to not set it when loading masks"""
349 
350  if isinstance(transparency, dict):
351  assert name == None
352  for k, v in transparency.items():
353  self.setMaskTransparency(k, v)
354  return
355 
356  if transparency is not None and (transparency < 0 or transparency > 100):
357  print("Mask transparency should be in the range [0, 100]; clipping", file=sys.stderr)
358  if transparency < 0:
359  transparency = 0
360  else:
361  transparency = 100
362 
363  if transparency is not None:
364  self._impl._setMaskTransparency(transparency, name)
365 
366  def getMaskTransparency(self, name=None):
367  """!Return the current display's mask transparency"""
368 
369  self._impl._getMaskTransparency(name)
370 
371  def show(self):
372  """!Uniconify and Raise display. N.b. throws an exception if frame doesn't exit"""
373  self._impl._show()
374 
375  def mtv(self, data, title="", wcs=None):
376  """!Display an Image or Mask on a DISPLAY display
377 
378  Historical note: the name "mtv" comes from Jim Gunn's forth imageprocessing
379  system, Mirella (named after Mirella Freni); The "m" stands for Mirella.
380  """
381  if hasattr(data, "getXY0"):
382  self._xy0 = data.getXY0()
383  else:
384  self._xy0 = None
385 
386  if re.search("::Exposure<", repr(data)): # it's an Exposure; display the MaskedImage with the WCS
387  if wcs:
388  raise RuntimeError("You may not specify a wcs with an Exposure")
389  data, wcs = data.getMaskedImage(), data.getWcs()
390  elif re.search("::DecoratedImage<", repr(data)): # it's a DecoratedImage; display it
391  data, wcs = data.getImage(), afwImage.makeWcs(data.getMetadata())
392  self._xy0 = data.getXY0() # DecoratedImage doesn't have getXY0()
393 
394  if re.search("::Image<", repr(data)): # it's an Image; display it
395  self._impl._mtv(data, None, wcs, title)
396  elif re.search("::Mask<", repr(data)): # it's a Mask; display it, bitplane by bitplane
397  #
398  # Some displays can't display a Mask without an image; so display an Image too,
399  # with pixel values set to the mask
400  #
401  self._impl._mtv(afwImage.ImageU(data.getArray()), data, wcs, title)
402  elif re.search("::MaskedImage<", repr(data)): # it's a MaskedImage; display Image and overlay Mask
403  self._impl._mtv(data.getImage(), data.getMask(True), wcs, title)
404  else:
405  raise RuntimeError("Unsupported type %s" % repr(data))
406  #
407  # Graphics commands
408  #
409  class _Buffering(object):
410  """A class intended to be used with python's with statement"""
411  def __init__(self, _impl):
412  self._impl = _impl
413  def __enter__(self):
414  self._impl._buffer(True)
415  def __exit__(self, *args):
416  self._impl._buffer(False)
417  self._impl._flush()
418 
419  def Buffering(self):
420  """Return a class intended to be used with python's with statement
421  E.g.
422  with display.Buffering():
423  display.dot("+", xc, yc)
424  """
425  return self._Buffering(self._impl)
426 
427  def flush(self):
428  """!Flush the buffers"""
429  self._impl._flush()
430 
431  def erase(self):
432  """!Erase the specified DISPLAY frame
433  """
434  self._impl._erase()
435 
436  def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, *args, **kwargs):
437  """!Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates]
438 
439  Possible values are:
440  + Draw a +
441  x Draw an x
442  * Draw a *
443  o Draw a circle
444  @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
445  An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
446  Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended
447  with other characteristics, e.g. "times bold italic". Text will be drawn rotated by textAngle (textAngle is
448  ignored otherwise).
449 
450  N.b. objects derived from BaseCore include Axes and Quadrupole.
451  """
452  if isinstance(symb, int):
453  symb = "%d" % (symb)
454 
455  if origin == afwImage.PARENT and self._xy0 is not None:
456  x0, y0 = self._xy0
457  r -= y0
458  c -= x0
459 
460  if isinstance(symb, afwGeom.ellipses.BaseCore) or re.search(r"^@:", symb):
461  try:
462  mat = re.search(r"^@:([^,]+),([^,]+),([^,]+)", symb)
463  except TypeError:
464  pass
465  else:
466  if mat:
467  mxx, mxy, myy = [float(_) for _ in mat.groups()]
468  symb = afwGeom.ellipses.Quadrupole(mxx, myy, mxy)
469 
470  symb = afwGeom.ellipses.Axes(symb)
471 
472  self._impl._dot(symb, c, r, size, ctype, **kwargs)
473 
474  def line(self, points, origin=afwImage.PARENT, symbs=False, ctype=None, size=0.5):
475  """!Draw a set of symbols or connect the points, a list of (col,row)
476  If symbs is True, draw points at the specified points using the desired symbol,
477  otherwise connect the dots. Ctype is the name of a colour (e.g. 'red')
478 
479  If symbs supports indexing (which includes a string -- caveat emptor) the elements are used to label the points
480  """
481  if symbs:
482  try:
483  symbs[1]
484  except:
485  symbs = len(points)*list(symbs)
486 
487  for i, xy in enumerate(points):
488  self.dot(symbs[i], *xy, size=size, ctype=ctype)
489  else:
490  if len(points) > 0:
491  if origin == afwImage.PARENT and self._xy0 is not None:
492  x0, y0 = self._xy0
493  _points = list(points) # make a mutable copy
494  for i, p in enumerate(points):
495  _points[i] = (p[0] - x0, p[1] - y0)
496  points = _points
497 
498  self._impl._drawLines(points, ctype)
499  #
500  # Set gray scale
501  #
502  def scale(self, algorithm, min, max=None, unit=None, *args, **kwargs):
503  """!Set the range of the scaling from DN in the image to the image display
504  \param algorithm Desired scaling (e.g. "linear" or "asinh")
505  \param min Minimum value, or "minmax" or "zscale"
506  \param max Maximum value (must be None for minmax|zscale)
507  \param unit Units for min and max (e.g. Percent, Absolute, Sigma; None if min==minmax|zscale)
508  \param *args Optional arguments
509  \param **kwargs Optional keyword arguments
510  """
511  if min in ("minmax", "zscale"):
512  assert max == None, "You may not specify \"%s\" and max" % min
513  assert unit == None, "You may not specify \"%s\" and unit" % min
514  elif max is None:
515  raise RuntimeError("Please specify max")
516 
517  self._impl._scale(algorithm, min, max, unit, *args, **kwargs)
518  #
519  # Zoom and Pan
520  #
521  def zoom(self, zoomfac=None, colc=None, rowc=None, origin=afwImage.PARENT):
522  """!Zoom frame by specified amount, optionally panning also"""
523 
524  if (rowc and colc is None) or (colc and rowc is None):
525  raise RuntimeError("Please specify row and column center to pan about")
526 
527  if rowc is not None:
528  if origin == afwImage.PARENT and self._xy0 is not None:
529  x0, y0 = self._xy0
530  rowc -= x0
531  colc -= y0
532 
533  self._impl._pan(colc, rowc)
534 
535  if zoomfac == None and rowc == None:
536  zoomfac = 2
537 
538  if zoomfac is not None:
539  self._impl._zoom(zoomfac)
540 
541  def pan(self, colc=None, rowc=None, origin=afwImage.PARENT):
542  """!Pan to (rowc, colc); see also zoom"""
543 
544  self.zoom(None, colc, rowc, origin)
545 
546  def interact(self):
547  """!Enter an interactive loop, listening for key presses in display and firing callbacks.
548  Exit with q, \c CR, \c ESC, or any other callback function that returns a ``True`` value.
549  """
550  interactFinished = False
551 
552  while not interactFinished:
553  ev = self._impl._getEvent()
554  if not ev:
555  continue
556  k, x, y = ev.k, ev.x, ev.y # for now
557 
558  if k not in self._callbacks:
559  logger.warn("No callback registered for {0}".format(k))
560  else:
561  try:
562  interactFinished = self._callbacks[k](k, x, y)
563  except Exception as e:
564  logger.error("Display._callbacks[{0}]({0},{1},{2}) failed: {3}".format(k, x, y, e))
565 
566  def setCallback(self, k, func=None, noRaise=False):
567  """!Set the callback for key k to be func, returning the old callback
568  """
569 
570  if k in "f":
571  if noRaise:
572  return
573  raise RuntimeError(
574  "Key '%s' is already in use by display, so I can't add a callback for it" % k)
575 
576  ofunc = self._callbacks.get(k)
577  self._callbacks[k] = func if func else noop_callback
578 
579  self._impl._setCallback(k, self._callbacks[k])
580 
581  return ofunc
582 
583  def getActiveCallbackKeys(self, onlyActive=True):
584  """!Return all callback keys
585  \param onlyActive If true only return keys that do something
586  """
587 
588  return sorted([k for k, func in self._callbacks.items() if
589  not (onlyActive and func == noop_callback)])
590 
591 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
592 #
593 # Callbacks for display events
594 #
595 class Event(object):
596  """!A class to handle events such as key presses in image display windows"""
597  def __init__(self, k, x=float('nan'), y=float('nan')):
598  self.k = k
599  self.x = x
600  self.y = y
601 
602  def __str__(self):
603  return "%s (%.2f, %.2f)" % (self.k, self.x, self.y)
604 #
605 # Default fallback function
606 #
607 def noop_callback(k, x, y):
608  """!Callback function: arguments key, x, y"""
609  return False
610 
611 def h_callback(k, x, y):
612  print("Enter q or <ESC> to leave interactive mode, h for this help, or a letter to fire a callback")
613  return False
614 
615 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
616 #
617 # Handle Displays, including the default one (the frame to use when a user specifies None)
618 #
619 # If the default frame is None, image display is disabled
620 #
621 def setDefaultBackend(backend):
622  Display.setDefaultBackend(backend)
623 
625  return Display.getDefaultBackend()
626 
627 def setDefaultFrame(frame=0):
628  return Display.setDefaultFrame(frame)
629 
631  """Get the default frame for display"""
632  return Display.getDefaultFrame()
633 
635  """Increment the default frame for display"""
636  return Display.incrDefaultFrame()
637 
638 def setDefaultMaskTransparency(maskPlaneTransparency={}):
639  return Display.setDefaultMaskTransparency(maskPlaneTransparency)
640 
641 def setDefaultMaskPlaneColor(name=None, color=None):
642  """!Set the default mapping from mask plane names to colours
643  \param name name of mask plane, or a dict mapping names to colours
644  \param color Desired color, or None if name is a dict
645 
646  If name is None, use the hard-coded default dictionary
647  """
648 
649  return Display.setDefaultMaskPlaneColor(name, color)
650 
651 def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
652  """!Return the Display indexed by frame, creating it if needs be
653 
654  See Display.getDisplay
655 
656  \param frame The desired frame (None => use defaultFrame (see setDefaultFrame))
657  \param backend create the specified frame using this backend (or the default if None) \
658  if it doesn't already exist. If backend == "", it's an error to specify a non-existent frame
659  \param create create the display if it doesn't already exist.
660  \param verbose Allow backend to be chatty
661  \param args arguments passed to Display constructor
662  \param kwargs keyword arguments passed to Display constructor
663  """
664 
665  return Display.getDisplay(frame, backend, create, verbose, *args, **kwargs)
666 
668  """!Delete and close all known display
669  """
670  return Display.delAllDisplays()
def getMaskTransparency
Return the current display&#39;s mask transparency.
Definition: interface.py:366
def getDisplay
Return the Display indexed by frame, creating it if needs be.
Definition: interface.py:267
def setMaskTransparency
Specify display&#39;s mask transparency (percent); or None to not set it when loading masks...
Definition: interface.py:347
def interact
Enter an interactive loop, listening for key presses in display and firing callbacks.
Definition: interface.py:546
def setMaskPlaneColor
Request that mask plane name be displayed as color.
Definition: interface.py:320
def zoom
Zoom frame by specified amount, optionally panning also.
Definition: interface.py:521
def delAllDisplays
Delete and close all known display.
Definition: interface.py:292
def mtv
Display an Image or Mask on a DISPLAY display.
Definition: interface.py:375
Definition: Log.h:716
def __enter__
Support for python&#39;s with statement.
Definition: interface.py:173
def pan
Pan to (rowc, colc); see also zoom.
Definition: interface.py:541
def verbose
The backend&#39;s verbosity.
Definition: interface.py:193
def __init__
Create an object able to display images and overplot glyphs.
Definition: interface.py:126
def getMaskPlaneColor
Return the colour associated with the specified mask plane name.
Definition: interface.py:342
A class to handle events such as key presses in image display windows.
Definition: interface.py:595
def dot
Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates].
Definition: interface.py:436
def _makeDisplayImpl
Return the DisplayImpl for the named backend.
Definition: interface.py:63
boost::shared_ptr< Wcs > makeWcs(coord::Coord const &crval, geom::Point2D const &crpix, double CD11, double CD12, double CD21, double CD22)
Create a Wcs object from crval, crpix, CD, using CD elements (useful from python) ...
Definition: makeWcs.cc:138
def scale
Set the range of the scaling from DN in the image to the image display.
Definition: interface.py:502
def delAllDisplays
Delete and close all known display.
Definition: interface.py:667
def show
Uniconify and Raise display.
Definition: interface.py:371
def line
Draw a set of symbols or connect the points, a list of (col,row) If symbs is True, draw points at the specified points using the desired symbol, otherwise connect the dots.
Definition: interface.py:474
def setCallback
Set the callback for key k to be func, returning the old callback.
Definition: interface.py:566
def erase
Erase the specified DISPLAY frame.
Definition: interface.py:431
static Log getLogger(Log const &logger)
Definition: Log.h:772
def getDisplay
Return the Display indexed by frame, creating it if needs be.
Definition: interface.py:651
def flush
Flush the buffers.
Definition: interface.py:427
def __exit__
Support for python&#39;s with statement.
Definition: interface.py:177
def getActiveCallbackKeys
Return all callback keys.
Definition: interface.py:583
def noop_callback
Callback function: arguments key, x, y.
Definition: interface.py:607
def maskColorGenerator
A generator for &quot;standard&quot; colours.
Definition: interface.py:299
def setDefaultMaskPlaneColor
Set the default mapping from mask plane names to colours.
Definition: interface.py:641
def setDefaultMaskPlaneColor
Set the default mapping from mask plane names to colours.
Definition: interface.py:245