24 __all__ = [
"LoadIndexedReferenceObjectsConfig",
"LoadIndexedReferenceObjectsTask"]
26 from lsst.meas.algorithms import getRefFluxField, LoadReferenceObjectsTask, LoadReferenceObjectsConfig
31 from .indexerRegistry
import IndexerRegistry
35 ref_dataset_name = pexConfig.Field(
37 default=
'cal_ref_cat',
38 doc=
'Name of the ingested reference dataset' 43 """Load reference objects from an indexed catalog ingested by 44 IngestIndexReferenceTask. 48 butler : `lsst.daf.persistence.Butler` 49 Data butler for reading catalogs 51 ConfigClass = LoadIndexedReferenceObjectsConfig
52 _DefaultName =
'LoadIndexedReferenceObjectsTask' 55 LoadReferenceObjectsTask.__init__(self, *args, **kwargs)
56 dataset_config = butler.get(
"ref_cat_config", name=self.config.ref_dataset_name, immediate=
True)
57 self.
indexer = IndexerRegistry[dataset_config.indexer.name](dataset_config.indexer.active)
65 shardIdList, isOnBoundaryList = self.
indexer.getShardIds(ctrCoord, radius)
67 refCat = self.
butler.get(
'ref_cat',
71 fluxField =
getRefFluxField(schema=refCat.schema, filterName=filterName)
72 for shard, isOnBoundary
in zip(shards, isOnBoundaryList):
80 if epoch
is not None and "pm_ra" in refCat.schema:
82 if isinstance(refCat.schema[
"pm_ra"].asKey(), lsst.afw.table.KeyAngle):
85 self.log.warn(
"Catalog pm_ra field is not an Angle; not applying proper motion")
91 mapper = afwTable.SchemaMapper(refCat.schema,
True)
92 mapper.addMinimalSchema(refCat.schema,
True)
93 mapper.editOutputSchema().addField(
"centroid_x", type=float)
94 mapper.editOutputSchema().addField(
"centroid_y", type=float)
95 mapper.editOutputSchema().addField(
"hasCentroid", type=
"Flag")
96 expandedCat = afwTable.SimpleCatalog(mapper.getOutputSchema())
97 expandedCat.extend(refCat, mapper=mapper)
101 if not expandedCat.isContiguous():
102 expandedCat = expandedCat.copy(
True)
105 return pipeBase.Struct(
115 shardIdList : `list` of `int` 116 A list of integer shard ids. 120 catalogs : `list` of `lsst.afw.table.SimpleCatalog` 121 A list of reference catalogs, one for each entry in shardIdList. 124 for shardId
in shardIdList:
125 if self.
butler.datasetExists(
'ref_cat',
127 shards.append(self.
butler.get(
'ref_cat',
132 def _trimToCircle(self, refCat, ctrCoord, radius):
133 """Trim a reference catalog to a circular aperture. 137 refCat : `lsst.afw.table.SimpleCatalog` 138 Reference catalog to be trimmed. 139 ctrCoord : `lsst.geom.SpherePoint` 140 ICRS center of search region. 141 radius : `lsst.geom.Angle` 142 Radius of search region. 146 catalog : `lsst.afw.table.SimpleCatalog` 147 Catalog containing objects that fall in the circular aperture. 149 tempCat = type(refCat)(refCat.schema)
150 for record
in refCat:
151 if record.getCoord().separation(ctrCoord) < radius:
152 tempCat.append(record)
def getShards(self, shardIdList)
def loadSkyCircle(self, ctrCoord, radius, filterName=None, epoch=None)
def applyProperMotions(self, catalog, epoch)
Fit spatial kernel using approximate fluxes for candidates, and solving a linear system of equations...
def getRefFluxField(schema, filterName=None)
def _addFluxAliases(self, schema)
def _trimToCircle(self, refCat, ctrCoord, radius)
def __init__(self, butler, args, kwargs)
Abstract base class to load objects from reference catalogs.