25 #include "lsst/pex/exceptions.h"
36 "dimensions of a Kernel's images",
"pixel")),
37 center(afw::table::PointKey<int>::addFields(
schema,
"center",
"center point in a Kernel image",
39 if (nSpatialFunctions > 0) {
41 "spatialfunctions",
"archive IDs for the Kernel's spatial functions", nSpatialFunctions);
56 std::shared_ptr<afw::table::BaseRecord> record = catalog.
addNew();
58 record->set(center, kernel.
getCtr());
59 if (spatialFunctions.isValid()) {
68 std::vector<std::shared_ptr<Kernel::SpatialFunction>>
const& spatialFunctionList)
const {
69 ndarray::Array<int, 1, 1> array = record[spatialFunctions];
70 for (std::size_t
n = 0;
n < spatialFunctionList.size(); ++
n) {
71 array[
n] = handle.
put(spatialFunctionList[
n]);
77 ndarray::Array<int const, 1, 1> array = record[spatialFunctions];
78 std::vector<std::shared_ptr<Kernel::SpatialFunction>> spatialFunctionList(array.getSize<0>());
79 for (std::size_t
n = 0;
n < spatialFunctionList.size(); ++
n) {
83 return spatialFunctionList;
PersistenceHelper(int nSpatialFunctions)
Defines the fields and offsets for a table.
afw::table::PointKey< int > dimensions
geom::Extent2I const getDimensions() const
Return the Kernel's dimensions (width, height)
int put(Persistable const *obj, bool permissive=false)
Save a nested Persistable to the same archive.
An object passed to Persistable::write to allow it to persist itself.
A custom container class for records, based on std::vector.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
A Function taking two arguments.
metadata import lsst afw display as afwDisplay n
afw::table::Schema schema
Tag types used to declare specialized field types.
lsst::afw::geom::Point2I getCtr() const
Return index of kernel's center.
std::vector< SpatialFunctionPtr > readSpatialFunctions(afw::table::io::InputArchive const &archive, afw::table::BaseRecord const &record) const
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Base class for all records.
std::vector< SpatialFunctionPtr > _spatialFunctionList
void writeSpatialFunctions(afw::table::io::OutputArchiveHandle &handle, afw::table::BaseRecord &record, std::vector< SpatialFunctionPtr > const &spatialFunctionList) const
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
std::shared_ptr< afw::table::BaseRecord > write(afw::table::io::OutputArchiveHandle &handle, Kernel const &kernel) const
afw::table::Key< afw::table::Array< int > > spatialFunctions
Kernels are used for convolution with MaskedImages and (eventually) Images.
afw::table::Schema schema
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.