Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review for DM-8714: Fix position of psf computation for base_SdssShape_psf #60

Merged
merged 2 commits into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SdssShape.cc
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ void SdssShapeAlgorithm::measure(
if (!psf) {
result.flags[PSF_SHAPE_BAD] = true;
} else {
_resultKey.setPsfShape(measRecord, psf->computeShape());
_resultKey.setPsfShape(measRecord, psf->computeShape(afw::geom::Point2D(result.x, result.y)));
}
} catch (pex::exceptions::Exception & err) {
result.flags[PSF_SHAPE_BAD] = true;
Expand Down
12 changes: 10 additions & 2 deletions tests/testSdssShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ def _checkPsfShape(self, result, psfResult, psfTruth):
self.assertFalse(result.getFlag(lsst.meas.base.SdssShapeAlgorithm.PSF_SHAPE_BAD))

def testMeasureGoodPsf(self):
"""Test that we measure shapes and record the PSF shape correctly."""
"""Test that we measure shapes and record the PSF shape correctly

Note: Given that the PSF model here is constant over the entire image, this test
would not catch an error in the potition at which base_SdssShape_psf is computed.
Such a test requires a spatially varying PSF model such that different locations
can be distinguished by their different PSF model shapes. Such a test exists in
meas_algorithms (tests/testSdssShapePsf.py), making use of the PcaPsf algorithm
to build the spatially varying PSF.
"""
exposure, catalog = self._runMeasurementTask()
key = lsst.meas.base.SdssShapeResultKey(catalog.schema["base_SdssShape"])
psfTruth = exposure.getPsf().computeShape()
Expand Down Expand Up @@ -115,7 +123,7 @@ def testMeasureBadPsf(self):
self.config.plugins["base_SdssShape"].doMeasurePsf = True
task = self.makeSingleFrameMeasurementTask("base_SdssShape", config=self.config)
exposure, catalog = self.dataset.realize(10.0, task.schema)
exposure.setPsf(None) # Set Psf to None to test no psf case
exposure.setPsf(None) # Set PSF to None to test no PSF case
task.run(exposure, catalog)
key = lsst.meas.base.SdssShapeResultKey(catalog.schema["base_SdssShape"])
for record in catalog:
Expand Down