LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | List of all members
lsst::afw::math::TransformBoundedField Class Reference

A BoundedField based on geom::Transform<Poin2Endpoint, GenericEndpoint<1>>. More...

#include <TransformBoundedField.h>

Inheritance diagram for lsst::afw::math::TransformBoundedField:
lsst::afw::table::io::PersistableFacade< TransformBoundedField > lsst::afw::math::BoundedField lsst::afw::table::io::PersistableFacade< BoundedField > lsst::afw::table::io::Persistable

Public Types

using Transform = afw::geom::Transform< afw::geom::Point2Endpoint, afw::geom::GenericEndpoint >
 

Public Member Functions

 TransformBoundedField (lsst::geom::Box2I const &bbox, Transform const &transform)
 Create a TransformBoundedField from a bounding box and transform. More...
 
 ~TransformBoundedField () override=default
 
 TransformBoundedField (TransformBoundedField const &)=default
 
 TransformBoundedField (TransformBoundedField &&)=default
 
TransformBoundedFieldoperator= (TransformBoundedField const &)=delete
 
TransformBoundedFieldoperator= (TransformBoundedField &&)=delete
 
Transform getTransform () const
 Get the contained Transform. More...
 
double evaluate (lsst::geom::Point2D const &position) const override
 Evaluate the field at the given point. More...
 
ndarray::Array< double, 1, 1 > evaluate (ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y) const override
 Evaluate the field at the given point. More...
 
bool isPersistable () const noexcept override
 TransformBoundedField is always persistable. More...
 
std::shared_ptr< 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 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
 
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< TransformBoundedFieldreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< TransformBoundedFieldreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< TransformBoundedFieldreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory. More...
 
static std::shared_ptr< TransformBoundedFielddynamicCast (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

typedef io::OutputArchiveHandle 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

A BoundedField based on geom::Transform<Poin2Endpoint, GenericEndpoint<1>>.

TransformBoundedField supports arbitrary transforms.

Definition at line 43 of file TransformBoundedField.h.

Member Typedef Documentation

◆ OutputArchiveHandle

typedef io::OutputArchiveHandle lsst::afw::table::io::Persistable::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

◆ Transform

Definition at line 46 of file TransformBoundedField.h.

Constructor & Destructor Documentation

◆ TransformBoundedField() [1/3]

lsst::afw::math::TransformBoundedField::TransformBoundedField ( lsst::geom::Box2I const &  bbox,
Transform const &  transform 
)

Create a TransformBoundedField from a bounding box and transform.

Definition at line 46 of file TransformBoundedField.cc.

47  : BoundedField(bbox), _transform(transform) {
48  if (transform.getToEndpoint().getNAxes() != 1) {
49  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
50  "To EndPoint of transform must have 1 axis but has " +
51  std::to_string(transform.getToEndpoint().getNAxes()));
52  }
53 }
T to_string(T... args)
BoundedField(BoundedField const &)=default
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
table::Box2IKey bbox

◆ ~TransformBoundedField()

lsst::afw::math::TransformBoundedField::~TransformBoundedField ( )
overridedefault

◆ TransformBoundedField() [2/3]

lsst::afw::math::TransformBoundedField::TransformBoundedField ( TransformBoundedField const &  )
default

◆ TransformBoundedField() [3/3]

lsst::afw::math::TransformBoundedField::TransformBoundedField ( TransformBoundedField &&  )
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 18 of file Persistable.cc.

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

◆ 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 18 of file Persistable.cc.

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

◆ evaluate() [1/3]

double lsst::afw::math::TransformBoundedField::evaluate ( lsst::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 55 of file TransformBoundedField.cc.

55  {
56  return _transform.applyForward(position)[0];
57 }
ToPoint applyForward(FromPoint const &point) const
Transform one point in the forward direction ("from" to "to")
Definition: Transform.cc:79

◆ evaluate() [2/3]

ndarray::Array< double, 1, 1 > lsst::afw::math::TransformBoundedField::evaluate ( ndarray::Array< double const, 1 > const &  x,
ndarray::Array< double const, 1 > const &  y 
) 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.

Reimplemented from lsst::afw::math::BoundedField.

Definition at line 59 of file TransformBoundedField.cc.

60  {
61  if (x.getSize<0>() != y.getSize<0>()) {
62  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
63  "x length " + std::to_string(x.getSize<0>()) + "!= y length " +
64  std::to_string(x.getSize<0>()));
65  }
66 
67  // TODO if Mapping.applyForward gains support for x, y (DM-11226) then use that instead of copying data
68  int const nPoints = x.getSize<0>();
69  ndarray::Array<double, 2, 2> xy = ndarray::allocate(ndarray::makeVector(2, nPoints));
70  for (int col = 0; col < nPoints; ++col) {
71  xy[0][col] = x[col];
72  xy[1][col] = y[col];
73  }
74 
75  auto res2D = _transform.getMapping()->applyForward(xy);
76 
77  // res2D has shape 1 x N; return a 1-D view with the extra dimension stripped
78  auto resShape = ndarray::makeVector(nPoints);
79  auto resStrides = ndarray::makeVector(1);
80  return ndarray::external(res2D.getData(), resShape, resStrides, res2D);
81 }
int col
Definition: CR.cc:144
std::shared_ptr< const ast::Mapping > getMapping() const
Get the contained mapping.
Definition: Transform.h:135
T to_string(T... args)
int y
Definition: SpanSet.cc:49
double x
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ evaluate() [3/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:49
double x
virtual double evaluate(lsst::geom::Point2D const &position) const =0
Evaluate the field at the given point.

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

◆ getPersistenceName()

std::string lsst::afw::math::TransformBoundedField::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 128 of file TransformBoundedField.cc.

128  {
129  return getTransformBoundedFieldPersistenceName();
130 }

◆ getPythonModule()

std::string lsst::afw::math::TransformBoundedField::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 132 of file TransformBoundedField.cc.

132 { return "lsst.afw.math"; }

◆ getTransform()

Transform lsst::afw::math::TransformBoundedField::getTransform ( ) const
inline

Get the contained Transform.

Definition at line 61 of file TransformBoundedField.h.

61 { return _transform; }

◆ 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"); }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ isPersistable()

bool lsst::afw::math::TransformBoundedField::isPersistable ( ) const
inlineoverridevirtualnoexcept

TransformBoundedField is always persistable.

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

Definition at line 73 of file TransformBoundedField.h.

73 { 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"); }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ 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< BoundedField > lsst::afw::math::TransformBoundedField::operator* ( double const  scale) const
overridevirtual

Return a scaled BoundedField.

Parameters
[in]scaleScaling factor

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

Definition at line 143 of file TransformBoundedField.cc.

143  {
144  auto zoomMap = ast::ZoomMap(1, scale);
145  auto newMapping = getTransform().getMapping()->then(zoomMap);
146  auto newTransform = Transform(newMapping);
147  return std::make_shared<TransformBoundedField>(getBBox(), newTransform);
148 }
std::shared_ptr< const ast::Mapping > getMapping() const
Get the contained mapping.
Definition: Transform.h:135
Transform getTransform() const
Get the contained Transform.
def scale(algorithm, min, max=None, frame=None)
Definition: ds9.py:109
lsst::geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
Definition: BoundedField.h:112
afw::geom::Transform< afw::geom::Point2Endpoint, afw::geom::GenericEndpoint > Transform
A Mapping which "zooms" a set of points about the origin by multiplying all coordinate values by the ...
Definition: ZoomMap.h:45

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

◆ operator=() [1/2]

TransformBoundedField& lsst::afw::math::TransformBoundedField::operator= ( TransformBoundedField const &  )
delete

◆ operator=() [2/2]

TransformBoundedField& lsst::afw::math::TransformBoundedField::operator= ( TransformBoundedField &&  )
delete

◆ operator==()

bool lsst::afw::math::TransformBoundedField::operator== ( BoundedField const &  rhs) const
overridevirtual

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

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

Definition at line 150 of file TransformBoundedField.cc.

150  {
151  auto rhsCasted = dynamic_cast<TransformBoundedField const*>(&rhs);
152  if (!rhsCasted) return false;
153 
154  return getBBox() == rhsCasted->getBBox() &&
155  *(getTransform().getMapping()) == *(rhsCasted->getTransform().getMapping());
156 }
std::shared_ptr< const ast::Mapping > getMapping() const
Get the contained mapping.
Definition: Transform.h:135
Transform getTransform() const
Get the contained Transform.
TransformBoundedField(lsst::geom::Box2I const &bbox, Transform const &transform)
Create a TransformBoundedField from a bounding box and transform.
lsst::geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
Definition: BoundedField.h:112

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

183  {
184  return dynamicCast(Persistable::_readFits(fitsfile));
185  }
static std::shared_ptr< TransformBoundedField > 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  }
static std::shared_ptr< BoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ 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  {
195  return dynamicCast(Persistable::_readFits(fileName, hdu));
196  }
static std::shared_ptr< BoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [4/6]

static std::shared_ptr<TransformBoundedField > lsst::afw::table::io::PersistableFacade< TransformBoundedField >::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  }
static std::shared_ptr< TransformBoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [5/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  }
static std::shared_ptr< BoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ readFits() [6/6]

static std::shared_ptr<TransformBoundedField > lsst::afw::table::io::PersistableFacade< TransformBoundedField >::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  }
static std::shared_ptr< TransformBoundedField > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18

◆ write()

void lsst::afw::math::TransformBoundedField::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 134 of file TransformBoundedField.cc.

134  {
135  PersistenceHelper const keys;
136  table::BaseCatalog catalog = handle.makeCatalog(keys.schema);
137  std::shared_ptr<table::BaseRecord> record = catalog.addNew();
138  record->set(keys.bbox, getBBox());
139  record->set(keys.frameSet, formatters::stringToBytes(getTransform().writeString()));
140  handle.saveCatalog(catalog);
141 }
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:71
Transform getTransform() const
Get the contained Transform.
lsst::geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
Definition: BoundedField.h:112
ndarray::Array< std::uint8_t, 1, 1 > stringToBytes(std::string const &str)
Encode a std::string as a vector of uint8.
Definition: Utils.cc:162

◆ writeFits() [1/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 }
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() [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 ( 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 }

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