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