|
lsst.afw
13.0-73-gb2a4e38
|
A BoundedField based on 2-d Chebyshev polynomials of the first kind. More...
#include <ChebyshevBoundedField.h>
Public Types | |
| typedef ChebyshevBoundedFieldControl | Control |
Public Member Functions | |
| ChebyshevBoundedField (afw::geom::Box2I const &bbox, ndarray::Array< double const, 2, 2 > const &coefficients) | |
| Initialize the field from its bounding box an coefficients. More... | |
| ndarray::Array< double const, 2, 2 > | getCoefficients () const |
| Return the coefficient matrix. More... | |
| std::shared_ptr < ChebyshevBoundedField > | truncate (Control const &ctrl) const |
| Return a new ChebyshevBoudedField with maximum orders set by the given control object. More... | |
| std::shared_ptr < ChebyshevBoundedField > | relocate (geom::Box2I const &bbox) const |
| Return a new ChebyshevBoundedField with domain set to the given bounding box. More... | |
| virtual double | evaluate (geom::Point2D const &position) 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... | |
| virtual bool | isPersistable () const |
| ChebyshevBoundedField is always persistable. More... | |
| virtual std::shared_ptr < BoundedField > | operator* (double const scale) const |
| Return a scaled BoundedField. More... | |
| virtual bool | operator== (BoundedField const &rhs) const |
| BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal. More... | |
Public Member Functions inherited from lsst::afw::math::BoundedField | |
| double | evaluate (double x, double y) const |
| 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 |
| Evaluate the field at multiple arbitrary points. More... | |
| 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) 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) 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) const |
| Multiply an image by the field in-place. More... | |
| template<typename T > | |
| void | divideImage (image::Image< T > &image, bool overlapOnly=false) const |
| Divide an image by the field in-place. More... | |
| std::shared_ptr< BoundedField > | operator/ (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... | |
| 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 | ~Persistable () |
Static Public Member Functions | |
| static std::shared_ptr < ChebyshevBoundedField > | fit (afw::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. More... | |
| static std::shared_ptr < ChebyshevBoundedField > | fit (afw::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. More... | |
| template<typename T > | |
| static std::shared_ptr < ChebyshevBoundedField > | fit (image::Image< T > const &image, Control const &ctrl) |
| Fit a Chebyshev approximation to gridded data with equal weights. More... | |
Static Public Member Functions inherited from lsst::afw::table::io::PersistableFacade< ChebyshevBoundedField > | |
| static std::shared_ptr < ChebyshevBoundedField > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. More... | |
| static std::shared_ptr < ChebyshevBoundedField > | readFits (std::string const &fileName, int hdu=INT_MIN) |
| Read an object from a regular FITS file. More... | |
| static std::shared_ptr < ChebyshevBoundedField > | readFits (fits::MemFileManager &manager, int hdu=INT_MIN) |
| Read an object from a FITS file in memory. More... | |
Static Public Member Functions inherited from lsst::afw::table::io::PersistableFacade< BoundedField > | |
| static std::shared_ptr < BoundedField > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. More... | |
| static std::shared_ptr < BoundedField > | readFits (std::string const &fileName, int hdu=INT_MIN) |
| Read an object from a regular FITS file. More... | |
| static std::shared_ptr < BoundedField > | readFits (fits::MemFileManager &manager, int hdu=INT_MIN) |
| Read an object from a FITS file in memory. More... | |
Protected Member Functions | |
| 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... | |
Protected Member Functions inherited from lsst::afw::math::BoundedField | |
| BoundedField (geom::Box2I const &bbox) | |
Protected Member Functions inherited from lsst::afw::table::io::Persistable | |
| Persistable () | |
| Persistable (Persistable const &other) | |
| void | operator= (Persistable const &other) |
Additional Inherited Members | |
Protected Types inherited from lsst::afw::table::io::Persistable | |
| typedef io::OutputArchiveHandle | OutputArchiveHandle |
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.
Definition at line 76 of file ChebyshevBoundedField.h.
Definition at line 79 of file ChebyshevBoundedField.h.
| lsst::afw::math::ChebyshevBoundedField::ChebyshevBoundedField | ( | afw::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 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 Box2D(bbox) is mapped to [-1, 1]x[-1, 1].
Example:
bbox = geom::Box2I(geom::Point2I(10, 20), 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) \]
Definition at line 55 of file ChebyshevBoundedField.cc.
|
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.
Implements lsst::afw::math::BoundedField.
Definition at line 273 of file ChebyshevBoundedField.cc.
|
static |
Fit a Chebyshev approximation to non-gridded data with equal weights.
| [in] | bbox | Integer bounding box of the resulting approximation. All given points must lie within 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. |
Definition at line 140 of file ChebyshevBoundedField.cc.
|
static |
Fit a Chebyshev approximation to non-gridded data with unequal weights.
| [in] | bbox | Integer bounding box of the resulting approximation. All given points must lie within 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. |
Definition at line 159 of file ChebyshevBoundedField.cc.
|
static |
Fit a Chebyshev approximation to gridded data with equal weights.
| [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. |
Instantiated for float and double.
Definition at line 185 of file ChebyshevBoundedField.cc.
|
inline |
Return the coefficient matrix.
The coefficients are ordered [y,x], so the shape is (orderY+1, orderX+1).
Definition at line 174 of file ChebyshevBoundedField.h.
|
protectedvirtual |
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 357 of file ChebyshevBoundedField.cc.
|
protectedvirtual |
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 361 of file ChebyshevBoundedField.cc.
|
virtual |
Compute the integral of this function over its bounding-box.
Reimplemented from lsst::afw::math::BoundedField.
Definition at line 288 of file ChebyshevBoundedField.cc.
|
inlinevirtual |
ChebyshevBoundedField is always persistable.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 199 of file ChebyshevBoundedField.h.
|
virtual |
Compute the mean of this function over its bounding-box.
Reimplemented from lsst::afw::math::BoundedField.
Definition at line 299 of file ChebyshevBoundedField.cc.
|
virtual |
Return a scaled BoundedField.
| [in] | scale | Scaling factor |
Implements lsst::afw::math::BoundedField.
Definition at line 376 of file ChebyshevBoundedField.cc.
|
virtual |
BoundedFields (of the same sublcass) are equal if their bounding boxes and parameters are equal.
Implements lsst::afw::math::BoundedField.
Definition at line 380 of file ChebyshevBoundedField.cc.
| std::shared_ptr< ChebyshevBoundedField > lsst::afw::math::ChebyshevBoundedField::relocate | ( | 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.
Definition at line 231 of file ChebyshevBoundedField.cc.
| std::shared_ptr< ChebyshevBoundedField > lsst::afw::math::ChebyshevBoundedField::truncate | ( | Control const & | ctrl | ) | const |
Return a new ChebyshevBoudedField with maximum orders set by the given control object.
Definition at line 207 of file ChebyshevBoundedField.cc.
|
protectedvirtual |
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 363 of file ChebyshevBoundedField.cc.
1.8.5