LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
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::CoaddPsf::Factory Class Reference
Inheritance diagram for lsst::meas::algorithms::CoaddPsf::Factory:
lsst::afw::table::io::PersistableFactory

Public Member Functions

virtual std::shared_ptr< afw::table::io::Persistableread (InputArchive const &archive, CatalogVector const &catalogs) const
 Construct a new object from the given InputArchive and vector of catalogs.
 
std::shared_ptr< afw::table::io::PersistablereadV0 (InputArchive const &archive, CatalogVector const &catalogs) const
 
 Factory (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

Definition at line 374 of file CoaddPsf.cc.

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

◆ Factory()

lsst::meas::algorithms::CoaddPsf::Factory::Factory ( std::string const & name)
inline

Definition at line 418 of file CoaddPsf.cc.

418: 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()

virtual std::shared_ptr< afw::table::io::Persistable > lsst::meas::algorithms::CoaddPsf::Factory::read ( InputArchive const & archive,
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 377 of file CoaddPsf.cc.

377 {
378 if (catalogs.size() == 1u) {
379 // Old CoaddPsfs were saved in only one catalog, because we didn't
380 // save the warping parameters and average position, and we could
381 // save the coadd Wcs in a special final record.
382 return readV0(archive, catalogs);
383 }
384 LSST_ARCHIVE_ASSERT(catalogs.size() == 2u);
385 CoaddPsfPersistenceHelper const &keys1 = CoaddPsfPersistenceHelper::get();
386 LSST_ARCHIVE_ASSERT(catalogs.front().getSchema() == keys1.schema);
387 afw::table::BaseRecord const &record1 = catalogs.front().front();
389 new CoaddPsf(afw::table::ExposureCatalog::readFromArchive(archive, catalogs.back()),
390 *archive.get<afw::geom::SkyWcs>(record1.get(keys1.coaddWcs)),
391 record1.get(keys1.averagePosition), record1.get(keys1.warpingKernelName),
392 record1.get(keys1.cacheSize)));
393 }
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition Persistable.h:48
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition Exposure.cc:456
std::shared_ptr< afw::table::io::Persistable > readV0(InputArchive const &archive, CatalogVector const &catalogs) const
Definition CoaddPsf.cc:400
CoaddPsf(afw::table::ExposureCatalog const &catalog, afw::geom::SkyWcs const &coaddWcs, std::string const &weightFieldName="weight", std::string const &warpingKernelName="lanczos3", int cacheSize=10000)
Main constructors for CoaddPsf.
Definition CoaddPsf.cc:141

◆ readV0()

std::shared_ptr< afw::table::io::Persistable > lsst::meas::algorithms::CoaddPsf::Factory::readV0 ( InputArchive const & archive,
CatalogVector const & catalogs ) const
inline

Definition at line 400 of file CoaddPsf.cc.

401 {
402 auto internalCat = afw::table::ExposureCatalog::readFromArchive(archive, catalogs.front());
403 // Coadd WCS is stored in a special last record.
404 auto coaddWcs = internalCat.back().getWcs();
405 internalCat.pop_back();
406 // Attempt to reconstruct the average position. We can't do this
407 // exactly, since the catalog we saved isn't the same one that was
408 // used to compute the original average position.
409 afw::table::Key<double> weightKey;
410 try {
411 weightKey = internalCat.getSchema()["weight"];
412 } catch (pex::exceptions::NotFoundError &) {
413 }
414 auto averagePos = computeAveragePosition(internalCat, *coaddWcs, weightKey);
415 return std::shared_ptr<CoaddPsf>(new CoaddPsf(internalCat, *coaddWcs, averagePos));
416 }
afw::table::Key< int > coaddWcs

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