lsst.meas.algorithms
g4a7591d645+ecc601e506
Toggle main menu visibility
Loading...
Searching...
No Matches
src
KernelPsf.cc
Go to the documentation of this file.
1
// -*- LSST-C++ -*-
2
3
#include "
lsst/geom/Box.h
"
4
#include "
lsst/afw/table/io/Persistable.cc
"
5
#include "
lsst/meas/algorithms/KernelPsf.h
"
6
#include "
lsst/meas/algorithms/KernelPsfFactory.h
"
7
8
namespace
lsst
{
9
namespace
afw
{
10
namespace
table
{
11
namespace
io
{
12
13
template
std::shared_ptr<meas::algorithms::KernelPsf>
14
PersistableFacade<meas::algorithms::KernelPsf>::dynamicCast
(std::shared_ptr<Persistable>
const
&);
15
16
}
// namespace io
17
}
// namespace table
18
}
// namespace afw
19
namespace
meas
{
20
namespace
algorithms {
21
22
std::shared_ptr<afw::detection::Psf::Image>
23
KernelPsf::doComputeKernelImage
(
geom::Point2D
const
& position,
afw::image::Color
const
& color)
const
{
24
std::shared_ptr<Psf::Image>
im =
std::make_shared<Psf::Image>
(_kernel->getDimensions());
25
_kernel->computeImage(*im,
true
, position.getX(), position.getY());
26
return
im;
27
}
28
29
geom::Box2I
KernelPsf::doComputeBBox
(
geom::Point2D
const
& position,
afw::image::Color
const
& color)
const
{
30
return
_kernel->getBBox();
31
}
32
33
KernelPsf::KernelPsf
(
afw::math::Kernel
const
& kernel,
geom::Point2D
const
& averagePosition)
34
:
ImagePsf
(!kernel.isSpatiallyVarying()),
35
_kernel(kernel.
clone
()),
36
_averagePosition(averagePosition) {}
37
38
KernelPsf::KernelPsf
(
std::shared_ptr<afw::math::Kernel>
kernel,
geom::Point2D
const
& averagePosition)
39
:
ImagePsf
(!kernel->isSpatiallyVarying()), _kernel(kernel), _averagePosition(averagePosition) {}
40
41
std::shared_ptr<afw::detection::Psf>
KernelPsf::clone
()
const
{
return
std::make_shared<KernelPsf>
(*
this
); }
42
43
std::shared_ptr<afw::detection::Psf>
KernelPsf::resized
(
int
width,
int
height)
const
{
44
return
std::make_shared<KernelPsf>
(*_kernel->resized(width, height), _averagePosition);
45
}
46
47
geom::Point2D
KernelPsf::getAveragePosition
()
const
{
return
_averagePosition; }
48
49
namespace
{
50
51
KernelPsfFactory<>
registration(
"KernelPsf"
);
52
53
}
// namespace
54
55
KernelPsfPersistenceHelper
const
&
KernelPsfPersistenceHelper::get
() {
56
static
KernelPsfPersistenceHelper
instance;
57
return
instance;
58
}
59
60
KernelPsfPersistenceHelper::KernelPsfPersistenceHelper
()
61
: schema(),
62
kernel(schema.addField<int>(
"kernel"
,
"archive ID of nested kernel object"
)),
63
averagePosition(
afw
::
table
::PointKey<double>::addFields(
64
schema,
"averagePosition"
,
"average position of stars used to make the PSF"
,
"pixel"
)) {}
65
66
bool
KernelPsf::isPersistable
() const noexcept {
return
_kernel->isPersistable(); }
67
68
std::string
KernelPsf::getPersistenceName
()
const
{
return
"KernelPsf"
; }
69
70
std::string
KernelPsf::getPythonModule
()
const
{
return
"lsst.meas.algorithms"
; }
71
72
void
KernelPsf::write
(
OutputArchiveHandle
& handle)
const
{
73
static
KernelPsfPersistenceHelper
const
& keys =
KernelPsfPersistenceHelper::get
();
74
afw::table::BaseCatalog
catalog = handle.makeCatalog(keys.schema);
75
std::shared_ptr<afw::table::BaseRecord>
record = catalog.
addNew
();
76
record->set(keys.kernel, handle.put(_kernel));
77
record->set(keys.averagePosition, _averagePosition);
78
handle.saveCatalog(catalog);
79
}
80
81
}
// namespace algorithms
82
}
// namespace meas
83
}
// namespace lsst
Box.h
KernelPsf.h
KernelPsfFactory.h
Utilities for persisting KernelPsf and subclasses thereof.
std::string
lsst::afw::image::Color
lsst::afw::math::Kernel
lsst::afw::table::CatalogT::addNew
std::shared_ptr< RecordT > addNew()
lsst::afw::table::io::PersistableFacade::dynamicCast
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
lsst::afw::detection::Psf::OutputArchiveHandle
io::OutputArchiveHandle OutputArchiveHandle
lsst::geom::Box2I
lsst::meas::algorithms::ImagePsf::ImagePsf
ImagePsf(bool isFixed=false)
Definition
ImagePsf.h:42
lsst::meas::algorithms::KernelPsfFactory
A PersistableFactory for KernelPsf and its subclasses.
Definition
KernelPsfFactory.h:55
lsst::meas::algorithms::KernelPsf::KernelPsf
KernelPsf(afw::math::Kernel const &kernel, geom::Point2D const &averagePosition=geom::Point2D())
Construct a KernelPsf with a clone of the given kernel.
Definition
KernelPsf.cc:33
lsst::meas::algorithms::KernelPsf::isPersistable
bool isPersistable() const noexcept override
Whether this object is persistable; just delegates to the kernel.
Definition
KernelPsf.cc:66
lsst::meas::algorithms::KernelPsf::doComputeBBox
geom::Box2I doComputeBBox(geom::Point2D const &position, afw::image::Color const &color) const override
Definition
KernelPsf.cc:29
lsst::meas::algorithms::KernelPsf::doComputeKernelImage
std::shared_ptr< Image > doComputeKernelImage(geom::Point2D const &position, afw::image::Color const &color) const override
Definition
KernelPsf.cc:23
lsst::meas::algorithms::KernelPsf::clone
std::shared_ptr< afw::detection::Psf > clone() const override
Polymorphic deep copy.
Definition
KernelPsf.cc:41
lsst::meas::algorithms::KernelPsf::resized
std::shared_ptr< afw::detection::Psf > resized(int width, int height) const override
Return a clone with specified kernel dimensions.
Definition
KernelPsf.cc:43
lsst::meas::algorithms::KernelPsf::getPersistenceName
std::string getPersistenceName() const override
Definition
KernelPsf.cc:68
lsst::meas::algorithms::KernelPsf::getPythonModule
std::string getPythonModule() const override
Definition
KernelPsf.cc:70
lsst::meas::algorithms::KernelPsf::write
void write(OutputArchiveHandle &handle) const override
Definition
KernelPsf.cc:72
lsst::meas::algorithms::KernelPsf::getAveragePosition
geom::Point2D getAveragePosition() const override
Return average position of stars; used as default position.
Definition
KernelPsf.cc:47
Persistable.cc
std::make_shared
T make_shared(T... args)
lsst::afw::table::io
lsst::afw::table
lsst::afw::table::BaseCatalog
CatalogT< BaseRecord > BaseCatalog
lsst::afw
lsst::geom::Point2D
Point< double, 2 > Point2D
lsst::meas
lsst
std::shared_ptr
lsst::meas::algorithms::KernelPsfPersistenceHelper
A read-only singleton struct containing the schema and key used in persistence for KernelPsf.
Definition
KernelPsfFactory.h:25
lsst::meas::algorithms::KernelPsfPersistenceHelper::KernelPsfPersistenceHelper
KernelPsfPersistenceHelper(const KernelPsfPersistenceHelper &)=delete
lsst::meas::algorithms::KernelPsfPersistenceHelper::get
static KernelPsfPersistenceHelper const & get()
Definition
KernelPsf.cc:55
Generated on
for lsst.meas.algorithms by
1.17.0