LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
LSST Data Management Base Package
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected 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. More...
 
std::shared_ptr< afw::geom::SkyWcs const > getCoaddWcs () const
 Get the coaddWcs. More...
 
double getDefault () const
 Get the default value. More...
 
ElementVector getElements () const
 Get the elements vector. More...
 
virtual bool isPersistable () const noexcept override
 Return true if the CoaddBoundedField persistable (always true). More...
 
std::shared_ptr< afw::math::BoundedFieldoperator* (double const scale) const override
 Return a scaled BoundedField. More...
 
bool operator== (BoundedField const &rhs) const override
 BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal. More...
 
double evaluate (double x, double y) const
 Evaluate the field at the given point. More...
 
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. More...
 
virtual double integrate () const
 Compute the integral of this function over its bounding-box. More...
 
virtual double mean () const
 Compute the mean of this function over its bounding-box. More...
 
lsst::geom::Box2I getBBox () const
 Return the bounding box that defines the region where the field is valid. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
bool operator!= (BoundedField const &rhs) const
 BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal. More...
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object. More...
 

Static Public Member Functions

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

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. More...
 
std::string getPythonModule () const override
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
 
void write (OutputArchiveHandle &handle) const override
 Write the object to one or more catalogs. More...
 

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
Definition: BoundedField.cc:76

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

18  {
19  auto result = std::dynamic_pointer_cast<T>(ptr);
20  if (!result) {
21  throw LSST_EXCEPT(pex::exceptions::TypeError, "Dynamic pointer cast failed");
22  }
23  return result;
24 }
py::object result
Definition: _schema.cc:429
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
uint64_t * ptr
Definition: RangeSet.cc:88

◆ 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  {
19  auto result = std::dynamic_pointer_cast<T>(ptr);
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 75 of file BoundedField.h.

75 { return evaluate(lsst::geom::Point2D(x, y)); }
double x
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 }
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)
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174

◆ 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::TransformBoundedField, lsst::afw::math::ProductBoundedField, and lsst::afw::math::PixelAreaBoundedField.

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"; }

◆ 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 86 of file CoaddBoundedField.h.

86 { 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); }
def 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::TransformBoundedField, lsst::afw::math::ProductBoundedField, lsst::afw::math::PixelAreaBoundedField, and lsst::afw::math::ChebyshevBoundedField.

◆ 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.
Definition: BoundedField.h:112
CoaddBoundedField(geom::Box2I const &bbox, std::shared_ptr< afw::geom::SkyWcs const > coaddWcs, ElementVector const &elements)

◆ readFits() [1/6]

static std::shared_ptr<CoaddBoundedField > lsst::afw::table::io::PersistableFacade< CoaddBoundedField >::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  {
184  return dynamicCast(Persistable::_readFits(fitsfile));
185  }
static std::shared_ptr< CoaddBoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

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

183  {
184  return dynamicCast(Persistable::_readFits(fitsfile));
185  }

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

205  {
206  return dynamicCast(Persistable::_readFits(manager, hdu));
207  }

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

205  {
206  return dynamicCast(Persistable::_readFits(manager, hdu));
207  }

◆ readFits() [5/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  {
195  return dynamicCast(Persistable::_readFits(fileName, hdu));
196  }

◆ 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  {
195  return dynamicCast(Persistable::_readFits(fileName, hdu));
196  }

◆ 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.
Definition: Persistable.cc:24

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