20 namespace algorithms {
23 KernelPsf::doComputeKernelImage(
geom::Point2D const& position, afw::image::Color
const& color)
const {
24 PTR(Psf::Image) im = std::make_shared<Psf::Image>(_kernel->getDimensions());
25 _kernel->computeImage(*im,
true, position.getX(), position.getY());
29 geom::Box2I KernelPsf::doComputeBBox(
geom::Point2D const& position, afw::image::Color
const& color)
const {
30 return _kernel->getBBox();
34 :
ImagePsf(!kernel.isSpatiallyVarying()),
35 _kernel(kernel.
clone()),
36 _averagePosition(averagePosition) {}
39 :
ImagePsf(!kernel->isSpatiallyVarying()), _kernel(kernel), _averagePosition(averagePosition) {}
44 return std::make_shared<KernelPsf>(*_kernel->resized(width, height), _averagePosition);
60 KernelPsfPersistenceHelper::KernelPsfPersistenceHelper()
62 kernel(
schema.addField<
int>(
"kernel",
"archive ID of nested kernel object")),
64 schema,
"averagePosition",
"average position of stars used to make the PSF",
"pixel")) {
65 schema.getCitizen().markPersistent();
78 record->set(keys.
kernel, handle.put(_kernel));
80 handle.saveCatalog(catalog);
A read-only singleton struct containing the schema and key used in persistence for KernelPsf...
boost::shared_ptr< afw::detection::Psf > resized(int width, int height) const override
Return a clone with specified kernel dimensions.
afw::table::PointKey< double > averagePosition
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Point< double, 2 > Point2D
void write(OutputArchiveHandle &handle) const override
afw::table::Schema schema
afw::table::PointKey< double > averagePosition
static KernelPsfPersistenceHelper const & get()
std::string getPythonModule() const override
afw::table::Key< int > kernel
boost::shared_ptr< afw::detection::Psf > clone() const override
Polymorphic deep copy.
io::OutputArchiveHandle OutputArchiveHandle
Utilities for persisting KernelPsf and subclasses thereof.
An intermediate base class for Psfs that use an image representation.
A PersistableFactory for KernelPsf and its subclasses.
bool isPersistable() const noexcept override
Whether this object is persistable; just delegates to the kernel.
std::string getPersistenceName() const override
KernelPsf(afw::math::Kernel const &kernel, geom::Point2D const &averagePosition=geom::Point2D())
Construct a KernelPsf with a clone of the given kernel.
image::Image< Pixel > Image
afw::table::Schema schema
geom::Point2D getAveragePosition() const override
Return average position of stars; used as default position.
std::shared_ptr< BaseRecord > addNew()