4 #include "lsst/afw/table/io/Persistable.cc" 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));
A read-only singleton struct containing the schema and key used in persistence for KernelPsf...
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
An object passed to Persistable::write to allow it to persist itself.
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
Point< double, 2 > Point2D
A base class for image defects.
A FunctorKey used to get or set a lsst::geom::Point from an (x,y) pair of int or double Keys...
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
static KernelPsfPersistenceHelper const & get()
std::string getPythonModule() const override
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
afw::table::PointKey< double > averagePosition
afw::table::Key< int > kernel
Base class for all records.
boost::shared_ptr< afw::detection::Psf > clone() const override
Polymorphic deep copy.
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.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
A polymorphic base class for representing an image's Point Spread Function.
KernelPsf(afw::math::Kernel const &kernel, geom::Point2D const &averagePosition=geom::Point2D())
Construct a KernelPsf with a clone of the given kernel.
Kernels are used for convolution with MaskedImages and (eventually) Images.
image::Image< Pixel > Image
Image type returned by computeImage.
afw::table::Schema schema
geom::Point2D getAveragePosition() const override
Return average position of stars; used as default position.
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.