Skip to content

Commit

Permalink
Add InvalidPsfError exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed May 7, 2024
1 parent 9c22b29 commit a25a25f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/lsst/afw/detection/Psf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <memory>

#include "lsst/pex/exceptions.h"
#include "lsst/utils/CacheFwd.h"
#include "lsst/afw/geom/ellipses/Quadrupole.h"
#include "lsst/afw/math/Kernel.h"
Expand All @@ -45,6 +46,11 @@ struct PsfCacheKey;

} // namespace detail

/**
* An exception thrown when we have an invalid PSF.
*/
LSST_EXCEPTION_TYPE(InvalidPsfError, lsst::pex::exceptions::InvalidParameterError, lsst::afw::detection::InvalidPsfError)

/**
* A polymorphic base class for representing an image's Point Spread Function
*
Expand Down
6 changes: 6 additions & 0 deletions python/lsst/afw/detection/_psf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "lsst/utils/python.h"
#include "lsst/utils/python/PySharedPtr.h"

#include "lsst/pex/exceptions/Runtime.h"
#include "lsst/pex/exceptions/python/Exception.h"
#include "lsst/geom/Point.h"
#include "lsst/afw/image/Color.h"
#include "lsst/afw/table/io/python.h" // for addPersistableMethods
Expand All @@ -51,6 +53,10 @@ void wrapPsf(utils::python::WrapperCollection& wrappers) {
wrappers.addSignatureDependency("lsst.afw.image");
wrappers.addSignatureDependency("lsst.afw.fits");

auto cls = wrappers.wrapException<InvalidPsfError, pex::exceptions::InvalidParameterError>("InvalidPsfError",
"InvalidParameterError");
cls.def(py::init<std::string const &>());

auto clsPsf = wrappers.wrapType(
py::class_<Psf, PySharedPtr<Psf>, typehandling::Storable, PsfTrampoline<>>(
wrappers.module, "Psf"
Expand Down

0 comments on commit a25a25f

Please sign in to comment.