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

DM-44167: Add lsst.afw.detection.InvalidPsfError exception. #733

Merged
merged 1 commit into from
May 8, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading