Skip to content

Commit

Permalink
Merge pull request #388 from lsst/tickets/DM-46486
Browse files Browse the repository at this point in the history
added check for units of flux field
  • Loading branch information
psferguson authored Sep 24, 2024
2 parents 59a7503 + bb50012 commit ebc1f9d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/lsst/meas/algorithms/loadReferenceObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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):
Expand Down

0 comments on commit ebc1f9d

Please sign in to comment.