Skip to content

Commit

Permalink
Add centroids plotting for catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Jan 10, 2024
1 parent c72ce4b commit e5af194
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/lsst/afw/display/interface.py
Expand Up @@ -644,6 +644,26 @@ def erase(self):
"""
self._impl._erase()

def centroids(self, catalog, symbol="o", *args, **kwargs):
"""Draw the sources from a catalog at their pixel centroid positions
as given by `~lsst.afw.table.Catalog.getX()` and
`~lsst.afw.table.Catalog.getY()`.
See `dot` for an explanation of ``symbol`` and available args/kwargs,
which are passed to `dot`
Parameters
----------
catalog : `lsst.afw.table.Catalog`
Catalog to display centroids for. Must have valid `slot_Centroid`.
"""
if not catalog.getCentroidSlot().isValid():
raise RuntimeError("Catalog must have a valid `slot_Centroid` defined to get X/Y positions.")

with self.Buffering():
for pt in catalog:
self.dot(symbol, pt.getX(), pt.getY(), *args, **kwargs)

def dot(self, symb, c, r, size=2, ctype=None, origin=afwImage.PARENT, *args, **kwargs):
"""Draw a symbol onto the specified display frame
Expand Down

0 comments on commit e5af194

Please sign in to comment.