24__all__ = [
"LoadIndexedReferenceObjectsConfig",
"LoadIndexedReferenceObjectsTask"]
26from .loadReferenceObjects
import hasNanojanskyFluxUnits, convertToNanojansky, getFormatVersionFromRefCat
27from lsst.meas.algorithms import getRefFluxField, LoadReferenceObjectsTask, LoadReferenceObjectsConfig
29import lsst.pipe.base
as pipeBase
30from lsst.utils.timer
import timeMethod
31from .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)
64 def loadSkyCircle(self, ctrCoord, radius, filterName, epoch=None, centroids=False):
65 shardIdList, isOnBoundaryList = self.
indexer.getShardIds(ctrCoord, radius)
72 for shard, isOnBoundary
in zip(shards, isOnBoundaryList):
81 if not refCat.isContiguous():
82 refCat = refCat.copy(
True)
89 self.log.warning(
"Found version 0 reference catalog with old style units in schema.")
90 self.log.warning(
"run `meas_algorithms/bin/convert_refcat_to_nJy.py` to convert fluxes to nJy.")
91 self.log.warning(
"See RFC-575 for more details.")
98 raise RuntimeError(f
"Format version in reference catalog ({catVersion}) does not match"
99 f
" format_version field in config ({self.dataset_config.format_version})")
102 anyFilterMapsToThis=self.
config.anyFilterMapsToThis,
103 filterMap=self.
config.filterMap,
108 return pipeBase.Struct(
118 shardIdList : `list` of `int`
119 A list of integer shard ids.
124 A list of reference catalogs, one for each entry
in shardIdList.
127 for shardId
in shardIdList:
135 def _trimToCircle(self, refCat, ctrCoord, radius):
136 """Trim a reference catalog to a circular aperture.
141 Reference catalog to be trimmed.
143 ICRS center of search region.
145 Radius of search region.
150 Catalog containing objects that fall in the circular aperture.
152 tempCat = type(refCat)(refCat.schema)
153 for record
in refCat:
154 if record.getCoord().separation(ctrCoord) < radius:
155 tempCat.append(record)
def _trimToCircle(self, refCat, ctrCoord, radius)
def getShards(self, shardIdList)
def loadSkyCircle(self, ctrCoord, radius, filterName, epoch=None, centroids=False)
def __init__(self, butler, *args, **kwargs)
def applyProperMotions(self, catalog, epoch)
def _remapReferenceCatalogSchema(refCat, *anyFilterMapsToThis=None, filterMap=None, centroids=False)
def hasNanojanskyFluxUnits(schema)
def convertToNanojansky(catalog, log, doConvert=True)
def getRefFluxField(schema, filterName)
def getFormatVersionFromRefCat(refCat)
Fit spatial kernel using approximate fluxes for candidates, and solving a linear system of equations.