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
ds9.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 ##
24 ## \file
25 ## \brief Support for talking to ds9 from python
26 ## \deprecated New code should use lsst.afw.display and set the backend to ds9
27 
28 from __future__ import absolute_import, division, print_function
29 
30 import lsst.afw.display
31 import lsst.afw.image as afwImage
32 from .interface import getDisplay as _getDisplay, getDefaultBackend, setDefaultBackend, \
33  setDefaultFrame, getDefaultFrame, incrDefaultFrame
34 try:
35  loaded
36 except NameError:
37  try:
38  setDefaultBackend("lsst.display.ds9")
39  getDisplay = _getDisplay
40  except Exception as e:
41  # No usable version of display_ds9.
42  # Let's define a version of getDisplay() which will throw an exception.
43  e.args = ["%s (is display_ds9 setup?)" % e]
44 
45  def getDisplay(*args, **kwargs):
46  raise e
47 
48  loaded = False
49  else:
50  loaded = True
51 
52 #
53 # Backwards compatibility. Downstream code should be converted to use display.RED etc.
54 #
55 from lsst.afw.display import BLACK, RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, WHITE
56 
57 def Buffering():
58  return _getDisplay(None, create=True).Buffering() # always use the real one
59 
60 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
61 #
62 # Functions provided for backwards compatibility
63 #
64 def setMaskPlaneColor(name, color=None, frame=None):
65  return getDisplay(frame, create=True).setMaskPlaneColor(name, color)
66 
67 def getMaskPlaneColor(name, frame=None):
68  return getDisplay(frame, create=True).getMaskPlaneColor(name)
69 
70 def setMaskTransparency(name, frame=None):
71  return getDisplay(frame, create=True).setMaskTransparency(name)
72 
73 def getMaskTransparency(name, frame=None):
74  return getDisplay(frame, create=True).getMaskTransparency(name)
75 
76 def show(frame=None):
77  return getDisplay(frame, create=True).show()
78 
79 def mtv(data, frame=None, title="", wcs=None, *args, **kwargs):
80  return getDisplay(frame, create=True).mtv(data, title, wcs, *args, **kwargs)
81 
82 def erase(frame=None):
83  return getDisplay(frame, create=True).erase()
84 
85 def dot(symb, c, r, frame=None, size=2, ctype=None, origin=afwImage.PARENT, *args, **kwargs):
86  return getDisplay(frame, create=True).dot(symb, c, r, size, ctype, origin, *args, **kwargs)
87 
88 def line(points, frame=None, origin=afwImage.PARENT, symbs=False, ctype=None, size=0.5):
89  return getDisplay(frame, create=True).line(points, origin, symbs, ctype, size)
90 
91 def scale(algorithm, min, max=None, frame=None):
92  return getDisplay(frame, create=True).scale(algorithm, min, max)
93 
94 def pan(colc=None, rowc=None, frame=None, origin=afwImage.PARENT):
95  disp = getDisplay(frame, create=True)
96 
97  disp.pan(colc, rowc, origin)
98 
99 def zoom(zoomfac=None, colc=None, rowc=None, frame=None, origin=afwImage.PARENT):
100  disp = getDisplay(frame, create=True)
101 
102  disp.zoom(zoomfac)
103  disp.pan(colc, rowc, origin)
104 
105 def interact(frame=None):
106  return getDisplay(frame, create=True).interact()
107 
108 def setCallback(k, func=lsst.afw.display.noop_callback, noRaise=False, frame=None):
109  return getDisplay(frame, create=True).setCallback(k, noRaise=False)
110 
111 def getActiveCallbackKeys(onlyActive=True, frame=None):
112  return getDisplay(frame, create=True).getActiveCallbackKeys(onlyActive)
def getActiveCallbackKeys
Definition: ds9.py:111
def setMaskPlaneColor
Definition: ds9.py:64
def getMaskPlaneColor
Definition: ds9.py:67
def getMaskTransparency
Definition: ds9.py:73
def setMaskTransparency
Definition: ds9.py:70