63 def run(self, catalog, filterName=None, epoch=None):
64 """Load reference objects and match to them.
68 catalog : `lsst.afw.table.SourceCatalog`
71 Name of filter loading fluxes.
72 epoch : `astropy.time.Time` or `None`
73 Epoch to which to correct proper motion and parallax, or `None` to
74 not apply such corrections.
78 result : `lsst.pipe.base.Struct`
79 Result struct with components:
82 Matched sources with associated reference
83 (`lsst.afw.table.SourceMatchVector`).
85 Match metadata (`lsst.meas.astrom.MatchMetadata`).
88 raise RuntimeError(
"Running matcher task with no refObjLoader set in __ini__ or setRefObjLoader")
90 matchMeta = self.
refObjLoader.getMetadataCircle(circle.center, circle.radius, filterName, epoch=epoch)
91 emptyResult = Struct(matches=[], matchMeta=matchMeta)
92 sourceSelection = self.sourceSelection.
run(catalog)
93 if len(sourceSelection.sourceCat) == 0:
94 self.log.warning(
"No objects selected from %d objects in source catalog", len(catalog))
96 refData = self.
refObjLoader.loadSkyCircle(circle.center, circle.radius, filterName, epoch=epoch)
97 refCat = refData.refCat
98 refSelection = self.referenceSelection.
run(refCat)
99 if len(refSelection.sourceCat) == 0:
100 self.log.warning(
"No objects selected from %d objects in reference catalog", len(refCat))
103 self.config.matchRadius*arcseconds)
104 self.log.info(
"Matched %d from %d/%d input and %d/%d reference sources",
105 len(matches), len(sourceSelection.sourceCat), len(catalog),
106 len(refSelection.sourceCat), len(refCat))
107 return Struct(matches=matches, matchMeta=matchMeta, refCat=refCat, sourceSelection=sourceSelection,
108 refSelection=refSelection)
111 """Calculate a circle enclosing the catalog.
115 catalog : `lsst.afw.table.SourceCatalog`
120 result : `lsst.pipe.base.Struct`
121 Result struct with components:
124 ICRS center coordinate (`lsst.afw.geom.SpherePoint`).
126 Radius of the circle (`lsst.geom.Angle`).
128 coordList = [src.getCoord()
for src
in catalog]
129 center = averageSpherePoint(coordList)
130 radius = max(center.separation(coord)
for coord
in coordList)
131 return Struct(center=center, radius=radius + self.config.matchRadius*arcseconds)