LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
lsst.afw.display.interface.Display Class Reference
Inheritance diagram for lsst.afw.display.interface.Display:

Classes

class  _Buffering
 

Public Member Functions

def __init__
 Create an object able to display images and overplot glyphs. More...
 
def __enter__
 Support for python's with statement. More...
 
def __exit__
 Support for python's with statement. More...
 
def __del__
 
def close
 
def verbose
 The backend's verbosity. More...
 
def verbose
 
def __str__
 
def maskColorGenerator
 A generator for "standard" colours. More...
 
def setMaskPlaneColor
 Request that mask plane name be displayed as color. More...
 
def getMaskPlaneColor
 Return the colour associated with the specified mask plane name. More...
 
def setMaskTransparency
 Specify display's mask transparency (percent); or None to not set it when loading masks. More...
 
def getMaskTransparency
 Return the current display's mask transparency. More...
 
def show
 Uniconify and Raise display. More...
 
def mtv
 Display an Image or Mask on a DISPLAY display. More...
 
def Buffering
 
def flush
 Flush the buffers. More...
 
def erase
 Erase the specified DISPLAY frame. More...
 
def dot
 Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates]. More...
 
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. More...
 
def scale
 Set the range of the scaling from DN in the image to the image display. More...
 
def zoom
 Zoom frame by specified amount, optionally panning also. More...
 
def pan
 Pan to (rowc, colc); see also zoom. More...
 
def interact
 Enter an interactive loop, listening for key presses in display and firing callbacks. More...
 
def setCallback
 Set the callback for key k to be func, returning the old callback. More...
 
def getActiveCallbackKeys
 Return all callback keys. More...
 

Static Public Member Functions

def setDefaultBackend
 
def getDefaultBackend
 
def setDefaultFrame
 
def getDefaultFrame
 
def incrDefaultFrame
 
def setDefaultMaskTransparency
 
def setDefaultMaskPlaneColor
 Set the default mapping from mask plane names to colours. More...
 
def getDisplay
 Return the Display indexed by frame, creating it if needs be. More...
 
def delAllDisplays
 Delete and close all known display. More...
 

Public Attributes

 frame
 

Private Attributes

 _impl
 
 _xy0
 
 _maskPlaneColors
 
 _callbacks
 

Static Private Attributes

dictionary _displays = {}
 
 _defaultBackend = None
 
int _defaultFrame = 0
 
tuple _defaultMaskPlaneColor
 
dictionary _defaultMaskTransparency = {}
 

Detailed Description

Definition at line 87 of file interface.py.

Constructor & Destructor Documentation

def lsst.afw.display.interface.Display.__init__ (   self,
  frame,
  backend = None,
  args,
  kwargs 
)

Create an object able to display images and overplot glyphs.

Parameters
frameAn identifier for the display
backendThe backend to use (defaults to value set by setDefaultBackend())
argsArguments to pass to the backend
kwargsArguments to pass to the backend

Definition at line 107 of file interface.py.

108  def __init__(self, frame, backend=None, *args, **kwargs):
109  """!Create an object able to display images and overplot glyphs
110 
111  \param frame An identifier for the display
112  \param backend The backend to use (defaults to value set by setDefaultBackend())
113  \param args Arguments to pass to the backend
114  \param kwargs Arguments to pass to the backend
115  """
116  if backend is None:
117  if Display._defaultBackend is None:
118  try:
119  setDefaultBackend("ds9")
120  except RuntimeError:
121  setDefaultBackend("virtualDevice")
122 
123  backend = Display._defaultBackend
125  self.frame = frame
126  self._impl = _makeDisplayImpl(self, backend, *args, **kwargs)
128  self._xy0 = None # the data displayed on the frame's XY0
129  self.setMaskTransparency(Display._defaultMaskTransparency)
130  self._maskPlaneColors = {}
131  self.setMaskPlaneColor(Display._defaultMaskPlaneColor)
133  self._callbacks = {}
134 
135  for ik in range(ord('a'), ord('z') + 1):
136  k = "%c" % ik
137  self.setCallback(k, noRaise=True)
138  self.setCallback(k.upper(), noRaise=True)
139 
140  for k in ('Return', 'Shift_L', 'Shift_R'):
141  self.setCallback(k)
142 
143  for k in ('q', 'Escape'):
144  self.setCallback(k, lambda k, x, y: True)
145 
146  def _h_callback(k, x, y):
147  h_callback(k, x, y)
148 
149  for k in sorted(self._callbacks.keys()):
150  doc = self._callbacks[k].__doc__
151  print " %-6s %s" % (k, doc.split("\n")[0] if doc else "???")
152 
153  self.setCallback('h', _h_callback)
def setMaskTransparency
Specify display's mask transparency (percent); or None to not set it when loading masks...
Definition: interface.py:328
def setMaskPlaneColor
Request that mask plane name be displayed as color.
Definition: interface.py:301
def __init__
Create an object able to display images and overplot glyphs.
Definition: interface.py:107
def _makeDisplayImpl
Return the DisplayImpl for the named backend.
Definition: interface.py:57
def setCallback
Set the callback for key k to be func, returning the old callback.
Definition: interface.py:548
def lsst.afw.display.interface.Display.__del__ (   self)

Definition at line 162 of file interface.py.

163  def __del__(self):
164  self.close()

Member Function Documentation

def lsst.afw.display.interface.Display.__enter__ (   self)

Support for python's with statement.

Definition at line 154 of file interface.py.

155  def __enter__(self):
156  """!Support for python's with statement"""
157  return self
def __enter__
Support for python's with statement.
Definition: interface.py:154
def lsst.afw.display.interface.Display.__exit__ (   self,
  args 
)

Support for python's with statement.

Definition at line 158 of file interface.py.

159  def __exit__(self, *args):
160  """!Support for python's with statement"""
161  self.close()
def __exit__
Support for python's with statement.
Definition: interface.py:158
def lsst.afw.display.interface.Display.__str__ (   self)

Definition at line 183 of file interface.py.

184  def __str__(self):
185  return "Display[%s]" % (self.frame)
def lsst.afw.display.interface.Display.Buffering (   self)
Return a class intended to be used with python's with statement
    E.g.
with display.Buffering():
    display.dot("+", xc, yc)

Definition at line 400 of file interface.py.

401  def Buffering(self):
402  """Return a class intended to be used with python's with statement
403  E.g.
404  with display.Buffering():
405  display.dot("+", xc, yc)
406  """
407  return self._Buffering(self._impl)
def lsst.afw.display.interface.Display.close (   self)

Definition at line 165 of file interface.py.

166  def close(self):
167  if self._impl:
168  del self._impl
169  self._impl = None
170 
171  if self.frame in Display._displays:
172  del Display._displays[self.frame]
def lsst.afw.display.interface.Display.delAllDisplays ( )
static

Delete and close all known display.

Definition at line 273 of file interface.py.

274  def delAllDisplays():
275  """!Delete and close all known display
276  """
277  for disp in Display._displays.values():
278  disp.close()
279  Display._displays = {}
def delAllDisplays
Delete and close all known display.
Definition: interface.py:273
def lsst.afw.display.interface.Display.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].

Possible values are:

N.b. objects derived from BaseCore include Axes and Quadrupole.

Definition at line 417 of file interface.py.

418  def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, *args, **kwargs):
419  """!Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates]
420 
421  Possible values are:
422  + Draw a +
423  x Draw an x
424  * Draw a *
425  o Draw a circle
426  @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
427  An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
428  Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended
429  with other characteristics, e.g. "times bold italic". Text will be drawn rotated by textAngle (textAngle is
430  ignored otherwise).
431 
432  N.b. objects derived from BaseCore include Axes and Quadrupole.
433  """
434  if isinstance(symb, int):
435  symb = "%d" % (symb)
436 
437  if origin == afwImage.PARENT and self._xy0 is not None:
438  x0, y0 = self._xy0
439  r -= x0
440  c -= y0
441 
442  if isinstance(symb, afwGeom.ellipses.BaseCore) or re.search(r"^@:", symb):
443  try:
444  mat = re.search(r"^@:([^,]+),([^,]+),([^,]+)", symb)
445  except TypeError:
446  pass
447  else:
448  if mat:
449  mxx, mxy, myy = [float(_) for _ in mat.groups()]
450  symb = afwGeom.ellipses.Quadrupole(mxx, myy, mxy)
451 
452  symb = afwGeom.ellipses.Axes(symb)
453 
454  self._impl._dot(symb, c, r, size, ctype, **kwargs)
def dot
Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates].
Definition: interface.py:417
def lsst.afw.display.interface.Display.erase (   self)

Erase the specified DISPLAY frame.

Definition at line 412 of file interface.py.

413  def erase(self):
414  """!Erase the specified DISPLAY frame
415  """
416  self._impl._erase()
def erase
Erase the specified DISPLAY frame.
Definition: interface.py:412
def lsst.afw.display.interface.Display.flush (   self)

Flush the buffers.

Definition at line 408 of file interface.py.

409  def flush(self):
410  """!Flush the buffers"""
411  self._impl._flush()
def flush
Flush the buffers.
Definition: interface.py:408
def lsst.afw.display.interface.Display.getActiveCallbackKeys (   self,
  onlyActive = True 
)

Return all callback keys.

Parameters
onlyActiveIf true only return keys that do something

Definition at line 565 of file interface.py.

566  def getActiveCallbackKeys(self, onlyActive=True):
567  """!Return all callback keys
568  \param onlyActive If true only return keys that do something
569  """
570 
571  return sorted([k for k, func in self._callbacks.items() if
572  not (onlyActive and func == noop_callback)])
573 
574 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
575 #
576 # Callbacks for display events
#
def getActiveCallbackKeys
Return all callback keys.
Definition: interface.py:565
def lsst.afw.display.interface.Display.getDefaultBackend ( )
static

Definition at line 199 of file interface.py.

200  def getDefaultBackend():
201  return Display._defaultBackend
def lsst.afw.display.interface.Display.getDefaultFrame ( )
static
Get the default frame for display

Definition at line 208 of file interface.py.

209  def getDefaultFrame():
210  """Get the default frame for display"""
211  return Display._defaultFrame
def lsst.afw.display.interface.Display.getDisplay (   frame = None,
  backend = None,
  create = True,
  verbose = False,
  args,
  kwargs 
)
static

Return the Display indexed by frame, creating it if needs be.

Parameters
frameThe desired frame (None => use defaultFrame (see setDefaultFrame))
backendcreate the specified frame using this backend (or the default if None) \ if it doesn't already exist. If backend == "", it's an error to specify a non-existent frame
createcreate the display if it doesn't already exist.
verboseAllow backend to be chatty
argsarguments passed to Display constructor
kwargskeyword arguments passed to Display constructor

Definition at line 248 of file interface.py.

249  def getDisplay(frame=None, backend=None, create=True, verbose=False, *args, **kwargs):
250  """!Return the Display indexed by frame, creating it if needs be
251 
252  \param frame The desired frame (None => use defaultFrame (see setDefaultFrame))
253  \param backend create the specified frame using this backend (or the default if None) \
254  if it doesn't already exist. If backend == "", it's an error to specify a non-existent frame
255  \param create create the display if it doesn't already exist.
256  \param verbose Allow backend to be chatty
257  \param args arguments passed to Display constructor
258  \param kwargs keyword arguments passed to Display constructor
259  """
260 
261  if frame is None:
262  frame = Display._defaultFrame
263 
264  if not frame in Display._displays:
265  if backend == "":
266  raise RuntimeError("Frame %s does not exist" % frame)
267 
268  Display._displays[frame] = Display(frame, backend, verbose=verbose, *args, **kwargs)
269 
270  Display._displays[frame].verbose = verbose
271  return Display._displays[frame]
def getDisplay
Return the Display indexed by frame, creating it if needs be.
Definition: interface.py:248
def lsst.afw.display.interface.Display.getMaskPlaneColor (   self,
  name 
)

Return the colour associated with the specified mask plane name.

Definition at line 323 of file interface.py.

324  def getMaskPlaneColor(self, name):
325  """!Return the colour associated with the specified mask plane name"""
326 
327  return self._maskPlaneColors.get(name)
def getMaskPlaneColor
Return the colour associated with the specified mask plane name.
Definition: interface.py:323
def lsst.afw.display.interface.Display.getMaskTransparency (   self,
  name = None 
)

Return the current display's mask transparency.

Definition at line 347 of file interface.py.

348  def getMaskTransparency(self, name=None):
349  """!Return the current display's mask transparency"""
350 
351  self._impl._getMaskTransparency(name)
def getMaskTransparency
Return the current display's mask transparency.
Definition: interface.py:347
def lsst.afw.display.interface.Display.incrDefaultFrame ( )
static
Increment the default frame for display

Definition at line 213 of file interface.py.

214  def incrDefaultFrame():
215  """Increment the default frame for display"""
216  Display._defaultFrame += 1
217  return Display._defaultFrame
def lsst.afw.display.interface.Display.interact (   self)

Enter an interactive loop, listening for key presses in display and firing callbacks.

Exit with q, CR, or ESC

Definition at line 527 of file interface.py.

528  def interact(self):
529  """!Enter an interactive loop, listening for key presses in display and firing callbacks.
530 
531  Exit with q, \c CR, or \c ESC
532  """
533 
534  while True:
535  ev = self._impl._getEvent()
536  if not ev:
537  continue
538  k, x, y = ev.k, ev.x, ev.y # for now
539 
540  try:
541  if self.callbacks[k](k, x, y):
542  break
543  except KeyError:
544  print >> sys.stderr, "No callback is registered for %s" % k
545  except Exception, e:
546  print >> sys.stderr, "Display.callbacks[%s](%s, %s, %s) failed: %s" % \
547  (k, k, x, y, e)
def interact
Enter an interactive loop, listening for key presses in display and firing callbacks.
Definition: interface.py:527
def lsst.afw.display.interface.Display.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.

Ctype is the name of a colour (e.g. 'red')

If symbs supports indexing (which includes a string – caveat emptor) the elements are used to label the points

Definition at line 455 of file interface.py.

456  def line(self, points, origin=afwImage.PARENT, symbs=False, ctype=None, size=0.5):
457  """!Draw a set of symbols or connect the points, a list of (col,row)
458  If symbs is True, draw points at the specified points using the desired symbol,
459  otherwise connect the dots. Ctype is the name of a colour (e.g. 'red')
460 
461  If symbs supports indexing (which includes a string -- caveat emptor) the elements are used to label the points
462  """
463  if symbs:
464  try:
465  symbs[1]
466  except:
467  symbs = len(points)*list(symbs)
468 
469  for i, xy in enumerate(points):
470  self.dot(symbs[i], *xy, size=size, ctype=ctype)
471  else:
472  if len(points) > 0:
473  if origin == afwImage.PARENT and self._xy0 is not None:
474  x0, y0 = self._xy0
475  _points = list(points) # make a mutable copy
476  for i, p in enumerate(points):
477  _points[i] = (p[0] - x0, p[1] - y0)
478  points = _points
479 
self._impl._drawLines(points, ctype)
def dot
Draw a symbol onto the specified DISPLAY frame at (col,row) = (c,r) [0-based coordinates].
Definition: interface.py:417
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:455
def lsst.afw.display.interface.Display.maskColorGenerator (   self,
  omitBW = True 
)

A generator for "standard" colours.

Parameters
omitBWDon't include Black and White

e.g. colorGenerator = interface.maskColorGenerator(omitBW=True) for p in planeList: print p, next(colorGenerator)

Definition at line 280 of file interface.py.

281  def maskColorGenerator(self, omitBW=True):
282  """!A generator for "standard" colours
283 
284  \param omitBW Don't include Black and White
285 
286  e.g.
287  colorGenerator = interface.maskColorGenerator(omitBW=True)
288  for p in planeList:
289  print p, next(colorGenerator)
290  """
291  _maskColors = [WHITE, BLACK, RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, ORANGE]
292 
293  i = -1
294  while True:
295  i += 1
296  color = _maskColors[i%len(_maskColors)]
297  if omitBW and color in (BLACK, WHITE):
298  continue
299 
300  yield color
def maskColorGenerator
A generator for "standard" colours.
Definition: interface.py:280
def lsst.afw.display.interface.Display.mtv (   self,
  data,
  title = "",
  wcs = None 
)

Display an Image or Mask on a DISPLAY display.

Historical note: the name "mtv" comes from Jim Gunn's forth imageprocessing system, Mirella (named after Mirella Freni); The "m" stands for Mirella.

Definition at line 356 of file interface.py.

357  def mtv(self, data, title="", wcs=None):
358  """!Display an Image or Mask on a DISPLAY display
359 
360  Historical note: the name "mtv" comes from Jim Gunn's forth imageprocessing
361  system, Mirella (named after Mirella Freni); The "m" stands for Mirella.
362  """
363  if hasattr(data, "getXY0"):
364  self._xy0 = data.getXY0()
365  else:
366  self._xy0 = None
367 
368  if re.search("::Exposure<", repr(data)): # it's an Exposure; display the MaskedImage with the WCS
369  if wcs:
370  raise RuntimeError, "You may not specify a wcs with an Exposure"
371  data, wcs = data.getMaskedImage(), data.getWcs()
372  elif re.search("::DecoratedImage<", repr(data)): # it's a DecoratedImage; display it
373  data, wcs = data.getImage(), afwImage.makeWcs(data.getMetadata())
374  self._xy0 = data.getXY0() # DecoratedImage doesn't have getXY0()
375 
376  if re.search("::Image<", repr(data)): # it's an Image; display it
377  self._impl._mtv(data, None, wcs, title)
378  elif re.search("::Mask<", repr(data)): # it's a Mask; display it, bitplane by bitplane
379  #
380  # Some displays can't display a Mask without an image; so display an Image too,
381  # with pixel values set to the mask
382  #
383  self._impl._mtv(afwImage.ImageU(data.getArray()), data, wcs, title)
384  elif re.search("::MaskedImage<", repr(data)): # it's a MaskedImage; display Image and overlay Mask
385  self._impl._mtv(data.getImage(), data.getMask(True), wcs, title)
386  else:
raise RuntimeError, "Unsupported type %s" % repr(data)
def mtv
Display an Image or Mask on a DISPLAY display.
Definition: interface.py:356
Wcs::Ptr 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:141
def lsst.afw.display.interface.Display.pan (   self,
  colc = None,
  rowc = None,
  origin = afwImage.PARENT 
)

Pan to (rowc, colc); see also zoom.

Definition at line 522 of file interface.py.

523  def pan(self, colc=None, rowc=None, origin=afwImage.PARENT):
524  """!Pan to (rowc, colc); see also zoom"""
525 
526  self.zoom(None, colc, rowc, origin)
def zoom
Zoom frame by specified amount, optionally panning also.
Definition: interface.py:502
def pan
Pan to (rowc, colc); see also zoom.
Definition: interface.py:522
def lsst.afw.display.interface.Display.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.

Parameters
algorithmDesired scaling (e.g. "linear" or "asinh")
minMinimum value, or "minmax" or "zscale"
maxMaximum value (must be None for minmax|zscale)
unitUnits for min and max (e.g. Percent, Absolute, Sigma; None if min==minmax|zscale)
*argsOptional arguments
**kwargsOptional keyword arguments

Definition at line 483 of file interface.py.

484  def scale(self, algorithm, min, max=None, unit=None, *args, **kwargs):
485  """!Set the range of the scaling from DN in the image to the image display
486  \param algorithm Desired scaling (e.g. "linear" or "asinh")
487  \param min Minimum value, or "minmax" or "zscale"
488  \param max Maximum value (must be None for minmax|zscale)
489  \param unit Units for min and max (e.g. Percent, Absolute, Sigma; None if min==minmax|zscale)
490  \param *args Optional arguments
491  \param **kwargs Optional keyword arguments
492  """
493  if min in ("minmax", "zscale"):
494  assert max == None, "You may not specify \"%s\" and max" % min
495  assert unit == None, "You may not specify \"%s\" and unit" % min
496  elif max is None:
497  raise RuntimeError("Please specify max")
498 
self._impl._scale(algorithm, min, max, unit, *args, **kwargs)
def scale
Set the range of the scaling from DN in the image to the image display.
Definition: interface.py:483
def lsst.afw.display.interface.Display.setCallback (   self,
  k,
  func = None,
  noRaise = False 
)

Set the callback for key k to be func, returning the old callback.

Definition at line 548 of file interface.py.

549  def setCallback(self, k, func=None, noRaise=False):
550  """!Set the callback for key k to be func, returning the old callback
551  """
552 
553  if k in "f":
554  if noRaise:
555  return
556  raise RuntimeError(
557  "Key '%s' is already in use by display, so I can't add a callback for it" % k)
558 
559  ofunc = self._callbacks.get(k)
560  self._callbacks[k] = func if func else noop_callback
561 
562  self._impl._setCallback(k, self._callbacks[k])
563 
564  return ofunc
def setCallback
Set the callback for key k to be func, returning the old callback.
Definition: interface.py:548
def lsst.afw.display.interface.Display.setDefaultBackend (   backend)
static

Definition at line 190 of file interface.py.

191  def setDefaultBackend(backend):
192  try:
193  _makeDisplayImpl(None, backend)
194  except Exception as e:
195  raise RuntimeError("Unable to set backend to %s: \"%s\"" % (backend, e))
196 
197  Display._defaultBackend = backend
def _makeDisplayImpl
Return the DisplayImpl for the named backend.
Definition: interface.py:57
def lsst.afw.display.interface.Display.setDefaultFrame (   frame = 0)
static
Set the default frame for display

Definition at line 203 of file interface.py.

204  def setDefaultFrame(frame=0):
205  """Set the default frame for display"""
206  Display._defaultFrame = frame
def lsst.afw.display.interface.Display.setDefaultMaskPlaneColor (   name = None,
  color = None 
)
static

Set the default mapping from mask plane names to colours.

Parameters
namename of mask plane, or a dict mapping names to colours
colorDesired color, or None if name is a dict

If name is None, use the hard-coded default dictionary

Definition at line 226 of file interface.py.

227  def setDefaultMaskPlaneColor(name=None, color=None):
228  """!Set the default mapping from mask plane names to colours
229  \param name name of mask plane, or a dict mapping names to colours
230  \param color Desired color, or None if name is a dict
231 
232  If name is None, use the hard-coded default dictionary
233  """
234 
235  if name is None:
236  name = Display._defaultMaskPlaneColor
237 
238  if isinstance(name, dict):
239  assert color == None
240  for k, v in name.items():
242  return
243  #
244  # Set the individual colour values
245  #
246  Display._defaultMaskPlaneColor[name] = color
def setDefaultMaskPlaneColor
Set the default mapping from mask plane names to colours.
Definition: interface.py:226
def lsst.afw.display.interface.Display.setDefaultMaskTransparency (   maskPlaneTransparency = {})
static

Definition at line 219 of file interface.py.

220  def setDefaultMaskTransparency(maskPlaneTransparency={}):
221  if hasattr(maskPlaneTransparency, "copy"):
222  maskPlaneTransparency = maskPlaneTransparency.copy()
223 
224  Display._defaultMaskTransparency = maskPlaneTransparency
def lsst.afw.display.interface.Display.setMaskPlaneColor (   self,
  name,
  color = None 
)

Request that mask plane name be displayed as color.

Parameters
nameName of mask plane or a dictionary of name -> colourName
colorThe name of the colour to use (must be None if name is a dict)

Colours may be specified as any X11-compliant string (e.g. "orchid"), or by one of the following constants defined in afwDisplay: BLACK, WHITE, RED, BLUE, GREEN, CYAN, MAGENTA, YELLOW.

The advantage of using the symbolic names is that the python interpreter can detect typos.

Definition at line 301 of file interface.py.

302  def setMaskPlaneColor(self, name, color=None):
303  """!Request that mask plane name be displayed as color
304 
305  \param name Name of mask plane or a dictionary of name -> colourName
306  \param color The name of the colour to use (must be None if name is a dict)
307 
308  Colours may be specified as any X11-compliant string (e.g. <tt>"orchid"</tt>), or by one
309  of the following constants defined in \c afwDisplay: \c BLACK, \c WHITE, \c RED, \c BLUE,
310  \c GREEN, \c CYAN, \c MAGENTA, \c YELLOW.
311 
312  The advantage of using the symbolic names is that the python interpreter can detect typos.
313 
314  """
315 
316  if isinstance(name, dict):
317  assert color == None
318  for k, v in name.items():
319  self.setMaskPlaneColor(k, v)
320  return
321 
322  self._maskPlaneColors[name] = color
def setMaskPlaneColor
Request that mask plane name be displayed as color.
Definition: interface.py:301
def lsst.afw.display.interface.Display.setMaskTransparency (   self,
  transparency = None,
  name = None 
)

Specify display's mask transparency (percent); or None to not set it when loading masks.

Definition at line 328 of file interface.py.

329  def setMaskTransparency(self, transparency=None, name=None):
330  """!Specify display's mask transparency (percent); or None to not set it when loading masks"""
331 
332  if isinstance(transparency, dict):
333  assert name == None
334  for k, v in transparency.items():
335  self.setMaskTransparency(k, v)
336  return
337 
338  if transparency is not None and (transparency < 0 or transparency > 100):
339  print >> sys.stderr, "Mask transparency should be in the range [0, 100]; clipping"
340  if transparency < 0:
341  transparency = 0
342  else:
343  transparency = 100
344 
345  if transparency is not None:
346  self._impl._setMaskTransparency(transparency, name)
def setMaskTransparency
Specify display&#39;s mask transparency (percent); or None to not set it when loading masks...
Definition: interface.py:328
def lsst.afw.display.interface.Display.show (   self)

Uniconify and Raise display.

N.b. throws an exception if frame doesn't exit

Definition at line 352 of file interface.py.

353  def show(self):
354  """!Uniconify and Raise display. N.b. throws an exception if frame doesn't exit"""
355  self._impl._show()
def show
Uniconify and Raise display.
Definition: interface.py:352
def lsst.afw.display.interface.Display.verbose (   self)

The backend's verbosity.

Definition at line 174 of file interface.py.

175  def verbose(self):
176  """!The backend's verbosity"""
177  return self._impl.verbose
def verbose
The backend&#39;s verbosity.
Definition: interface.py:174
def lsst.afw.display.interface.Display.verbose (   self,
  value 
)

Definition at line 179 of file interface.py.

180  def verbose(self, value):
181  if self._impl:
182  self._impl.verbose = value
def verbose
The backend&#39;s verbosity.
Definition: interface.py:174
def lsst.afw.display.interface.Display.zoom (   self,
  zoomfac = None,
  colc = None,
  rowc = None,
  origin = afwImage.PARENT 
)

Zoom frame by specified amount, optionally panning also.

Definition at line 502 of file interface.py.

503  def zoom(self, zoomfac=None, colc=None, rowc=None, origin=afwImage.PARENT):
504  """!Zoom frame by specified amount, optionally panning also"""
505 
506  if (rowc and colc is None) or (colc and rowc is None):
507  raise RuntimeError, "Please specify row and column center to pan about"
508 
509  if rowc is not None:
510  if origin == afwImage.PARENT and self._xy0 is not None:
511  x0, y0 = self._xy0
512  rowc -= x0
513  colc -= y0
514 
515  self._impl._pan(colc, rowc)
516 
517  if zoomfac == None and rowc == None:
518  zoomfac = 2
519 
520  if zoomfac is not None:
521  self._impl._zoom(zoomfac)
def zoom
Zoom frame by specified amount, optionally panning also.
Definition: interface.py:502

Member Data Documentation

lsst.afw.display.interface.Display._callbacks
private

Definition at line 132 of file interface.py.

lsst.afw.display.interface.Display._defaultBackend = None
staticprivate

Definition at line 89 of file interface.py.

int lsst.afw.display.interface.Display._defaultFrame = 0
staticprivate

Definition at line 90 of file interface.py.

tuple lsst.afw.display.interface.Display._defaultMaskPlaneColor
staticprivate
Initial value:
1 = dict(
2  BAD=RED,
3  CR=MAGENTA,
4  EDGE=YELLOW,
5  INTERPOLATED=GREEN,
6  SATURATED=GREEN,
7  DETECTED=BLUE,
8  DETECTED_NEGATIVE=CYAN,
9  SUSPECT=YELLOW,
10  NO_DATA=ORANGE,
11  # deprecated names
12  INTRP=GREEN,
13  SAT=GREEN,
14  )

Definition at line 91 of file interface.py.

dictionary lsst.afw.display.interface.Display._defaultMaskTransparency = {}
staticprivate

Definition at line 105 of file interface.py.

dictionary lsst.afw.display.interface.Display._displays = {}
staticprivate

Definition at line 88 of file interface.py.

lsst.afw.display.interface.Display._impl
private

Definition at line 125 of file interface.py.

lsst.afw.display.interface.Display._maskPlaneColors
private

Definition at line 129 of file interface.py.

lsst.afw.display.interface.Display._xy0
private

Definition at line 127 of file interface.py.

lsst.afw.display.interface.Display.frame

Definition at line 124 of file interface.py.


The documentation for this class was generated from the following file: