LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Functions
lsst.afw.display.ds9Regions Namespace Reference

Functions

def dot
 
def drawLines
 Draw a line by connecting the points. More...
 

Function Documentation

def lsst.afw.display.ds9Regions.dot (   symb,
  c,
  r,
  size,
  ctype = None,
  fontFamily = "helvetica",
  textAngle = None 
)
Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates]
Possible values are:
    +                Draw a +
    x                Draw an x
    *                Draw a *
    o                Draw a circle
    @:Mxx,Mxy,Myy    Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
    An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended
with other characteristics, e.g. "times bold italic".  Text will be drawn rotated by textAngle (textAngle is
ignored otherwise).

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

Definition at line 33 of file ds9Regions.py.

33 
34 def dot(symb, c, r, size, ctype=None, fontFamily="helvetica", textAngle=None):
35  """Draw a symbol onto the specified DS9 frame at (col,row) = (c,r) [0-based coordinates]
36 Possible values are:
37  + Draw a +
38  x Draw an x
39  * Draw a *
40  o Draw a circle
41  @:Mxx,Mxy,Myy Draw an ellipse with moments (Mxx, Mxy, Myy) (argument size is ignored)
42  An object derived from afwGeom.ellipses.BaseCore Draw the ellipse (argument size is ignored)
43 Any other value is interpreted as a string to be drawn. Strings obey the fontFamily (which may be extended
44 with other characteristics, e.g. "times bold italic". Text will be drawn rotated by textAngle (textAngle is
45 ignored otherwise).
46 
47 N.b. objects derived from BaseCore include Axes and Quadrupole.
48 """
49  if ctype == None:
50  color = "" # the default
51  else:
52  color = ' # color=%s' % ctype
53 
54  regions = []
55 
56  r += 1
57  c += 1 # ds9 uses 1-based coordinates
58  if isinstance(symb, afwGeom.ellipses.Axes):
59  regions.append('ellipse %g %g %gi %gi %g%s' % (c, r, symb.getA(), symb.getB(),
60  math.degrees(symb.getTheta()), color))
61  elif symb == '+':
62  regions.append('line %g %g %g %g%s' % (c, r+size, c, r-size, color))
63  regions.append('line %g %g %g %g%s' % (c-size, r, c+size, r, color))
64  elif symb == 'x':
65  size = size/math.sqrt(2)
66  regions.append('line %g %g %g %g%s' % (c+size, r+size, c-size, r-size, color))
67  regions.append('line %g %g %g %g%s' % (c-size, r+size, c+size, r-size, color))
68  elif symb == '*':
69  size30 = 0.5*size
70  size60 = 0.5*math.sqrt(3)*size
71  regions.append('line %g %g %g %g%s' % (c+size, r, c-size, r, color))
72  regions.append('line %g %g %g %g%s' % (c-size30, r+size60, c+size30, r-size60, color))
73  regions.append('line %g %g %g %g%s' % (c+size30, r+size60, c-size30, r-size60, color))
74  elif symb == 'o':
75  regions.append('circle %g %g %gi%s' % (c, r, size, color))
76  else:
77  color = re.sub("^ # ", "", color) # skip the leading " # "
78 
79  angle = ""
80  if textAngle is not None:
81  angle += " textangle=%.1f"%(textAngle)
82 
83  font = ""
84  if size != 2 or fontFamily != "helvetica":
85  fontFamily = fontFamily.split()
86  font += ' font="%s %d' % (fontFamily.pop(0), int(10*size/2.0 + 0.5))
87  if not fontFamily:
88  fontFamily = ["normal"] # appears to be needed at least for 7.4b1
89  font += " %s" % " ".join(fontFamily)
90  font += '"'
91  extra = ""
92  if color or angle or font:
93  extra = " # "
94  extra += color
95  extra += angle
96  extra += font
97 
98  regions.append('text %g %g \"%s\"%s' % (c, r, symb, extra))
99 
100  return regions
def lsst.afw.display.ds9Regions.drawLines (   points,
  ctype = None 
)

Draw a line by connecting the points.

Parameters
pointsa list of (col,row)
ctypethe name of the desired colour (e.g. 'red', 'orchid')

Definition at line 101 of file ds9Regions.py.

102 def drawLines(points, ctype=None):
103  """!Draw a line by connecting the points
104  \param points a list of (col,row)
105  \param ctype the name of the desired colour (e.g. 'red', 'orchid')
106  """
107 
108  if ctype == None: # default
109  color = ""
110  else:
111  color = "# color=%s" % ctype
112 
113  regions = []
114  if len(points) > 0:
115  c0, r0 = points[0]
116  r0 += 1
117  c0 += 1 # ds9 uses 1-based coordinates
118  for (c, r) in points[1:]:
119  r += 1
120  c += 1 # ds9 uses 1-based coordinates
121  regions.append('line %g %g %g %g %s' % (c0, r0, c, r, color))
122  c0, r0 = c, r
123 
124  return regions
125 
def drawLines
Draw a line by connecting the points.
Definition: ds9Regions.py:101