lsst.afw gba399f52f3+9b61cfce8e
Loading...
Searching...
No Matches
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::math::ChebyshevBoundedField lsst::afw::math::PixelAreaBoundedField lsst::afw::math::ProductBoundedField lsst::afw::math::TransformBoundedField

Public Member Functions

virtual double evaluate (lsst::geom::Point2D const &position) const =0
 Evaluate the field at the given point.
double evaluate (double x, double y) const
 Evaluate the field at the given point.
virtual ndarray::Array< double, 1, 1 > evaluate (ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y) const
 Evaluate the field at multiple arbitrary points.
virtual double integrate () const
 Compute the integral of this function over its bounding-box.
virtual double mean () const
 Compute the mean of this function over its bounding-box.
lsst::geom::Box2I getBBox () const
 Return the bounding box that defines the region where the field is valid.
template<typename T>
void fillImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Assign the field to an image, overwriting values already present.
template<typename T>
void addToImage (image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Add the field or a constant multiple of it to an image in-place.
template<typename T>
void multiplyImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Multiply an image by the field in-place.
template<typename T>
void multiplyImage (image::MaskedImage< T > &image, bool overlapOnly=false) const
template<typename T>
void divideImage (image::Image< T > &image, bool overlapOnly=false, int xStep=1, int yStep=1) const
 Divide an image by the field in-place.
template<typename T>
void divideImage (image::MaskedImage< T > &image, bool overlapOnly=false) const
virtual std::shared_ptr< BoundedField > operator* (double const scale) const =0
 Return a scaled BoundedField.
std::shared_ptr< BoundedField > operator/ (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.
 ~BoundedField () override=default
 BoundedField (BoundedField const &)=default
 BoundedField (BoundedField &&)=default
BoundedField & operator= (BoundedField const &)=delete
BoundedField & operator= (BoundedField &&)=delete

Static Public Member Functions

static std::shared_ptr< BoundedField > readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object.
static std::shared_ptr< BoundedField > dynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr.

Protected Member Functions

 BoundedField (lsst::geom::Box2I const &bbox)

Private Member Functions

virtual std::string toString () const =0

Friends

std::ostream & operator<< (std::ostream &os, BoundedField const &bf)

Detailed Description

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

Integer bounding boxes (lsst::geom::Box2I) are inclusive of the end pixels (integer positions correspond to the centers of the pixels and include the entirety of those pixels). Thus a BoundedField defined on the box [x0, x1] x [y0, y1] actually covers the range [x0 - 0.5, x1 + 0.5] x [y0 - 0.5, y1 + 0.5].

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

Constructor & Destructor Documentation

◆ ~BoundedField()

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

◆ BoundedField() [1/3]

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

◆ BoundedField() [2/3]

lsst::afw::math::BoundedField::BoundedField ( BoundedField && )
default

◆ BoundedField() [3/3]

lsst::afw::math::BoundedField::BoundedField ( lsst::geom::Box2I const & bbox)
inlineexplicitprotected

Definition at line 219 of file BoundedField.h.

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

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

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

Definition at line 329 of file BoundedField.cc.

◆ divideImage() [1/2]

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

Divide an image by the field in-place.

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

Definition at line 345 of file BoundedField.cc.

◆ divideImage() [2/2]

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

Definition at line 350 of file BoundedField.cc.

◆ dynamicCast()

template std::shared_ptr< math::WarpingControl > lsst::afw::table::io::PersistableFacade< BoundedField >::dynamicCast ( std::shared_ptr< Persistable > const & ptr)
staticinherited

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
inline

Evaluate the field at the given point.

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

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

Definition at line 76 of file BoundedField.h.

◆ evaluate() [2/3]

virtual double lsst::afw::math::BoundedField::evaluate ( lsst::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, lsst::afw::math::PixelAreaBoundedField, lsst::afw::math::ProductBoundedField, and lsst::afw::math::TransformBoundedField.

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

Evaluate the field at multiple arbitrary points.

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

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

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

Definition at line 40 of file BoundedField.cc.

◆ 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

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

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

Definition at line 324 of file BoundedField.cc.

◆ getBBox()

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

Definition at line 113 of file BoundedField.h.

◆ integrate()

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

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.

◆ mean()

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

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.

◆ multiplyImage() [1/2]

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

Multiply an image by the field in-place.

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

Definition at line 335 of file BoundedField.cc.

◆ multiplyImage() [2/2]

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

Definition at line 340 of file BoundedField.cc.

◆ operator!=()

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

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

Definition at line 206 of file BoundedField.h.

◆ operator*()

virtual std::shared_ptr< BoundedField > lsst::afw::math::BoundedField::operator* ( double const scale) const
pure virtual

◆ operator/()

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

Definition at line 201 of file BoundedField.h.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

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.

◆ readFits()

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.

◆ toString()

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
BoundedField const & bf )
friend

Definition at line 214 of file BoundedField.h.


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