From bb500120d384cbcc44b68995192ad42ffaf70ed1 Mon Sep 17 00:00:00 2001 From: psferguson Date: Tue, 24 Sep 2024 14:53:36 -0700 Subject: [PATCH] added check for units of flux field --- python/lsst/meas/algorithms/loadReferenceObjects.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/lsst/meas/algorithms/loadReferenceObjects.py b/python/lsst/meas/algorithms/loadReferenceObjects.py index c01d87347..f2f1077ca 100644 --- a/python/lsst/meas/algorithms/loadReferenceObjects.py +++ b/python/lsst/meas/algorithms/loadReferenceObjects.py @@ -692,10 +692,6 @@ class which intersect or are contained within the specified region. The refCat.extend(filteredCat) trimmedAmount += len(tmpCat) - len(filteredCat) - version = getFormatVersionFromRefCat(refCat) - if version > LATEST_FORMAT_VERSION: - raise ValueError(f"Unsupported refcat format version: {version} > {LATEST_FORMAT_VERSION}.") - self.log.debug("Trimmed %d refCat objects lying outside padded region, leaving %d", trimmedAmount, len(refCat)) self.log.info("Loaded %d reference objects", len(refCat)) @@ -715,6 +711,13 @@ class which intersect or are contained within the specified region. The expandedCat = expandedCat.copy(deep=True) fluxField = getRefFluxField(expandedCat.schema, filterName) + + if expandedCat.schema[fluxField].asField().getUnits() != "nJy": + # if the flux field is not in nJy, check the refcat format version + version = getFormatVersionFromRefCat(refCat) + if version > LATEST_FORMAT_VERSION: + raise ValueError(f"Unsupported refcat format version: {version} > {LATEST_FORMAT_VERSION}.") + return pipeBase.Struct(refCat=expandedCat, fluxField=fluxField) def loadSkyCircle(self, ctrCoord, radius, filterName, epoch=None):