Class ChebyshevBoundedField¶
Defined in File ChebyshevBoundedField.h
Inheritance Relationships¶
Base Types¶
public lsst::afw::table::io::PersistableFacade< ChebyshevBoundedField >
(Template Class PersistableFacade)public lsst::afw::math::BoundedField
(Class BoundedField)
Class Documentation¶
-
class
ChebyshevBoundedField
: public lsst::afw::table::io::PersistableFacade<ChebyshevBoundedField>, public lsst::afw::math::BoundedField¶ A BoundedField based on 2-d Chebyshev polynomials of the first kind.
The 2-d Chebyshev polynomial used here is defined as:
\[ f(x,y) = \sum_i \sum_j a_{i,j} T_i(x) T_j(y) \]where \(T_n(x)\) is the n-th order Chebyshev polynomial of \(x\) and \(a_{i,j}\) is the corresponding coefficient of the (i,j) polynomial term.
ChebyshevBoundedField supports fitting to gridded and non-gridded data, as well coefficient matrices with different x- and y-order.
There is currently quite a bit of duplication of functionality between ChebyshevBoundedField, ApproximateChebyshev, and Chebyshev1Function2; the intent is that ChebyshevBoundedField will ultimately replace ApproximateChebyshev and should be preferred over Chebyshev1Function2 when the parametrization interface that is part of the Function2 class is not needed.
Public Types
-
typedef ChebyshevBoundedFieldControl
Control
¶
Public Functions
-
ChebyshevBoundedField
(lsst::geom::Box2I const &bbox, ndarray::Array<double const, 2, 2> const &coefficients)¶ Initialize the field from its bounding box an coefficients.
This constructor is mostly intended for testing purposes and persistence, but it also provides a way to initialize the object from Chebyshev coefficients derived from some external source.
Note that because the bounding box provided is always an integer bounding box, and LSST convention puts the center of each pixel at an integer, the actual floating-point domain of the Chebyshev functions is lsst::geom::Box2D(bbox), that is, the box that contains the entirety of all the pixels included in the integer bounding box.
The coefficients are ordered [y,x], so the shape is (orderY+1, orderX+1), and the arguments to the Chebyshev functions are transformed such that the region lsst::geom::Box2D(bbox) is mapped to [-1, 1]x[-1, 1].
Example:
bbox = lsst::geom::Box2I(lsst::geom::Point2I(10, 20), lsst::geom::Point2I(30, 40)); ndarray::Array<double, 2, 2> coeffs = ndarray::allocate(ndarray::makeVector(2, 2)); coeffs[0][0] = 1; coeffs[1][0] = 2; coeffs[0][1] = 3; coeffs[1][1] = 4; ndarray::Array<double, 2, 2> coeffs = ndarray::external(data); poly = ChebyshevBoundedField(bbox, coeffs);
will result in the following polynomial:
\[ f(x,y) = 1 T_0(x) T_0(y) + 2 T_0(x) T_1(y) + 3 T_1(x) T_0(y) + 4 T_1(x) T_1(y) \]
-
ChebyshevBoundedField
(ChebyshevBoundedField const&)¶
-
ChebyshevBoundedField
(ChebyshevBoundedField&&)¶
-
ChebyshevBoundedField &
operator=
(ChebyshevBoundedField const&)¶
-
ChebyshevBoundedField &
operator=
(ChebyshevBoundedField&&)¶
-
~ChebyshevBoundedField
()¶
-
ndarray::Array<double const, 2, 2>
getCoefficients
() const¶ Return the coefficient matrix.
The coefficients are ordered [y,x], so the shape is (orderY+1, orderX+1).
-
std::shared_ptr<ChebyshevBoundedField>
truncate
(Control const &ctrl) const¶ Return a new ChebyshevBoudedField with maximum orders set by the given control object.
-
std::shared_ptr<ChebyshevBoundedField>
relocate
(lsst::geom::Box2I const &bbox) const¶ Return a new ChebyshevBoundedField with domain set to the given bounding box.
Because this leaves the coefficients unchanged, it is equivalent to transforming the function by the affine transform that maps the old box to the new one.
-
double
evaluate
(lsst::geom::Point2D const &position) const¶ 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
integrate
() const¶ Compute the integral of this function over its bounding-box.
- Return
The value of the integral.
-
double
mean
() const¶ Compute the mean of this function over its bounding-box.
- Return
The value of the mean.
-
bool
isPersistable
() const¶ ChebyshevBoundedField is always persistable.
-
std::shared_ptr<BoundedField>
operator*
(double const scale) const¶ Return a scaled BoundedField
- Parameters
[in] scale
: Scaling factor
-
bool
operator==
(BoundedField const &rhs) const¶ BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.
Public Static Functions
-
static std::shared_ptr<ChebyshevBoundedField>
fit
(lsst::geom::Box2I const &bbox, ndarray::Array<double const, 1> const &x, ndarray::Array<double const, 1> const &y, ndarray::Array<double const, 1> const &z, Control const &ctrl)¶ Fit a Chebyshev approximation to non-gridded data with equal weights.
- Parameters
[in] bbox
: Integer bounding box of the resulting approximation. All given points must lie within lsst::geom::Box2D(bbox).[in] x
: Array of x coordinate values.[in] y
: Array of y coordinate values.[in] z
: Array of field values to be fit at each (x,y) point.[in] ctrl
: Specifies the orders and triangularity of the coefficient matrix.
-
static std::shared_ptr<ChebyshevBoundedField>
fit
(lsst::geom::Box2I const &bbox, ndarray::Array<double const, 1> const &x, ndarray::Array<double const, 1> const &y, ndarray::Array<double const, 1> const &z, ndarray::Array<double const, 1> const &w, Control const &ctrl)¶ Fit a Chebyshev approximation to non-gridded data with unequal weights.
- Parameters
[in] bbox
: Integer bounding box of the resulting approximation. All given points must lie within lsst::geom::Box2D(bbox).[in] x
: Array of x coordinate values.[in] y
: Array of y coordinate values.[in] z
: Array of field values to be fit at each (x,y) point.[in] w
: Array of weights for each point in the fit. For points with Gaussian noise, w = 1/sigma.[in] ctrl
: Specifies the orders and triangularity of the coefficient matrix.
Fit a Chebyshev approximation to gridded data with equal weights.
Instantiated for float and double.
- Parameters
[in] image
: The Image containing the data to fit. image.getBBox(PARENT) is used as the bounding box of the BoundedField.[in] ctrl
: Specifies the orders and triangularity of the coefficient matrix.
- Note
if the image to be fit is a binned version of the actual image the field should correspond to, call relocate() with the unbinned image’s bounding box after fitting.
Protected Functions
-
std::string
getPersistenceName
() const¶ Return the unique name used to persist this object and look up its factory.
Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.
-
std::string
getPythonModule
() const¶ 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.
-
void
write
(OutputArchiveHandle &handle) const¶ 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.
-
typedef ChebyshevBoundedFieldControl