Skip to content

Commit 86e84f9

Browse files
committed
add try expect again
1 parent a6bc8b4 commit 86e84f9

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

python/lsst/meas/algorithms/makePsfCandidates.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ def makePsfCandidates(self, starCat, exposure):
141141
vmax = afwMath.makeStatistics(im, afwMath.MAX).getValue()
142142
if not np.isfinite(vmax):
143143
continue
144-
145-
star['psf_max_value'] = vmax
144+
try:
145+
star['psf_max_value'] = vmax
146+
except KeyError:
147+
self.log.warning("psf_max_value is not set in current schema.")
146148
psfCandidateList.append(psfCandidate)
147149
goodStarCat.append(star)
148150

tests/test_psfCandidate.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2121

2222
import unittest
23-
import numpy as np
2423

2524
import lsst.geom
2625
import lsst.afw.detection as afwDet
@@ -54,9 +53,6 @@ def makeEmptyCatalog(psfCandidateField=None):
5453
schema = afwTable.SourceTable.makeMinimalSchema()
5554
lsst.afw.table.Point2DKey.addFields(schema, "centroid", "centroid", "pixels")
5655
schema.addField("psfFlux_instFlux", type="D", doc="a place to link psf slot to")
57-
schema.addField("psf_max_value",
58-
type=np.float32,
59-
doc="Maximum value in the star image used to train PSF.",)
6056
if psfCandidateField is not None:
6157
schema.addField(psfCandidateField, type="Flag", doc="Is a psfCandidate?")
6258
catalog = afwTable.SourceCatalog(schema)

tests/test_psfDetermination.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ def measure(self, footprintSet, exposure):
8080
def setUp(self):
8181

8282
self.schema = afwTable.SourceTable.makeMinimalSchema()
83-
self.schema.addField("psf_max_value",
84-
type=np.float32,
85-
doc="Maximum value in the star image used to train PSF.",)
8683
config = measBase.SingleFrameMeasurementConfig()
8784
config.algorithms.names = ["base_PixelFlags",
8885
"base_SdssCentroid",

tests/test_psfSelectTest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ def setUp(self):
224224
measConfig.slots.calibFlux = None
225225

226226
self.schema = afwTable.SourceTable.makeMinimalSchema()
227-
self.schema.addField("psf_max_value",
228-
type=np.float32,
229-
doc="Maximum value in the star image used to train PSF.",)
230227
self.detTask = measAlg.SourceDetectionTask(config=detConfig, schema=self.schema)
231228
self.measTask = measBase.SingleFrameMeasurementTask(config=measConfig, schema=self.schema)
232229

0 commit comments

Comments
 (0)