LSST Applications 28.0.2,g0fba68d861+5b923b673a,g1fd858c14a+7a7b9dd5ed,g2c84ff76c0+5548bfee71,g30358e5240+f0e04ebe90,g35bb328faa+fcb1d3bbc8,g436fd98eb5+bdc6fcdd04,g4af146b050+742274f7cd,g4d2262a081+3efd3f8190,g4e0f332c67+cb09b8a5b6,g53246c7159+fcb1d3bbc8,g5a012ec0e7+477f9c599b,g5edb6fd927+826dfcb47f,g60b5630c4e+bdc6fcdd04,g67b6fd64d1+2218407a0c,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g87b7deb4dc+f9ac2ab1bd,g8852436030+ebf28f0d95,g89139ef638+2218407a0c,g9125e01d80+fcb1d3bbc8,g989de1cb63+2218407a0c,g9f33ca652e+42fb53f4c8,g9f7030ddb1+11b9b6f027,ga2b97cdc51+bdc6fcdd04,gab72ac2889+bdc6fcdd04,gabe3b4be73+1e0a283bba,gabf8522325+3210f02652,gb1101e3267+9c79701da9,gb58c049af0+f03b321e39,gb89ab40317+2218407a0c,gcf25f946ba+ebf28f0d95,gd6cbbdb0b4+e8f9c9c900,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+a08f294619,ge278dab8ac+3ef3db156b,ge410e46f29+2218407a0c,gf67bdafdda+2218407a0c
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst::meas::algorithms::CoaddBoundedField Class Referenceabstract

#include <CoaddBoundedField.h>

Inheritance diagram for lsst::meas::algorithms::CoaddBoundedField:
lsst::afw::table::io::PersistableFacade< CoaddBoundedField > lsst::afw::math::BoundedField lsst::afw::table::io::PersistableFacade< BoundedField > lsst::afw::table::io::Persistable

Classes

class  Factory
 

Public Types

typedef CoaddBoundedFieldElement Element
 
typedef std::vector< ElementElementVector
 

Public Member Functions

 CoaddBoundedField (geom::Box2I const &bbox, std::shared_ptr< afw::geom::SkyWcs const > coaddWcs, ElementVector const &elements)
 
 CoaddBoundedField (geom::Box2I const &bbox, std::shared_ptr< afw::geom::SkyWcs const > coaddWcs, ElementVector const &elements, double default_)
 
double evaluate (geom::Point2D const &position) const override
 Evaluate the field at the given point.
 
std::shared_ptr< afw::geom::SkyWcs const > getCoaddWcs () const
 Get the coaddWcs.
 
double getDefault () const
 Get the default value.
 
ElementVector getElements () const
 Get the elements vector.
 
bool getThrowOnMissing () const
 Get the throwOnMissing setting.
 
virtual bool isPersistable () const noexcept override
 Return true if the CoaddBoundedField persistable (always true).
 
std::shared_ptr< afw::math::BoundedFieldoperator* (double const scale) const override
 Return a scaled BoundedField.
 
bool operator== (BoundedField const &rhs) const override
 BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.
 
double evaluate (double x, double y) const
 Evaluate the field at the given point.
 
virtual ndarray::Array< double, 1, 1 > evaluate (ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y) const
 Evaluate the field at multiple arbitrary points.
 
virtual double integrate () const
 Compute the integral of this function over its bounding-box.
 
virtual double mean () const
 Compute the mean of this function over its bounding-box.
 
lsst::geom::Box2I getBBox () const
 Return the bounding box that defines the region where the field is valid.
 
template<typename T>
void fillImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Assign the field to an image, overwriting values already present.
 
template<typename T>
void addToImage (image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Add the field or a constant multiple of it to an image in-place.
 
template<typename T>
void multiplyImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Multiply an image by the field in-place.
 
template<typename T>
void multiplyImage (image::MaskedImage< T > &image, bool overlapOnly=false) const
 
template<typename T>
void divideImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Divide an image by the field in-place.
 
template<typename T>
void divideImage (image::MaskedImage< T > &image, bool overlapOnly=false) const
 
std::shared_ptr< BoundedFieldoperator/ (double scale) const
 
virtual bool operator== (BoundedField const &rhs) const =0
 BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.
 
bool operator!= (BoundedField const &rhs) const
 BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file.
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory.
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object.
 

Static Public Member Functions

static std::shared_ptr< CoaddBoundedFieldreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object.
 
static std::shared_ptr< CoaddBoundedFieldreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file.
 
static std::shared_ptr< CoaddBoundedFieldreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory.
 
static std::shared_ptr< CoaddBoundedFielddynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr.
 
static std::shared_ptr< BoundedFieldreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object.
 
static std::shared_ptr< BoundedFieldreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file.
 
static std::shared_ptr< BoundedFieldreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory.
 
static std::shared_ptr< BoundedFielddynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr.
 

Protected Types

using OutputArchiveHandle = io::OutputArchiveHandle
 

Protected Member Functions

std::string getPersistenceName () const override
 Return the unique name used to persist this object and look up its factory.
 
std::string getPythonModule () const override
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.
 
void write (OutputArchiveHandle &handle) const override
 Write the object to one or more catalogs.
 

Private Member Functions

std::string toString () const override
 

Detailed Description

Definition at line 59 of file CoaddBoundedField.h.

Member Typedef Documentation

◆ Element

◆ ElementVector

◆ OutputArchiveHandle

using lsst::afw::table::io::Persistable::OutputArchiveHandle = io::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

Constructor & Destructor Documentation

◆ CoaddBoundedField() [1/2]

lsst::meas::algorithms::CoaddBoundedField::CoaddBoundedField ( geom::Box2I const & bbox,
std::shared_ptr< afw::geom::SkyWcs const > coaddWcs,
ElementVector const & elements )
explicit

Definition at line 73 of file CoaddBoundedField.cc.

75 : afw::math::BoundedField(bbox),
76 _throwOnMissing(true),
77 _default(0.0), // unused
78 _coaddWcs(coaddWcs),
79 _elements(elements) {}

◆ CoaddBoundedField() [2/2]

lsst::meas::algorithms::CoaddBoundedField::CoaddBoundedField ( geom::Box2I const & bbox,
std::shared_ptr< afw::geom::SkyWcs const > coaddWcs,
ElementVector const & elements,
double default_ )
explicit

Definition at line 81 of file CoaddBoundedField.cc.

83 : afw::math::BoundedField(bbox),
84 _throwOnMissing(false),
85 _default(default_),
86 _coaddWcs(coaddWcs),
87 _elements(elements) {}

Member Function Documentation

◆ addToImage()

template<typename T>
template void lsst::afw::math::BoundedField::addToImage ( image::Image< T > & image,
double scaleBy = 1.0,
bool overlapOnly = false,
int xStep = 1,
int yStep = 1 ) const
inherited

Add the field or a constant multiple of it to an image in-place.

Parameters
[out]imageImage to add to.
[in]scaleByMultiply the field by this before adding it to the image.
[in]overlapOnlyIf true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().
[in]xStepDistance between grid points in X to evaluate; values between grid points will be linearly interpolated.
[in]yStepDistance between grid points in Y to evaluate; values between grid points will be linearly interpolated.
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 329 of file BoundedField.cc.

330 {
331 applyToImage(*this, img, ScaledAdd(scaleBy), overlapOnly, xStep, yStep);
332}

◆ divideImage() [1/2]

template<typename T>
void lsst::afw::math::BoundedField::divideImage ( image::Image< T > & image,
bool overlapOnly = false,
int xStep = 1,
int yStep = 1 ) const
inherited

Divide an image by the field in-place.

Parameters
[out]imageImage to fill.
[in]overlapOnlyIf true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().
[in]xStepDistance between grid points in X to evaluate; values between grid points will be linearly interpolated.
[in]yStepDistance between grid points in Y to evaluate; values between grid points will be linearly interpolated.
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 345 of file BoundedField.cc.

345 {
346 applyToImage(*this, img, Divide(), overlapOnly, xStep, yStep);
347}

◆ divideImage() [2/2]

template<typename T>
void lsst::afw::math::BoundedField::divideImage ( image::MaskedImage< T > & image,
bool overlapOnly = false ) const
inherited

Definition at line 350 of file BoundedField.cc.

350 {
351 applyToImage(*this, img, Divide(), overlapOnly, 1, 1);
352}

◆ dynamicCast() [1/2]

Dynamically cast a shared_ptr.

Dynamically cast a shared pointer and raise on failure.

You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;

Exceptions
lsst::pex::exceptions::LogicErrorif the cast fails

param[in] ptr The pointer to be cast.

Returns
The cast pointer.
Exceptions
lsst::pex::exceptions::TypeErrorIf the dynamic cast fails.

Definition at line 218 of file Persistable.cc.

18 {
20 if (!result) {
21 throw LSST_EXCEPT(pex::exceptions::TypeError, "Dynamic pointer cast failed");
22 }
23 return result;
24}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
A CRTP facade class for subclasses of Persistable.
T dynamic_pointer_cast(T... args)

◆ dynamicCast() [2/2]

Dynamically cast a shared_ptr.

Dynamically cast a shared pointer and raise on failure.

You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;

Exceptions
lsst::pex::exceptions::LogicErrorif the cast fails

param[in] ptr The pointer to be cast.

Returns
The cast pointer.
Exceptions
lsst::pex::exceptions::TypeErrorIf the dynamic cast fails.

Definition at line 218 of file Persistable.cc.

18 {
20 if (!result) {
21 throw LSST_EXCEPT(pex::exceptions::TypeError, "Dynamic pointer cast failed");
22 }
23 return result;
24}

◆ evaluate() [1/3]

double lsst::afw::math::BoundedField::evaluate ( double x,
double y ) const
inlineinherited

Evaluate the field at the given point.

This delegates to the evaluate() method that takes lsst::geom::Point2D.

There is no bounds-checking on the given position; this is the responsibility of the user, who can almost always do it more efficiently.

Definition at line 76 of file BoundedField.h.

76{ return evaluate(lsst::geom::Point2D(x, y)); }
virtual double evaluate(lsst::geom::Point2D const &position) const =0
Evaluate the field at the given point.
Point< double, 2 > Point2D
Definition Point.h:324

◆ evaluate() [2/3]

ndarray::Array< double, 1, 1 > lsst::afw::math::BoundedField::evaluate ( ndarray::Array< double const, 1 > const & x,
ndarray::Array< double const, 1 > const & y ) const
virtualinherited

Evaluate the field at multiple arbitrary points.

Parameters
[in]xarray of x coordinates, same shape as y
[in]yarray of y coordinates, same shape as x
Returns
an array of output values, same shape as x and y

There is no bounds-checking on the given positions; this is the responsibility of the user, who can almost always do it more efficiently.

Reimplemented in lsst::afw::math::ChebyshevBoundedField, lsst::afw::math::PixelAreaBoundedField, lsst::afw::math::ProductBoundedField, and lsst::afw::math::TransformBoundedField.

Definition at line 40 of file BoundedField.cc.

41 {
42 ndarray::Array<double, 1, 1> out = ndarray::allocate(x.getSize<0>());
43 for (int i = 0, n = x.getSize<0>(); i < n; ++i) {
44 out[i] = evaluate(x[i], y[i]);
45 }
46 return out;
47}

◆ evaluate() [3/3]

double lsst::meas::algorithms::CoaddBoundedField::evaluate ( geom::Point2D const & position) const
overridevirtual

Evaluate the field at the given point.

This is the only abstract method to be implemented by subclasses.

Subclasses should not provide bounds checking on the given position; this is the responsibility of the user, who can almost always do it more efficiently.

Implements lsst::afw::math::BoundedField.

Definition at line 89 of file CoaddBoundedField.cc.

89 {
90 auto coord = _coaddWcs->pixelToSky(position);
91 double sum = 0.0;
92 double wSum = 0.0;
93 for (ElementVector::const_iterator i = _elements.begin(); i != _elements.end(); ++i) {
94 geom::Point2D transformedPosition = i->wcs->skyToPixel(coord);
95 bool inValidArea = i->validPolygon ? i->validPolygon->contains(transformedPosition) : true;
96 if (geom::Box2D(i->field->getBBox()).contains(transformedPosition) && inValidArea) {
97 sum += i->weight * i->field->evaluate(transformedPosition);
98 wSum += i->weight;
99 }
100 }
101 if (wSum == 0.0) {
102 if (_throwOnMissing) {
103 throw LSST_EXCEPT(pex::exceptions::DomainError,
104 (boost::format("No constituent fields to evaluate at point %f, %f") %
105 position.getX() % position.getY())
106 .str());
107 } else {
108 return _default;
109 }
110 }
111 return sum / wSum;
112}

◆ fillImage()

template<typename T>
template void lsst::afw::math::BoundedField::fillImage ( image::Image< T > & image,
bool overlapOnly = false,
int xStep = 1,
int yStep = 1 ) const
inherited

Assign the field to an image, overwriting values already present.

Parameters
[out]imageImage to fill.
[in]overlapOnlyIf true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().
[in]xStepDistance between grid points in X to evaluate; values between grid points will be linearly interpolated.
[in]yStepDistance between grid points in Y to evaluate; values between grid points will be linearly interpolated.
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 324 of file BoundedField.cc.

324 {
325 applyToImage(*this, img, Assign(), overlapOnly, xStep, yStep);
326}

◆ getBBox()

lsst::geom::Box2I lsst::afw::math::BoundedField::getBBox ( ) const
inlineinherited

Return the bounding box that defines the region where the field is valid.

Because this is an integer bounding box, its minimum and maximum positions are the centers of the pixels where the field is valid, but the field can be assumed to be valid to the edges of those pixels, which is the boundary you'd get by converting the returned lsst::geom::Box2I into a lsst::geom::Box2D.

Definition at line 113 of file BoundedField.h.

113{ return _bbox; }

◆ getCoaddWcs()

std::shared_ptr< afw::geom::SkyWcs const > lsst::meas::algorithms::CoaddBoundedField::getCoaddWcs ( ) const
inline

Get the coaddWcs.

Definition at line 75 of file CoaddBoundedField.h.

75{ return _coaddWcs; };

◆ getDefault()

double lsst::meas::algorithms::CoaddBoundedField::getDefault ( ) const
inline

Get the default value.

Definition at line 78 of file CoaddBoundedField.h.

78{ return _default; };

◆ getElements()

ElementVector lsst::meas::algorithms::CoaddBoundedField::getElements ( ) const
inline

Get the elements vector.

Definition at line 81 of file CoaddBoundedField.h.

81{ return _elements; };

◆ getPersistenceName()

std::string lsst::meas::algorithms::CoaddBoundedField::getPersistenceName ( ) const
overrideprotectedvirtual

Return the unique name used to persist this object and look up its factory.

Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 229 of file CoaddBoundedField.cc.

229{ return getCoaddBoundedFieldPersistenceName(); }

◆ getPythonModule()

std::string lsst::meas::algorithms::CoaddBoundedField::getPythonModule ( ) const
overrideprotectedvirtual

Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.

Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.

Will be ignored if empty.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 231 of file CoaddBoundedField.cc.

231{ return "lsst.meas.algorithms"; }

◆ getThrowOnMissing()

bool lsst::meas::algorithms::CoaddBoundedField::getThrowOnMissing ( ) const
inline

Get the throwOnMissing setting.

Definition at line 84 of file CoaddBoundedField.h.

84{ return _throwOnMissing; };

◆ integrate()

double lsst::afw::math::BoundedField::integrate ( ) const
virtualinherited

Compute the integral of this function over its bounding-box.

Returns
The value of the integral.

Reimplemented in lsst::afw::math::ChebyshevBoundedField.

Definition at line 49 of file BoundedField.cc.

49{ throw LSST_EXCEPT(pex::exceptions::LogicError, "Not Implemented"); }

◆ isPersistable()

virtual bool lsst::meas::algorithms::CoaddBoundedField::isPersistable ( ) const
inlineoverridevirtualnoexcept

Return true if the CoaddBoundedField persistable (always true).

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 89 of file CoaddBoundedField.h.

89{ return true; }

◆ mean()

double lsst::afw::math::BoundedField::mean ( ) const
virtualinherited

Compute the mean of this function over its bounding-box.

Returns
The value of the mean.

Reimplemented in lsst::afw::math::ChebyshevBoundedField.

Definition at line 51 of file BoundedField.cc.

51{ throw LSST_EXCEPT(pex::exceptions::LogicError, "Not Implemented"); }

◆ multiplyImage() [1/2]

template<typename T>
void lsst::afw::math::BoundedField::multiplyImage ( image::Image< T > & image,
bool overlapOnly = false,
int xStep = 1,
int yStep = 1 ) const
inherited

Multiply an image by the field in-place.

Parameters
[out]imageImage to fill.
[in]overlapOnlyIf true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().
[in]xStepDistance between grid points in X to evaluate; values between grid points will be linearly interpolated.
[in]yStepDistance between grid points in Y to evaluate; values between grid points will be linearly interpolated.
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 335 of file BoundedField.cc.

335 {
336 applyToImage(*this, img, Multiply(), overlapOnly, xStep, yStep);
337}

◆ multiplyImage() [2/2]

template<typename T>
void lsst::afw::math::BoundedField::multiplyImage ( image::MaskedImage< T > & image,
bool overlapOnly = false ) const
inherited

Definition at line 340 of file BoundedField.cc.

340 {
341 applyToImage(*this, img, Multiply(), overlapOnly, 1, 1);
342}

◆ operator!=()

bool lsst::afw::math::BoundedField::operator!= ( BoundedField const & rhs) const
inlineinherited

BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.

Definition at line 206 of file BoundedField.h.

206{ return !(*this == rhs); };

◆ operator*()

std::shared_ptr< afw::math::BoundedField > lsst::meas::algorithms::CoaddBoundedField::operator* ( double const scale) const
overridevirtual

Return a scaled BoundedField.

Parameters
[in]scaleScaling factor

Implements lsst::afw::math::BoundedField.

Definition at line 254 of file CoaddBoundedField.cc.

254 {
255 throw LSST_EXCEPT(pex::exceptions::NotFoundError, "Scaling of CoaddBoundedField is not implemented");
256}

◆ operator/()

std::shared_ptr< BoundedField > lsst::afw::math::BoundedField::operator/ ( double scale) const
inlineinherited

Definition at line 201 of file BoundedField.h.

201{ return (*this) * (1.0 / scale); }
scale(algorithm, min, max=None, frame=None)
Definition ds9.py:108

◆ operator==() [1/2]

virtual bool lsst::afw::math::BoundedField::operator== ( BoundedField const & rhs) const
pure virtualinherited

BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.

Implemented in lsst::afw::math::ChebyshevBoundedField, lsst::afw::math::PixelAreaBoundedField, lsst::afw::math::ProductBoundedField, and lsst::afw::math::TransformBoundedField.

◆ operator==() [2/2]

bool lsst::meas::algorithms::CoaddBoundedField::operator== ( BoundedField const & rhs) const
override

BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.

Definition at line 258 of file CoaddBoundedField.cc.

258 {
259 auto rhsCasted = dynamic_cast<CoaddBoundedField const*>(&rhs);
260 if (!rhsCasted) return false;
261
262 return (getBBox() == rhsCasted->getBBox()) && (_default == rhsCasted->_default) &&
263 ptrEquals(_coaddWcs, rhsCasted->_coaddWcs) && (_elements == rhsCasted->_elements);
264}
lsst::geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
CoaddBoundedField(geom::Box2I const &bbox, std::shared_ptr< afw::geom::SkyWcs const > coaddWcs, ElementVector const &elements)

◆ readFits() [1/6]

static std::shared_ptr< BoundedField > lsst::afw::table::io::PersistableFacade< BoundedField >::readFits ( fits::Fits & fitsfile)
inlinestaticinherited

Read an object from an already open FITS object.

Parameters
[in]fitsfileFITS object to read from, already positioned at the desired HDU.

Definition at line 183 of file Persistable.h.

183 {
185 }
static std::shared_ptr< BoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)

◆ readFits() [2/6]

static std::shared_ptr< BoundedField > lsst::afw::table::io::PersistableFacade< BoundedField >::readFits ( fits::MemFileManager & manager,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a FITS file in memory.

Parameters
[in]managerManager for the memory to read from.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 205 of file Persistable.h.

205 {
207 }

◆ readFits() [3/6]

static std::shared_ptr< BoundedField > lsst::afw::table::io::PersistableFacade< BoundedField >::readFits ( std::string const & fileName,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a regular FITS file.

Parameters
[in]fileNameName of the file to read.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 194 of file Persistable.h.

194 {
196 }

◆ readFits() [4/6]

Read an object from an already open FITS object.

Parameters
[in]fitsfileFITS object to read from, already positioned at the desired HDU.

Definition at line 183 of file Persistable.h.

183 {
185 }

◆ readFits() [5/6]

Read an object from a FITS file in memory.

Parameters
[in]managerManager for the memory to read from.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 205 of file Persistable.h.

205 {
207 }

◆ readFits() [6/6]

static std::shared_ptr< CoaddBoundedField > lsst::afw::table::io::PersistableFacade< CoaddBoundedField >::readFits ( std::string const & fileName,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a regular FITS file.

Parameters
[in]fileNameName of the file to read.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 194 of file Persistable.h.

194 {
196 }

◆ toString()

std::string lsst::meas::algorithms::CoaddBoundedField::toString ( ) const
inlineoverrideprivatevirtual

Implements lsst::afw::math::BoundedField.

Definition at line 115 of file CoaddBoundedField.h.

115 {
116 std::ostringstream os;
117 os << "CoaddBoundedField with " << _elements.size() << " elements, default " << _default;
118 return os.str();
119 }
T str(T... args)

◆ write()

void lsst::meas::algorithms::CoaddBoundedField::write ( OutputArchiveHandle & handle) const
overrideprotectedvirtual

Write the object to one or more catalogs.

The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 233 of file CoaddBoundedField.cc.

233 {
234 CoaddBoundedFieldPersistenceKeys1 const& keys1 = CoaddBoundedFieldPersistenceKeys1::get();
235 CoaddBoundedFieldPersistenceKeys2 const& keys2 = CoaddBoundedFieldPersistenceKeys2::get();
236 afw::table::BaseCatalog cat1 = handle.makeCatalog(keys1.schema);
237 std::shared_ptr<afw::table::BaseRecord> record1 = cat1.addNew();
238 record1->set(keys1.bboxMin, getBBox().getMin());
239 record1->set(keys1.bboxMax, getBBox().getMax());
240 record1->set(keys1.coaddWcs, handle.put(_coaddWcs));
241 record1->set(keys1.default_, _default);
242 handle.saveCatalog(cat1);
243 afw::table::BaseCatalog cat2 = handle.makeCatalog(keys2.schema);
244 for (ElementVector::const_iterator i = _elements.begin(); i != _elements.end(); ++i) {
245 std::shared_ptr<afw::table::BaseRecord> record2 = cat2.addNew();
246 record2->set(keys2.field, handle.put(i->field));
247 record2->set(keys2.wcs, handle.put(i->wcs));
248 record2->set(keys2.validPolygon, handle.put(i->validPolygon));
249 record2->set(keys2.weight, i->weight);
250 }
251 handle.saveCatalog(cat2);
252}
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition Catalog.h:489
CatalogT< BaseRecord > BaseCatalog
Definition fwd.h:72

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits & fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.

18 {
19 OutputArchive archive;
20 archive.put(this);
21 archive.writeFits(fitsfile);
22}

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager & manager,
std::string const & mode = "w" ) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 29 of file Persistable.cc.

29 {
30 fits::Fits fitsfile(manager, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
31 writeFits(fitsfile);
32}
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const & fileName,
std::string const & mode = "w" ) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 24 of file Persistable.cc.

24 {
25 fits::Fits fitsfile(fileName, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
26 writeFits(fitsfile);
27}

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