LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+bd2ed33bd6,g1470d8bcf6+c6d6eb38e2,g14a832a312+9d12ad093c,g2079a07aa2+86d27d4dc4,g2305ad1205+91a32aca49,g295015adf3+88246b6574,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+c34e8be1fa,g487adcacf7+85dcfbcc36,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ea1711114f,g5a732f18d5+53520f316c,g64a986408d+bd2ed33bd6,g858d7b2824+bd2ed33bd6,g8a8a8dda67+585e252eca,g99cad8db69+016a06b37a,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+b6d7b42999,gc120e1dc64+f745648b3a,gc28159a63d+0e5473021a,gcf0d15dbbd+c34e8be1fa,gdaeeff99f8+f9a426f77a,ge6526c86ff+508d0e0a30,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+8d59551888,gf1cff7945b+bd2ed33bd6,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lsst.afw.geom.ellipses.EllipseMatplotlibInterface Class Reference

Public Member Functions

 __init__ (self, ellipse, scale=1.0, **kwds)
 
 __getattr__ (self, name)
 
 update (self, show=True, rescale=True)
 

Public Attributes

 scale
 
 patch
 

Detailed Description

An interface for drawing the ellipse using matplotlib.

This is typically initiated by calling Ellipse.plot(), which
returns an instance of this class.

Definition at line 42 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.afw.geom.ellipses.EllipseMatplotlibInterface.__init__ ( self,
ellipse,
scale = 1.0,
** kwds )

Definition at line 49 of file __init__.py.

49 def __init__(self, ellipse, scale=1.0, **kwds):
50 import matplotlib.patches
51 import weakref
52 import numpy as np
53 self.__ellipse = weakref.proxy(ellipse)
54 self.scale = float(scale)
55 core = Axes(self.__ellipse.getCore())
56 core.scale(2.0 * scale)
57 self.patch = matplotlib.patches.Ellipse(
58 (self.__ellipse.getCenter().getX(), self.__ellipse.getCenter().getY()),
59 core.getA(), core.getB(), core.getTheta() * 180.0 / np.pi,
60 **kwds
61 )
62

Member Function Documentation

◆ __getattr__()

lsst.afw.geom.ellipses.EllipseMatplotlibInterface.__getattr__ ( self,
name )

Definition at line 63 of file __init__.py.

63 def __getattr__(self, name):
64 return getattr(self.patch, name)
65

◆ update()

lsst.afw.geom.ellipses.EllipseMatplotlibInterface.update ( self,
show = True,
rescale = True )
Update the matplotlib representation to the current ellipse parameters.

Definition at line 66 of file __init__.py.

66 def update(self, show=True, rescale=True):
67 """Update the matplotlib representation to the current ellipse parameters.
68 """
69 import matplotlib.patches
70 import numpy as np
71 core = _agl.Axes(self.__ellipse.getCore())
72 core.scale(2.0 * scale)
73 new_patch = matplotlib.patches.Ellipse(
74 (self.__ellipse.getCenter().getX(), self.__ellipse.getCenter().getY()),
75 core.a, core.b, core.theta * 180.0 / np.pi
76 )
77 new_patch.update_from(self.patch)
78 axes = self.patch.get_axes()
79 if axes is not None:
80 self.patch.remove()
81 axes.add_patch(new_patch)
82 self.patch = new_patch
83 if axes is not None:
84 if rescale:
85 axes.autoscale_view()
86 if show:
87 axes.figure.canvas.draw()
88
89

Member Data Documentation

◆ patch

lsst.afw.geom.ellipses.EllipseMatplotlibInterface.patch

Definition at line 57 of file __init__.py.

◆ scale

lsst.afw.geom.ellipses.EllipseMatplotlibInterface.scale

Definition at line 54 of file __init__.py.


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