LSST Applications 24.1.6,g063fba187b+56b85ce14a,g0f08755f38+df8a265115,g12f32b3c4e+891a09f10d,g1524ad2192+7a5d7b3fbd,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g28da252d5a+07cb1400be,g2bbee38e9b+ae03bbfc84,g2bc492864f+ae03bbfc84,g3156d2b45e+6e55a43351,g347aa1857d+ae03bbfc84,g35bb328faa+a8ce1bb630,g3a166c0a6a+ae03bbfc84,g3e281a1b8c+c5dd892a6c,g414038480c+6b9177ef31,g41af890bb2+8f257c4c0b,g781aacb6e4+a8ce1bb630,g7af13505b9+7137b3b17d,g80478fca09+6df6903293,g82479be7b0+091ce1d07f,g858d7b2824+df8a265115,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,g9726552aa6+414189b318,ga5288a1d22+4a2bca08d7,gacef1a1666+c9a8ff65f4,gb58c049af0+d64f4d3760,gbcfae0f0a0+de1d42d831,gc28159a63d+ae03bbfc84,gcf0d15dbbd+72117bf34e,gda6a2b7d83+72117bf34e,gdaeeff99f8+1711a396fd,ge500cccec5+c8c9c9af63,ge79ae78c31+ae03bbfc84,gf0baf85859+c1f95f4921,gfa517265be+df8a265115,gfa999e8aa5+17cd334064,gfb92a5be7c+df8a265115
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | List of all members
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory Class Reference
Inheritance diagram for lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory:
lsst::afw::table::io::PersistableFactory

Public Member Functions

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

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.
 

Static Public Attributes

static Factory registration
 

Protected Types

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

Detailed Description

template<typename ImagePixelT, typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
class lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory

Definition at line 282 of file HeavyFootprint.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()

template<typename ImagePixelT , typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory::Factory ( std::string const & name)
inlineexplicit

Definition at line 285 of file HeavyFootprint.cc.

285: 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 ImagePixelT , typename MaskPixelT = lsst::afw::image::MaskPixel, typename VariancePixelT = lsst::afw::image::VariancePixel>
std::shared_ptr< afw::table::io::Persistable > lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory::read ( InputArchive const & archive,
CatalogVector const & catalogs ) const
inlineoverridevirtual

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

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

Definition at line 287 of file HeavyFootprint.cc.

288 {
289 HeavyFootprintPersistenceHelper<ImagePixelT, MaskPixelT, VariancePixelT> const& keys =
290 HeavyFootprintPersistenceHelper<ImagePixelT, MaskPixelT, VariancePixelT>::get();
291 HeavyFootprintPersistenceHelper<ImagePixelT, std::uint16_t, VariancePixelT> const& legacyKeys =
292 HeavyFootprintPersistenceHelper<ImagePixelT, std::uint16_t, VariancePixelT>::get();
293 LSST_ARCHIVE_ASSERT(catalogs.size() == 3u);
294
295 // Read in the SpanSet into a new Footprint object
296 std::shared_ptr<Footprint> loadedFootprint = readSpanSet(catalogs[0], archive);
297 // Now read in the PeakCatalog records
298 readPeaks(catalogs[1], *loadedFootprint);
299 afw::table::BaseRecord const& record = catalogs[2].front();
300
301 // Create the HeavyFootprint from the above Footprint
302 auto result =
303 std::make_shared<HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT>>(*loadedFootprint);
304 result->_image = ndarray::const_array_cast<ImagePixelT>(record.get(keys.image));
305
306 // Handle legacy Masks prior to change to int32
307 if (catalogs[2].getSchema() == legacyKeys.schema) {
308 auto legacyMask = ndarray::const_array_cast<std::uint16_t>(record.get(legacyKeys.mask));
309 result->_mask.deep() = legacyMask;
310 } else {
311 result->_mask = ndarray::const_array_cast<MaskPixelT>(record.get(keys.mask));
312 }
313 result->_variance = ndarray::const_array_cast<VariancePixelT>(record.get(keys.variance));
314 return result;
315 }
py::object result
Definition _schema.cc:429
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition Persistable.h:48
static std::unique_ptr< Footprint > readSpanSet(afw::table::BaseCatalog const &, afw::table::io::InputArchive const &)
Static method used to unpersist the SpanSet member of the Footprint class.
Definition Footprint.cc:286
static void readPeaks(afw::table::BaseCatalog const &, Footprint &)
Static method used to unpersist the PeakCatalog member of the Footprint class.
Definition Footprint.cc:310

Member Data Documentation

◆ registration

template<typename ImagePixelT , typename MaskPixelT , typename VariancePixelT >
HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >::Factory::registration
static

Definition at line 317 of file HeavyFootprint.cc.


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