LSST Applications g0265f82a02+c6dfa2ddaf,g1162b98a3f+b2075782a9,g2079a07aa2+1b2e822518,g2bbee38e9b+c6dfa2ddaf,g337abbeb29+c6dfa2ddaf,g3ddfee87b4+a60788ef87,g50ff169b8f+2eb0e556e8,g52b1c1532d+90ebb246c7,g555ede804d+a60788ef87,g591dd9f2cf+ba8caea58f,g5ec818987f+864ee9cddb,g858d7b2824+9ee1ab4172,g876c692160+a40945ebb7,g8a8a8dda67+90ebb246c7,g8cdfe0ae6a+4fd9e222a8,g99cad8db69+5e309b7bc6,g9ddcbc5298+a1346535a5,ga1e77700b3+df8f93165b,ga8c6da7877+aa12a14d27,gae46bcf261+c6dfa2ddaf,gb0e22166c9+8634eb87fb,gb3f2274832+d0da15e3be,gba4ed39666+1ac82b564f,gbb8dafda3b+5dfd9c994b,gbeb006f7da+97157f9740,gc28159a63d+c6dfa2ddaf,gc86a011abf+9ee1ab4172,gcf0d15dbbd+a60788ef87,gdaeeff99f8+1cafcb7cd4,gdc0c513512+9ee1ab4172,ge79ae78c31+c6dfa2ddaf,geb67518f79+ba1859f325,geb961e4c1e+f9439d1e6f,gee10cc3b42+90ebb246c7,gf1cff7945b+9ee1ab4172,w.2024.12
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Member Functions | List of all members
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 divideImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Divide an image by the field in-place.
 
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

Definition at line 62 of file CoaddBoundedField.h.

◆ ElementVector

Definition at line 63 of file CoaddBoundedField.h.

◆ 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) {}
AmpInfoBoxKey bbox
Definition Amplifier.cc:117
afw::table::Key< int > coaddWcs

◆ 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) {}
afw::table::Key< double > default_

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 264 of file BoundedField.cc.

265 {
266 applyToImage(*this, img, ScaledAdd(scaleBy), overlapOnly, xStep, yStep);
267}
double scaleBy

◆ divideImage()

template<typename T >
template 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 275 of file BoundedField.cc.

275 {
276 applyToImage(*this, img, Divide(), overlapOnly, xStep, yStep);
277}

◆ 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.

◆ 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.

◆ 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 75 of file BoundedField.h.

75{ return evaluate(lsst::geom::Point2D(x, y)); }
int y
Definition SpanSet.cc:48
virtual double evaluate(lsst::geom::Point2D const &position) const =0
Evaluate the field at the given point.

◆ evaluate() [2/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}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
T begin(T... args)
A floating-point coordinate rectangle geometry.
Definition Box.h:413
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Definition Box.cc:322
T end(T... args)

◆ evaluate() [3/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::ProductBoundedField, lsst::afw::math::TransformBoundedField, 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}

◆ 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 259 of file BoundedField.cc.

259 {
260 applyToImage(*this, img, Assign(), overlapOnly, xStep, yStep);
261}

◆ 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 112 of file BoundedField.h.

112{ 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()

template<typename T >
template 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 270 of file BoundedField.cc.

270 {
271 applyToImage(*this, img, Multiply(), overlapOnly, xStep, yStep);
272}

◆ 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 195 of file BoundedField.h.

195{ 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 190 of file BoundedField.h.

190{ 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.

◆ readFits() [1/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.

◆ readFits() [2/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.

◆ readFits() [3/6]

static std::shared_ptr< CoaddBoundedField > lsst::afw::table::io::PersistableFacade< CoaddBoundedField >::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.

◆ readFits() [4/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.

◆ readFits() [5/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.

◆ readFits() [6/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.

◆ toString()

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

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

Definition at line 115 of file CoaddBoundedField.h.

115 {
117 os << "CoaddBoundedField with " << _elements.size() << " elements, default " << _default;
118 return os.str();
119 }
std::ostream * os
Definition Schema.cc:557
T size(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}
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: