LSST Applications g02d81e74bb+86cf3d8bc9,g180d380827+7a4e862ed4,g2079a07aa2+86d27d4dc4,g2305ad1205+e1ca1c66fa,g29320951ab+012e1474a1,g295015adf3+341ea1ce94,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+c429d67c83,g48712c4677+f88676dd22,g487adcacf7+27e1e21933,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+b41db86c35,g5a732f18d5+53520f316c,g64a986408d+86cf3d8bc9,g858d7b2824+86cf3d8bc9,g8a8a8dda67+585e252eca,g99cad8db69+84912a7fdc,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+a2b54eae19,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+6681f309db,gc120e1dc64+f0fcc2f6d8,gc28159a63d+0e5473021a,gcf0d15dbbd+c429d67c83,gdaeeff99f8+f9a426f77a,ge6526c86ff+0433e6603d,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+86cf3d8bc9,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Types | List of all members
lsst::meas::algorithms::KernelPsfFactory< T, K > Class Template Reference

A PersistableFactory for KernelPsf and its subclasses. More...

#include <KernelPsfFactory.h>

Inheritance diagram for lsst::meas::algorithms::KernelPsfFactory< T, K >:
lsst::afw::table::io::PersistableFactory

Public Member Functions

virtual std::shared_ptr< afw::table::io::Persistableread (afw::table::io::InputArchive const &archive, afw::table::io::CatalogVector const &catalogs) const
 Construct a new object from the given InputArchive and vector of catalogs.
 
 KernelPsfFactory (std::string const &name)
 

Static Public Member Functions

static PersistableFactory const & lookup (std::string const &name, std::string const &module="")
 Return the factory that has been registered with the given name.
 

Protected Types

using InputArchive = io::InputArchive
 
using CatalogVector = io::CatalogVector
 

Detailed Description

template<typename T = KernelPsf, typename K = afw::math::Kernel>
class lsst::meas::algorithms::KernelPsfFactory< T, K >

A PersistableFactory for KernelPsf and its subclasses.

If a KernelPsf subclass has no data members other than its kernel, table persistence for it can be implemented simply by reimplementing getPersistenceName() and registering a specialization of KernelPsfFactory.

Template Parameters
TKernelPsf subclass the factory will construct.
KKernel subclass the Psf constructor requires.

Definition at line 55 of file KernelPsfFactory.h.

Member Typedef Documentation

◆ CatalogVector

using lsst::afw::table::io::PersistableFactory::CatalogVector = io::CatalogVector
protectedinherited

Definition at line 231 of file Persistable.h.

◆ InputArchive

using lsst::afw::table::io::PersistableFactory::InputArchive = io::InputArchive
protectedinherited

Definition at line 230 of file Persistable.h.

Constructor & Destructor Documentation

◆ KernelPsfFactory()

template<typename T = KernelPsf, typename K = afw::math::Kernel>
lsst::meas::algorithms::KernelPsfFactory< T, K >::KernelPsfFactory ( std::string const & name)
inline

Definition at line 69 of file KernelPsfFactory.h.

69: afw::table::io::PersistableFactory(name) {}

Member Function Documentation

◆ lookup()

PersistableFactory const & lsst::afw::table::io::PersistableFactory::lookup ( std::string const & name,
std::string const & module = "" )
staticinherited

Return the factory that has been registered with the given name.

If the lookup fails and module is not an empty string, we will attempt to import a Python module with that name (this will only work when the C++ is being called from Python) and try again.

Definition at line 76 of file Persistable.cc.

76 {
77 RegistryMap::const_iterator i = getRegistry().find(name);
78 if (i == getRegistry().end()) {
79 if (!module.empty()) {
80 bool success = base::ModuleImporter::import(module);
81 if (!success) {
82 throw LSST_EXCEPT(
83 pex::exceptions::NotFoundError,
84 (boost::format(
85 "PersistableFactory with name '%s' not found, and import of module "
86 "'%s' failed (possibly because Python calls were not available from C++).") %
87 name % module)
88 .str());
89 }
90 i = getRegistry().find(name);
91 if (i == getRegistry().end()) {
92 throw LSST_EXCEPT(
93 pex::exceptions::LogicError,
94 (boost::format(
95 "PersistableFactory with name '%s' not found even after successful import "
96 "of module '%s'. Please report this as a bug in the persistence "
97 "implementation for this object.") %
98 name % module)
99 .str());
100 }
101 } else {
102 throw LSST_EXCEPT(
103 pex::exceptions::LogicError,
104 (boost::format(
105 "PersistableFactory with name '%s' not found, and no Python module to import "
106 "was provided. Please report this as a bug in the persistence implementation "
107 "for this object.") %
108 name)
109 .str());
110 }
111 }
112 return *i->second;
113}
int end
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
static bool import(std::string const &name)
Import the given Python module, and return true if successful.

◆ read()

template<typename T = KernelPsf, typename K = afw::math::Kernel>
virtual std::shared_ptr< afw::table::io::Persistable > lsst::meas::algorithms::KernelPsfFactory< T, K >::read ( afw::table::io::InputArchive const & archive,
afw::table::io::CatalogVector const & catalogs ) const
inlinevirtual

Construct a new object from the given InputArchive and vector of catalogs.

Implements lsst::afw::table::io::PersistableFactory.

Definition at line 57 of file KernelPsfFactory.h.

58 {
59 static KernelPsfPersistenceHelper const& keys = KernelPsfPersistenceHelper::get();
60 LSST_ARCHIVE_ASSERT(catalogs.size() == 1u);
61 LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
62 afw::table::BaseRecord const& record = catalogs.front().front();
63 LSST_ARCHIVE_ASSERT(record.getSchema() == keys.schema);
64 // make_shared cannot be used here because
65 // the KernelPsf constructor that takes shared_ptr<Kernel> is protected
66 return std::shared_ptr<T>(new T(archive.get<K>(record.get(keys.kernel)), record.get(keys.averagePosition)));
67 }
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition Persistable.h:48
static KernelPsfPersistenceHelper const & get()
Definition KernelPsf.cc:55

The documentation for this class was generated from the following file: