From 743cd8777119fafd2254781a80b7b7365f1dc8fa Mon Sep 17 00:00:00 2001 From: Eli Rykoff Date: Tue, 7 May 2024 11:28:59 -0700 Subject: [PATCH] Only add the invalid psf flag if it is not present in the schema. --- python/lsst/meas/base/baseMeasurement.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/python/lsst/meas/base/baseMeasurement.py b/python/lsst/meas/base/baseMeasurement.py index 4c8960ef..eac70fa1 100644 --- a/python/lsst/meas/base/baseMeasurement.py +++ b/python/lsst/meas/base/baseMeasurement.py @@ -318,11 +318,15 @@ def initializePlugins(self, **kwds): else: schema = kwds["schema"] - self.keyInvalidPsf = schema.addField( - "base_InvalidPsf_flag", - type="Flag", - doc="Invalid PSF at this location.", - ) + invalidPsfName = "base_InvalidPsf_flag" + if invalidPsfName in schema: + self.keyInvalidPsf = schema.find(invalidPsfName).key + else: + self.keyInvalidPsf = schema.addField( + invalidPsfName, + type="Flag", + doc="Invalid PSF at this location.", + ) def callMeasure(self, measRecord, *args, **kwds): """Call ``measure`` on all plugins and consistently handle exceptions.