LSST Applications  21.0.0+c4f5df5339,21.0.0+e70536a077,21.0.0-1-ga51b5d4+7c60f8a6ea,21.0.0-10-g560fb7b+411cd868f8,21.0.0-10-gcf60f90+8c49d86aa0,21.0.0-13-gc485e61d+38156233bf,21.0.0-16-g7a993c7b9+1041c3824f,21.0.0-2-g103fe59+d9ceee3e5a,21.0.0-2-g1367e85+0b2f7db15a,21.0.0-2-g45278ab+e70536a077,21.0.0-2-g5242d73+0b2f7db15a,21.0.0-2-g7f82c8f+feb9862f5e,21.0.0-2-g8f08a60+9c9a9cfcc8,21.0.0-2-ga326454+feb9862f5e,21.0.0-2-gde069b7+bedfc5e1fb,21.0.0-2-gecfae73+417509110f,21.0.0-2-gfc62afb+0b2f7db15a,21.0.0-3-g21c7a62+a91f7c0b59,21.0.0-3-g357aad2+062581ff1a,21.0.0-3-g4be5c26+0b2f7db15a,21.0.0-3-g65f322c+85aa0ead76,21.0.0-3-g7d9da8d+c4f5df5339,21.0.0-3-gaa929c8+411cd868f8,21.0.0-3-gc44e71e+fd4029fd48,21.0.0-3-ge02ed75+5d9b90b8aa,21.0.0-38-g070523fc+44fda2b515,21.0.0-4-g591bb35+5d9b90b8aa,21.0.0-4-g88306b8+3cdc83ea97,21.0.0-4-gc004bbf+d52368b591,21.0.0-4-gccdca77+a5c54364a0,21.0.0-5-g7ebb681+81e2098694,21.0.0-5-gdf36809+87b8d260e6,21.0.0-6-g2d4f3f3+e70536a077,21.0.0-6-g4e60332+5d9b90b8aa,21.0.0-6-g5ef7dad+3f4e29eeae,21.0.0-7-gc8ca178+0f5e56d48f,21.0.0-9-g9eb8d17+cc2c7a81aa,master-gac4afde19b+5d9b90b8aa,w.2021.07
LSST Data Management Base Package
Public Member Functions | List of all members
lsst.afw.geom.polygon.polygonContinued.Polygon Class Reference

Public Member Functions

def __repr__ (self)
 
def __reduce__ (self)
 
def __iter__ (self)
 
def __getitem__ (self, i)
 
def __len__ (self)
 
def __contains__ (self, point)
 
def display (self, xy0=None, frame=1, ctype=None)
 
def plot (self, axes=None, **kwargs)
 

Detailed Description

Definition at line 29 of file polygonContinued.py.

Member Function Documentation

◆ __contains__()

def lsst.afw.geom.polygon.polygonContinued.Polygon.__contains__ (   self,
  point 
)
point in polygon?

Definition at line 47 of file polygonContinued.py.

47  def __contains__(self, point):
48  """point in polygon?"""
49  return self.contains(point)
50 

◆ __getitem__()

def lsst.afw.geom.polygon.polygonContinued.Polygon.__getitem__ (   self,
  i 
)

Definition at line 41 of file polygonContinued.py.

41  def __getitem__(self, i):
42  return [pt for pt in self][i]
43 

◆ __iter__()

def lsst.afw.geom.polygon.polygonContinued.Polygon.__iter__ (   self)
Iterator over vertices

Definition at line 36 of file polygonContinued.py.

36  def __iter__(self):
37  """Iterator over vertices"""
38  vertices = self.getVertices()
39  return iter(vertices)
40 

◆ __len__()

def lsst.afw.geom.polygon.polygonContinued.Polygon.__len__ (   self)

Definition at line 44 of file polygonContinued.py.

44  def __len__(self):
45  return self.getNumEdges()
46 

◆ __reduce__()

def lsst.afw.geom.polygon.polygonContinued.Polygon.__reduce__ (   self)

Definition at line 33 of file polygonContinued.py.

33  def __reduce__(self):
34  return self.__class__, (self.getVertices(),)
35 

◆ __repr__()

def lsst.afw.geom.polygon.polygonContinued.Polygon.__repr__ (   self)

Definition at line 30 of file polygonContinued.py.

30  def __repr__(self):
31  return f"{self.__class__.__name__}({[p for p in self.getVertices()]})"
32 

◆ display()

def lsst.afw.geom.polygon.polygonContinued.Polygon.display (   self,
  xy0 = None,
  frame = 1,
  ctype = None 
)
Display polygon on existing frame

Definition at line 51 of file polygonContinued.py.

51  def display(self, xy0=None, frame=1, ctype=None):
52  """Display polygon on existing frame"""
53  import lsst.geom
54  import lsst.afw.display as afwDisplay
55  xy0 = lsst.geom.Extent2D(0, 0) if xy0 is None else lsst.geom.Extent2D(xy0)
56  disp = afwDisplay.Display(frame=frame)
57  with disp.Buffering():
58  for p1, p2 in self.getEdges():
59  disp.line((p1 - xy0, p2 - xy0), ctype=ctype)
60 

◆ plot()

def lsst.afw.geom.polygon.polygonContinued.Polygon.plot (   self,
  axes = None,
**  kwargs 
)
Plot polygon with matplotlib

Parameters
----------
axes : `matplotlib.axes.Axes`
    Matplotlib axes to use, or None
kwargs : any
    Additional arguments to `matplotlib.axes.Axes.plot`
    or `matplotlib.axes.Axes.scatter`.

Returns
-------
axes : `matplotlib.axes.Axes`
    The axes used to make the plot (same as ``axes``, if provided).

Definition at line 61 of file polygonContinued.py.

61  def plot(self, axes=None, **kwargs):
62  """Plot polygon with matplotlib
63 
64  Parameters
65  ----------
66  axes : `matplotlib.axes.Axes`
67  Matplotlib axes to use, or None
68  kwargs : any
69  Additional arguments to `matplotlib.axes.Axes.plot`
70  or `matplotlib.axes.Axes.scatter`.
71 
72  Returns
73  -------
74  axes : `matplotlib.axes.Axes`
75  The axes used to make the plot (same as ``axes``, if provided).
76  """
77  import numpy
78  if axes is None:
79  import matplotlib.pyplot as plt
80  plt.figure()
81  axes = plt.axes()
82  for p1, p2 in self.getEdges():
83  x = (p1.getX(), p2.getX())
84  y = (p1.getY(), p2.getY())
85  axes.plot(x, y, **kwargs)
86  vertices = self.getVertices()
87  x = numpy.array([p[0] for p in vertices])
88  y = numpy.array([p[1] for p in vertices])
89  axes.scatter(x, y, **kwargs)
90  return axes
def plot(mag, width, centers, clusterId, marker="o", markersize=2, markeredgewidth=0, ltype='-', magType="model", clear=True)

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