diff --git a/src/CoaddPsf.cc b/src/CoaddPsf.cc index 38f3c41ce..b4b332163 100644 --- a/src/CoaddPsf.cc +++ b/src/CoaddPsf.cc @@ -36,6 +36,7 @@ #include "lsst/base.h" #include "lsst/pex/exceptions.h" #include "lsst/geom/Box.h" +#include "lsst/afw/detection/Psf.h" #include "lsst/afw/image/ImageUtils.h" #include "lsst/afw/math/Statistics.h" #include "lsst/meas/algorithms/CoaddPsf.h" @@ -229,7 +230,7 @@ geom::Box2I CoaddPsf::doComputeBBox(geom::Point2D const &ccdXY, afw::image::Colo afw::table::ExposureCatalog subcat = _catalog.subsetContaining(ccdXY, _coaddWcs, true); if (subcat.empty()) { throw LSST_EXCEPT( - pex::exceptions::InvalidParameterError, + lsst::afw::detection::InvalidPsfError, (boost::format("Cannot compute BBox at point %s; no input images at that point.") % ccdXY) .str()); } @@ -252,7 +253,7 @@ CoaddPsf::doComputeKernelImage(geom::Point2D const &ccdXY, afw::image::Color con afw::table::ExposureCatalog subcat = _catalog.subsetContaining(ccdXY, _coaddWcs, true); if (subcat.empty()) { throw LSST_EXCEPT( - pex::exceptions::InvalidParameterError, + lsst::afw::detection::InvalidPsfError, (boost::format("Cannot compute CoaddPsf at point %s; no input images at that point.") % ccdXY) .str()); } diff --git a/tests/test_coaddPsf.py b/tests/test_coaddPsf.py index d7d2d64d8..0e7cc84c5 100755 --- a/tests/test_coaddPsf.py +++ b/tests/test_coaddPsf.py @@ -29,10 +29,10 @@ import lsst.meas.algorithms as measAlg import lsst.pex.exceptions as pexExceptions import lsst.utils.tests +from lsst.afw.detection import InvalidPsfError def getPsfMoments(psf, point): - # import os, pdb; print "PID =", os.getpid(); pdb.set_trace() image = psf.computeImage(point) array = image.getArray() sumx2 = 0.0 @@ -127,7 +127,6 @@ def tearDown(self): def testCreate(self): """Check that we can create a CoaddPsf with 9 elements.""" - print("CreatePsfTest") # also test that the weight field name is correctly observed schema = afwTable.ExposureTable.makeMinimalSchema() @@ -174,7 +173,6 @@ def testCreate(self): def testFractionalPixel(self): """Check that we can create a CoaddPsf with 10 elements.""" - print("FractionalPixelTest") cdMatrix = afwGeom.makeCdMatrix( scale=5.55555555e-05*lsst.geom.degrees, orientation=90*lsst.geom.degrees, @@ -202,7 +200,6 @@ def testFractionalPixel(self): def testRotatePsf(self): """Check that we can create a CoaddPsf with 10 elements.""" - print("RotatePsfTest") cdMatrix = afwGeom.makeCdMatrix( scale=5.55555555e-05*lsst.geom.degrees, orientation=90*lsst.geom.degrees, @@ -228,7 +225,6 @@ def testRotatePsf(self): def testDefaultSize(self): """Test of both default size and specified size.""" - print("DefaultSizeTest") sigma0 = 5 # set the peak of the outer guassian to 0 so this is really a single gaussian. @@ -255,7 +251,6 @@ def testDefaultSize(self): def testSimpleGaussian(self): """Check that we can measure a single Gaussian's attributes.""" - print("SimpleGaussianTest") sigma0 = 5 # set the peak of the outer guassian to 0 so this is really a single gaussian. @@ -296,7 +291,6 @@ def testSimpleGaussian(self): def testWeight(self): """Check that we can measure a single Gaussian's attributes.""" - print("WeightTest") sigma0 = 5 # set the peak of the outer guassian to 0 so this is really a single gaussian. @@ -365,6 +359,13 @@ def testTicket2872(self): naiveAvgPos = lsst.geom.Point2D(50, 50) with self.assertRaises(pexExceptions.InvalidParameterError): coaddPsf.computeKernelImage(naiveAvgPos) + with self.assertRaises(InvalidPsfError): + coaddPsf.computeKernelImage(naiveAvgPos) + with self.assertRaises(pexExceptions.InvalidParameterError): + coaddPsf.computeBBox(naiveAvgPos) + with self.assertRaises(InvalidPsfError): + coaddPsf.computeBBox(naiveAvgPos) + # important test is that this doesn't throw: coaddPsf.computeKernelImage(coaddPsf.getAveragePosition())