Class BoundedField

Inheritance Relationships

Base Types

Derived Types

Class Documentation

class BoundedField : public lsst::afw::table::io::PersistableFacade<BoundedField>, public lsst::afw::table::io::Persistable

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.

Subclassed by lsst::afw::math::ChebyshevBoundedField, lsst::afw::math::PixelAreaBoundedField, lsst::afw::math::ProductBoundedField, lsst::afw::math::TransformBoundedField, lsst::meas::algorithms::CoaddBoundedField

Public Functions

virtual double evaluate(lsst::geom::Point2D const &position) const = 0

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.

double evaluate(double x, double y) const

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.

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

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

Return

an array of output values, same shape as x and y

Parameters
  • [in] x: array of x coordinates, same shape as y

  • [in] y: array of y coordinates, same shape as x

virtual double integrate() const

Compute the integral of this function over its bounding-box.

Return

The value of the integral.

virtual double mean() const

Compute the mean of this function over its bounding-box.

Return

The value of the mean.

lsst::geom::Box2I getBBox() const

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.

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.

Parameters
  • [out] image: Image to fill.

  • [in] overlapOnly: If true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().

  • [in] xStep: Distance between grid points in X to evaluate; values between grid points will be linearly interpolated.

  • [in] yStep: Distance between grid points in Y to evaluate; values between grid points will be linearly interpolated.

Exceptions
  • pex::exceptions::RuntimeError: if the bounding boxes do not overlap and overlapOnly=false.

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

Parameters
  • [out] image: Image to add to.

  • [in] scaleBy: Multiply the field by this before adding it to the image.

  • [in] overlapOnly: If true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().

  • [in] xStep: Distance between grid points in X to evaluate; values between grid points will be linearly interpolated.

  • [in] yStep: Distance between grid points in Y to evaluate; values between grid points will be linearly interpolated.

Exceptions
  • pex::exceptions::RuntimeError: if the bounding boxes do not overlap and overlapOnly=false.

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.

Parameters
  • [out] image: Image to fill.

  • [in] overlapOnly: If true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().

  • [in] xStep: Distance between grid points in X to evaluate; values between grid points will be linearly interpolated.

  • [in] yStep: Distance between grid points in Y to evaluate; values between grid points will be linearly interpolated.

Exceptions
  • pex::exceptions::RuntimeError: if the bounding boxes do not overlap and overlapOnly=false.

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.

Parameters
  • [out] image: Image to fill.

  • [in] overlapOnly: If true, only modify the region in the intersection of image.getBBox(image::PARENT) and this->getBBox().

  • [in] xStep: Distance between grid points in X to evaluate; values between grid points will be linearly interpolated.

  • [in] yStep: Distance between grid points in Y to evaluate; values between grid points will be linearly interpolated.

Exceptions
  • pex::exceptions::RuntimeError: if the bounding boxes do not overlap and overlapOnly=false.

virtual std::shared_ptr<BoundedField> operator*(double const scale) const = 0

Return a scaled BoundedField

Parameters
  • [in] scale: Scaling factor

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()
BoundedField(BoundedField const&)
BoundedField(BoundedField&&)
BoundedField &operator=(BoundedField const&)
BoundedField &operator=(BoundedField&&)

Protected Functions

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

Friends

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