Skip to content

Commit

Permalink
Merge pull request #274 from lsst/tickets/DM-27843
Browse files Browse the repository at this point in the history
DM-27843: Add anyFilterMapsToThis support to ReferenceObjectLoader
  • Loading branch information
parejkoj committed Dec 30, 2021
2 parents 74f620d + 48cdb78 commit be01a45
Show file tree
Hide file tree
Showing 5 changed files with 571 additions and 710 deletions.
4 changes: 2 additions & 2 deletions python/lsst/meas/algorithms/ingestIndexReferenceTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from lsst.daf.base import PropertyList
from .indexerRegistry import IndexerRegistry
from .readTextCatalogTask import ReadTextCatalogTask
from .loadReferenceObjects import LoadReferenceObjectsTask
from .loadReferenceObjects import ReferenceObjectLoaderBase
from . import convertRefcatManager

# The most recent Indexed Reference Catalog on-disk format version.
Expand Down Expand Up @@ -414,7 +414,7 @@ def makeSchema(self, dtype):
- A map of catalog keys to use in filling the record
"""
# make a schema with the standard fields
schema = LoadReferenceObjectsTask.makeMinimalSchema(
schema = ReferenceObjectLoaderBase.makeMinimalSchema(
filterNameList=self.config.mag_column_list,
addCentroid=False,
addIsPhotometric=bool(self.config.is_photometric_name),
Expand Down
22 changes: 5 additions & 17 deletions python/lsst/meas/algorithms/loadIndexedReferenceObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from .loadReferenceObjects import hasNanojanskyFluxUnits, convertToNanojansky, getFormatVersionFromRefCat
from lsst.meas.algorithms import getRefFluxField, LoadReferenceObjectsTask, LoadReferenceObjectsConfig
import lsst.afw.table as afwTable
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
from lsst.utils.timer import timeMethod
Expand Down Expand Up @@ -99,26 +98,15 @@ def loadSkyCircle(self, ctrCoord, radius, filterName, epoch=None, centroids=Fals
raise RuntimeError(f"Format version in reference catalog ({catVersion}) does not match"
f" format_version field in config ({self.dataset_config.format_version})")

self._addFluxAliases(refCat.schema)
expandedCat = self._remapReferenceCatalogSchema(refCat,
anyFilterMapsToThis=self.config.anyFilterMapsToThis,
filterMap=self.config.filterMap,
centroids=centroids)
fluxField = getRefFluxField(refCat.schema, filterName)

if centroids:
# add and initialize centroid and hasCentroid fields (these are
# added after loading to avoid wasting space in the saved catalogs)
# the new fields are automatically initialized to (nan, nan) and
# False so no need to set them explicitly
mapper = afwTable.SchemaMapper(refCat.schema, True)
mapper.addMinimalSchema(refCat.schema, True)
mapper.editOutputSchema().addField("centroid_x", type=float)
mapper.editOutputSchema().addField("centroid_y", type=float)
mapper.editOutputSchema().addField("hasCentroid", type="Flag")
expandedCat = afwTable.SimpleCatalog(mapper.getOutputSchema())
expandedCat.extend(refCat, mapper=mapper)
refCat = expandedCat

# return reference catalog
return pipeBase.Struct(
refCat=refCat,
refCat=expandedCat,
fluxField=fluxField,
)

Expand Down

0 comments on commit be01a45

Please sign in to comment.