Details
-
Type:
Story
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: display_matplotlib
-
Labels:None
-
Story Points:1
-
Epic Link:
-
Sprint:DRP F18-2
-
Team:Alert Production
Description
From https://github.com/lsst/display_matplotlib/issues/2:
I've tried to plot source catalog objects as ellipses using the display.dot function and passing source.getShape as the first argument:
#Display the cutout and sources with afw display
image = cutout.image
#image = calexp.image
plt.figure()
afw_display = afwDisplay.Display()
afw_display.scale('asinh', 'zscale')
afw_display.mtv(image)
plt.gca().axis('off')
# We use display buffering to avoid re-drawing the image after each source is plotted
with afw_display.Buffering():
for s in sources:
afw_display.dot('+', s.getX(), s.getY(), ctype=afwDisplay.RED)
afw_display.dot('o', s.getX(), s.getY(), size=20, ctype='orange')
#ADW: This should work, but doesn't?
afw_display.dot(s.getShape(), s.getX(), s.getY(), size=35, ctype='orange')
# Our "ultra-faint galaxy" (e.g. smudge)
afw_display.dot('o', x_target, y_target, size=35, ctype='cyan')
However I get the following error:
/opt/lsst/software/stack/stack/miniconda3-4.5.4-10a4fa6/Linux64/afw/16.0-19-g2da375352/python/lsst/afw/display/interface.py in dot(self, symb, c, r, size, ctype, origin, *args, **kwargs)
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):
/opt/lsst/software/stack/stack/miniconda3-4.5.4-10a4fa6/Linux64/display_matplotlib/16.0+11/python/lsst/display/matplotlib/matplotlib.py in _dot(self, symb, c, r, size, ctype, fontFamily, textAngle)
371
372 axis.add_artist(Ellipse((c + x0, r + y0), xradius=symb.getA(), yradius=symb.getB(),
--> 373 rot_deg=math.degrees(symb.getTheta()), color=ctype))
374 elif symb == 'o':
375 from matplotlib.patches import CirclePolygon as Circle
TypeError: __init__() missing 2 required positional arguments: 'width' and 'height'
I've confirmed that matplotlib.patches.Ellipse does expect the width and height arguments (at least in recent versions).