From 416d8fad221c8037e2b1941b4a0ad6760dceee93 Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Tue, 14 Jan 2025 19:03:10 -0500 Subject: [PATCH] Use new refcat loader method to improve refcat flux field checks. The new implementation no longer assumes there is a refcat shard overlapping the center of a tract, which was important for ci_hsc. --- python/lsst/pipe/tasks/loadReferenceCatalog.py | 8 ++------ tests/test_loadReferenceCatalog.py | 8 ++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/python/lsst/pipe/tasks/loadReferenceCatalog.py b/python/lsst/pipe/tasks/loadReferenceCatalog.py index 95b8a0fbd..6f0caac73 100644 --- a/python/lsst/pipe/tasks/loadReferenceCatalog.py +++ b/python/lsst/pipe/tasks/loadReferenceCatalog.py @@ -38,8 +38,6 @@ from lsst.afw.image import abMagErrFromFluxErr from lsst.meas.algorithms import ReferenceObjectLoader, LoadReferenceObjectsConfig -import lsst.geom - class LoadReferenceCatalogConfig(pexConfig.Config): """Config for LoadReferenceCatalogTask""" @@ -340,9 +338,7 @@ def _determineFluxFields(self, center, filterList): if refFilterName is None: continue try: - results = self.refObjLoader.loadSkyCircle(center, - 0.05*lsst.geom.degrees, - refFilterName) + results = self.refObjLoader.loadSchema(refFilterName) foundReferenceFilter = True self._referenceFilter = refFilterName break @@ -377,7 +373,7 @@ def _determineFluxFields(self, center, filterList): if refFilterName is not None: try: - fluxField = getRefFluxField(results.refCat.schema, filterName=refFilterName) + fluxField = getRefFluxField(results.schema, filterName=refFilterName) except RuntimeError: # This flux field isn't available. Set to None fluxField = None diff --git a/tests/test_loadReferenceCatalog.py b/tests/test_loadReferenceCatalog.py index dc171f345..2e9e4300c 100644 --- a/tests/test_loadReferenceCatalog.py +++ b/tests/test_loadReferenceCatalog.py @@ -63,6 +63,14 @@ def loadSkyCircle(self, ctrCoord, radius, filterName, **kwargs): def loadPixelBox(self, bbox, wcs, referenceFilter, **kwargs): return self.loadSkyCircle(None, None, referenceFilter) + def loadSchema(self, filterName): + refCat = self.make_synthetic_refcat(_synthCenter, _synthFlux) + fluxField = getRefFluxField(schema=refCat.schema, filterName=filterName) + return pipeBase.Struct( + schema=refCat.schema, + fluxField=fluxField + ) + class LoadReferenceCatalogTestCase(lsst.utils.tests.TestCase): @classmethod