23 """lsst.afw.geom.ellipses 25 from .ellipsesLib
import *
28 (Distortion, DeterminantRadius): SeparableDistortionDeterminantRadius,
29 (Distortion, TraceRadius): SeparableDistortionTraceRadius,
30 (Distortion, LogDeterminantRadius): SeparableDistortionLogDeterminantRadius,
31 (Distortion, LogTraceRadius): SeparableDistortionLogTraceRadius,
32 (ConformalShear, DeterminantRadius): SeparableConformalShearDeterminantRadius,
33 (ConformalShear, TraceRadius): SeparableConformalShearTraceRadius,
34 (ConformalShear, LogDeterminantRadius): SeparableConformalShearLogDeterminantRadius,
35 (ConformalShear, LogTraceRadius): SeparableConformalShearLogTraceRadius
40 """An interface for drawing the ellipse using matplotlib. 42 This is typically initiated by calling Ellipse.plot(), which 43 adds the interface as the matplotlib attribute of the ellipse 44 object (this can be deleted later if desired). 47 def __init__(self, ellipse, scale=1.0, **kwds):
48 import matplotlib.patches
52 core.scale(2.0 * scale)
53 self.
patch = matplotlib.patches.Ellipse(
55 core.getA(), core.getB(), core.getTheta() * 180.0 / numpy.pi,
60 return getattr(self.
patch, name)
62 def update(self, show=True, rescale=True):
63 """Update the matplotlib representation to the current ellipse parameters. 65 import matplotlib.patches
66 core = _agl.Axes(self.
__ellipse.getCore())
67 core.scale(2.0 * scale)
68 new_patch = matplotlib.patches.Ellipse(
70 core.a, core.b, core.theta * 180.0 / numpy.pi
72 new_patch.update_from(self.
patch)
73 axes = self.
patch.get_axes()
76 axes.add_patch(new_patch)
77 self.
patch = new_patch
82 axes.figure.canvas.draw()
85 def Ellipse_plot(self, axes=None, scale=1.0, show=True, rescale=True, **kwds):
86 """Plot the ellipse in matplotlib, adding a MatplotlibInterface 87 object as the 'matplotlib' attribute of the ellipse. 89 Aside from those below, keyword arguments for the 90 matplotlib.patches.Patch constructor are also accepted 91 ('facecolor', 'linestyle', etc.) 94 axes -------- A matplotlib.axes.Axes object, or None to use 95 matplotlib.pyplot.gca(). 96 scale ------- Scale the displayed ellipse by this factor. 97 show -------- If True, update the figure automatically. Set 98 to False for batch processing. 99 rescale ----- If True, rescale the axes. 101 import matplotlib.pyplot
102 self.matplotlib = self.MatplotlibInterface(self, scale, **kwds)
104 axes = matplotlib.pyplot.gca()
105 axes.add_patch(self.matplotlib.patch)
107 axes.autoscale_view()
109 axes.figure.canvas.draw()
110 return self.matplotlib.patch
def Ellipse_plot(self, axes=None, scale=1.0, show=True, rescale=True, kwds)
def __getattr__(self, name)
An ellipse core for the semimajor/semiminor axis and position angle parametrization (a...
def __init__(self, ellipse, scale=1.0, kwds)
def update(self, show=True, rescale=True)