Skip to content

Commit

Permalink
Test that sizeExtendedness plugin fails properly
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Apr 18, 2024
1 parent 05379c3 commit 1ceea79
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/lsst/meas/base/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def realize(self, noise, schema, randomSeed=1):
newHeavy.getMaskArray()[:] = oldHeavy.getMaskArray()
newHeavy.getVarianceArray()[:] = oldHeavy.getVarianceArray()
record.setFootprint(newHeavy)
lsst.afw.table.updateSourceCoords(exposure.wcs, catalog)
lsst.afw.table.updateSourceCoords(exposure.wcs, catalog, include_covariance=False)
return exposure, catalog


Expand Down
14 changes: 14 additions & 0 deletions tests/test_MomentsClassifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ def testSingleFramePlugin(self):
for ii in range(self.n_stars, self.n_stars + self.n_gals):
self.assertGreater(catalog[ii].get("base_ClassificationSizeExtendedness_value"), 0.02)

def testFailure(self):
"""Test that MeasurementError is raised properly."""
config = measBase.SingleFrameMeasurementConfig()
task = self.makeSingleFrameMeasurementTask(config=config)
exposure, catalog = self.dataset.realize(10.0, task.schema, randomSeed=5)
plugin = task.plugins["base_ClassificationSizeExtendedness"]
plugin_order = plugin.getExecutionOrder()
task.run(catalog, exposure, endOrder=plugin_order)
catalog["slot_Shape_flag"] = 1
for record in catalog:
with self.subTest(id=record["id"]):
with self.assertRaises(measBase.MeasurementError):
plugin.measure(record, exposure)

@lsst.utils.tests.methodParameters(noise=(0.001, 0.01))
def testMonteCarlo(self, noise: float, n_trials: int = 100):
"""Test an ideal simulation, with no noise.
Expand Down

0 comments on commit 1ceea79

Please sign in to comment.