LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
lsst.afw.math::BoundedField Class Referenceabstract

An abstract base class for 2-d functions defined on an integer bounding boxes. More...

#include <BoundedField.h>

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

Public Member Functions

virtual double evaluate (geom::Point2D const &position) const =0
 
double evaluate (double x, double y) const
 
ndarray::Array< double, 1, 1 > evaluate (ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y) const
 
geom::Box2I getBBox () const
 
template<typename T >
void fillImage (image::Image< T > &image, bool overlapOnly=false) const
 
template<typename T >
void addToImage (image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false) const
 
template<typename T >
void multiplyImage (image::Image< T > &image, bool overlapOnly=false) const
 
template<typename T >
void divideImage (image::Image< T > &image, bool overlapOnly=false) const
 
virtual boost::shared_ptr
< BoundedField
operator* (double const scale) const =0
 
boost::shared_ptr< BoundedFieldoperator/ (double scale) const
 
virtual ~BoundedField ()
 
- Public Member Functions inherited from lsst.afw.table.io::Persistable
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...
 
virtual bool isPersistable () const
 Return true if this particular object can be persisted using afw::table::io. More...
 
virtual ~Persistable ()
 

Protected Member Functions

 BoundedField (geom::Box2I const &bbox)
 
- Protected Member Functions inherited from lsst.afw.table.io::Persistable
virtual std::string getPersistenceName () const
 Return the unique name used to persist this object and look up its factory. More...
 
virtual std::string getPythonModule () const
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
 
virtual void write (OutputArchiveHandle &handle) const
 Write the object to one or more catalogs. More...
 
 Persistable ()
 
 Persistable (Persistable const &other)
 
void operator= (Persistable const &other)
 

Private Attributes

geom::Box2I const _bbox
 

Additional Inherited Members

- Static Public Member Functions inherited from lsst.afw.table.io::PersistableFacade< BoundedField >
static boost::shared_ptr
< BoundedField > 
readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static boost::shared_ptr
< BoundedField > 
readFits (std::string const &fileName, int hdu=0)
 Read an object from a regular FITS file. More...
 
static boost::shared_ptr
< BoundedField > 
readFits (fits::MemFileManager &manager, int hdu=0)
 Read an object from a FITS file in memory. More...
 
- Protected Types inherited from lsst.afw.table.io::Persistable
typedef io::OutputArchiveHandle OutputArchiveHandle
 

Detailed Description

An abstract base class for 2-d functions defined on an integer bounding boxes.

BoundedField provides a number of ways of accessing the function, all delegating to a single evaluate-at-a-point implementation. The base class does not mandate anything about how the field is constructed, so it's appropriate for use with e.g. model-fitting results, interpolation results points, or functions known a priori.

Usually, BoundedField will be used to represent functions that correspond to images, for quantities such as aperture corrections, photometric scaling, PSF model parameters, or backgrounds, and its bounding box will be set to match the PARENT bounding box of the image.

Definition at line 49 of file BoundedField.h.

Constructor & Destructor Documentation

virtual lsst.afw.math::BoundedField::~BoundedField ( )
inlinevirtual

Definition at line 160 of file BoundedField.h.

160 {}
lsst.afw.math::BoundedField::BoundedField ( geom::Box2I const &  bbox)
inlineexplicitprotected

Definition at line 164 of file BoundedField.h.

164 : _bbox(bbox) {}
geom::Box2I const _bbox
Definition: BoundedField.h:167

Member Function Documentation

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

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().
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 113 of file BoundedField.cc.

113  {
114  applyToImage(*this, img, ScaledAdd(scaleBy), overlapOnly);
115 }
double scaleBy
Definition: BoundedField.cc:63
template<typename T >
template void lsst.afw.math::BoundedField::divideImage ( image::Image< T > &  image,
bool  overlapOnly = false 
) const

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().
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 123 of file BoundedField.cc.

123  {
124  applyToImage(*this, img, Divide(), overlapOnly);
125 }
virtual double lsst.afw.math::BoundedField::evaluate ( geom::Point2D const &  position) const
pure virtual

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.

Implemented in lsst.afw.math::ChebyshevBoundedField, and lsst::meas::algorithms::CoaddBoundedField.

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

Evaluate the field at the given point.

This delegates to the evaluate() method that takes 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 70 of file BoundedField.h.

70 { return evaluate(geom::Point2D(x, y)); }
int y
virtual double evaluate(geom::Point2D const &position) const =0
int x
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

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.

Definition at line 30 of file BoundedField.cc.

33  {
35  for (int i = 0, n = x.getSize<0>(); i < n; ++i) {
36  out[i] = evaluate(x[i], y[i]);
37  }
38  return out;
39 }
int getSize() const
Return the size of a specific dimension.
Definition: ArrayBase.h:126
virtual double evaluate(geom::Point2D const &position) const =0
detail::SimpleInitializer< N > allocate(Vector< int, N > const &shape)
Create an expression that allocates uninitialized memory for an array.
template<typename T >
template void lsst.afw.math::BoundedField::fillImage ( image::Image< T > &  image,
bool  overlapOnly = false 
) const

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().
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 108 of file BoundedField.cc.

108  {
109  applyToImage(*this, img, Assign(), overlapOnly);
110 }
geom::Box2I lsst.afw.math::BoundedField::getBBox ( ) const
inline

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 Box2I into a Box2D.

Definition at line 95 of file BoundedField.h.

95 { return _bbox; }
geom::Box2I const _bbox
Definition: BoundedField.h:167
template<typename T >
template void lsst.afw.math::BoundedField::multiplyImage ( image::Image< T > &  image,
bool  overlapOnly = false 
) const

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().
Exceptions
pex::exceptions::RuntimeErrorif the bounding boxes do not overlap and overlapOnly=false.

Definition at line 118 of file BoundedField.cc.

118  {
119  applyToImage(*this, img, Multiply(), overlapOnly);
120 }
virtual boost::shared_ptr< BoundedField > lsst.afw.math::BoundedField::operator* ( double const  scale) const
pure virtual

Return a scaled BoundedField

Parameters
[in]scaleScaling factor

Implemented in lsst.afw.math::ChebyshevBoundedField, and lsst::meas::algorithms::CoaddBoundedField.

boost::shared_ptr< BoundedField > lsst.afw.math::BoundedField::operator/ ( double  scale) const
inline

Definition at line 156 of file BoundedField.h.

156  {
157  return (*this)*(1.0/scale);
158  }

Member Data Documentation

geom::Box2I const lsst.afw.math::BoundedField::_bbox
private

Definition at line 167 of file BoundedField.h.


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