LSST Applications g06d8191974+de063e15a7,g180d380827+d0b6459378,g2079a07aa2+86d27d4dc4,g2305ad1205+f1ae3263cc,g29320951ab+5752d78b6e,g2bbee38e9b+85cf0a37e7,g337abbeb29+85cf0a37e7,g33d1c0ed96+85cf0a37e7,g3a166c0a6a+85cf0a37e7,g3ddfee87b4+b5254b9343,g48712c4677+9ea88d309d,g487adcacf7+05f7dba17f,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+48904e3942,g64a986408d+de063e15a7,g858d7b2824+de063e15a7,g864b0138d7+33ab2bc355,g8a8a8dda67+585e252eca,g99cad8db69+4508353287,g9c22b2923f+53520f316c,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+ccb7f83a87,gc120e1dc64+6caf640b9b,gc28159a63d+85cf0a37e7,gc3e9b769f7+548c5e05a3,gcf0d15dbbd+b5254b9343,gdaeeff99f8+f9a426f77a,ge6526c86ff+515b6c9330,ge79ae78c31+85cf0a37e7,gee10cc3b42+585e252eca,gff1a9f87cc+de063e15a7,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
ShapeletFunction.h
Go to the documentation of this file.
1// -*- LSST-C++ -*-
2
3/*
4 * LSST Data Management System
5 * Copyright 2008, 2009, 2010, 2011 LSST Corporation.
6 *
7 * This product includes software developed by the
8 * LSST Project (http://www.lsst.org/).
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the LSST License Statement and
21 * the GNU General Public License along with this program. If not,
22 * see <http://www.lsstcorp.org/LegalNotices/>.
23 */
24
25#ifndef LSST_AFW_MATH_SHAPELETS_SHAPELETFUNCTION_H
26#define LSST_AFW_MATH_SHAPELETS_SHAPELETFUNCTION_H
27
28#include "ndarray.h"
32#include "lsst/geom.h"
35
36#include <list>
37
38namespace lsst { namespace shapelet {
39
40class ShapeletFunctionEvaluator;
41
66public:
67
70
72
73 static double const FLUX_FACTOR;
74
76 int getOrder() const { return _order; }
77
79 afw::geom::ellipses::Ellipse const & getEllipse() const { return _ellipse; }
80
83
85 void setEllipse(afw::geom::ellipses::Ellipse const & ellipse) { _ellipse = ellipse; }
86
88 BasisTypeEnum getBasisType() const { return _basisType; }
89
92 ConversionMatrix::convertCoefficientVector(_coefficients, _basisType, basisType, _order);
93 _basisType = basisType;
94 }
95
97 void normalize(double value=1.0);
98
100 ndarray::Array<double,1,1> const getCoefficients() { return _coefficients; }
101
103 ndarray::Array<double const,1,1> const getCoefficients() const { return _coefficients; }
104
107
109 Evaluator evaluate() const;
110
112 void shiftInPlace(geom::Extent2D const & offset) {
113 _ellipse.getCenter() += offset;
114 }
115
117 void transformInPlace(geom::AffineTransform const & transform) {
118 _ellipse.transform(transform).inPlace();
119 }
120
123
126 int order, BasisTypeEnum basisType,
127 ndarray::Array<double,1,1> const & coefficients
128 );
129
131 ShapeletFunction(int order, BasisTypeEnum basisType, double radius,
132 geom::Point2D const & center=geom::Point2D());
133
136 int order, BasisTypeEnum basisType, double radius, geom::Point2D const & center,
137 ndarray::Array<double,1,1> const & coefficients
138 );
139
142 afw::geom::ellipses::Ellipse const & ellipse);
143
146 int order, BasisTypeEnum basisType,
147 afw::geom::ellipses::Ellipse const & ellipse,
148 ndarray::Array<double const,1,1> const & coefficients
149 );
150
153
156
159
160private:
161
162 int _order;
163 BasisTypeEnum _basisType;
165 ndarray::Array<double,1,1> _coefficients;
166};
167
178public:
179
182
184 double operator()(double x, double y) const {
185 return this->operator()(geom::Point2D(x, y));
186 }
187
189 double operator()(geom::Point2D const & point) const {
190 return _normalization * _h.sumEvaluation(_coefficients, _transform(point));
191 }
192
194 double operator()(geom::Extent2D const & point) const {
195 return _normalization * _h.sumEvaluation(_coefficients, _transform(point));
196 }
197
199 ndarray::Array<double,1,1> operator()(
200 ndarray::Array<double const,1> const & x,
201 ndarray::Array<double const,1> const & y
202 ) const;
203
206 ndarray::Array<double,2,1> const & array,
207 geom::Point2I const & xy0 = geom::Point2I()
208 ) const;
209
212 addToImage(image.getArray(), image.getXY0());
213 }
214
216 double integrate() const {
217 return _h.sumIntegration(_coefficients);
218 }
219
222
224 void update(ShapeletFunction const & function);
225
227 explicit ShapeletFunctionEvaluator(ShapeletFunction const & function);
228
229private:
230
232
233 void _computeRawMoments(double & q0, Eigen::Vector2d & q1, Eigen::Matrix2d & q2) const;
234
235 double _normalization;
236 ndarray::Array<double const,1,1> _coefficients;
237 geom::AffineTransform _transform;
239};
240
244
245}} // namespace lsst::shapelet
246
247#endif // !defined(LSST_AFW_MATH_SHAPELETS_SHAPELETFUNCTION_H)
ndarray::Array< double const, 2, 2 > coefficients
int y
Definition SpanSet.cc:48
void inPlace()
Transform the ellipse in-place.
An ellipse defined by an arbitrary BaseCore and a center point.
Definition Ellipse.h:51
lsst::geom::Point2D const & getCenter() const
Return the center point.
Definition Ellipse.h:62
Transformer transform(lsst::geom::AffineTransform const &transform)
A class to represent a 2-dimensional array of pixels.
Definition Image.h:51
An affine coordinate transformation consisting of a linear transformation and an offset.
static void convertCoefficientVector(ndarray::Array< double, 1 > const &array, BasisTypeEnum input, BasisTypeEnum output, int order)
Convert a coefficient vector between basis types in-place.
A class to evaluate HERMITE shapelet-related quantities.
double sumIntegration(ndarray::Array< double const, 1 > const &coeff, int xMoment=0, int yMoment=0) const
Integrate a simple unscaled shapelet expansion.
double sumEvaluation(ndarray::Array< double const, 1 > const &coeff, double x, double y, double *dx=0, double *dy=0) const
Evaluate a simple unscaled shapelet expansion at the given point.
std::shared_ptr< ShapeletFunctionEvaluator const > ConstPtr
void addToImage(afw::image::Image< double > &image) const
Evaluate the function on the given image.
afw::geom::ellipses::Ellipse computeMoments() const
Return the unweighted dipole and quadrupole moments of the function as an ellipse.
double operator()(geom::Extent2D const &point) const
Evaluate at the given point.
double operator()(double x, double y) const
Evaluate at the given point.
double operator()(geom::Point2D const &point) const
Evaluate at the given point.
void update(ShapeletFunction const &function)
Update the evaluator from the given function.
void addToImage(ndarray::Array< double, 2, 1 > const &array, geom::Point2I const &xy0=geom::Point2I()) const
Add the function to the given image-like array.
ShapeletFunctionEvaluator(ShapeletFunction const &function)
Construct an evaluator for the given function.
std::shared_ptr< ShapeletFunctionEvaluator > Ptr
ndarray::Array< double, 1, 1 > operator()(ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y) const
Evaluate at the given points, returning a newly-allocated array.
double integrate() const
Compute the definite integral or integral moments.
A 2-d function defined by an expansion onto a Gauss-Laguerre or Gauss-Hermite basis.
Evaluator evaluate() const
Construct a helper object that can efficiently evaluate the function.
ShapeletFunction(int order, BasisTypeEnum basisType)
Construct a function with a unit-circle ellipse and set all coefficients to zero.
int getOrder() const
Return the maximum order (inclusive), either or .
ShapeletFunction(int order, BasisTypeEnum basisType, ndarray::Array< double, 1, 1 > const &coefficients)
Construct a function with a unit-circle ellipse and a deep-copied coefficient vector.
BasisTypeEnum getBasisType() const
Return the basis type (HERMITE or LAGUERRE).
ShapeletFunctionEvaluator Evaluator
afw::geom::ellipses::Ellipse const & getEllipse() const
Get the ellipse (const).
ShapeletFunction(int order, BasisTypeEnum basisType, afw::geom::ellipses::Ellipse const &ellipse)
Construct a function and set all coefficients to zero.
void changeBasisType(BasisTypeEnum basisType)
Change the basis type and convert coefficients in-place correspondingly.
ndarray::Array< double, 1, 1 > const getCoefficients()
Return the coefficient vector.
ShapeletFunction(int order, BasisTypeEnum basisType, double radius, geom::Point2D const &center, ndarray::Array< double, 1, 1 > const &coefficients)
Construct a function with a circular ellipse and a deep-copied coefficient vector.
std::shared_ptr< ShapeletFunction const > ConstPtr
ShapeletFunction(int order, BasisTypeEnum basisType, afw::geom::ellipses::Ellipse const &ellipse, ndarray::Array< double const, 1, 1 > const &coefficients)
Construct a function with a deep-copied coefficient vector.
afw::geom::ellipses::Ellipse & getEllipse()
Get the ellipse (non-const).
void shiftInPlace(geom::Extent2D const &offset)
Shift the shapelet function by shifting the basis ellipse.
ShapeletFunction convolve(ShapeletFunction const &other) const
Convolve the shapelet function.
ShapeletFunction(ShapeletFunction const &other)
Copy constructor (deep).
void setEllipse(afw::geom::ellipses::Ellipse const &ellipse)
Set the ellipse.
std::shared_ptr< ShapeletFunction > Ptr
ndarray::Array< double const, 1, 1 > const getCoefficients() const
Return the coefficient vector (const).
ShapeletFunction()
Default constructor to appease SWIG (used by std::list). Not for use by users.
void normalize(double value=1.0)
Normalize the integral of the shapelet function to the given value.
ShapeletFunction(int order, BasisTypeEnum basisType, double radius, geom::Point2D const &center=geom::Point2D())
Construct a function with a circular ellipse and set all coefficients to zero.
ShapeletFunction & operator=(ShapeletFunction const &other)
Assignment (deep).
void transformInPlace(geom::AffineTransform const &transform)
Transform the shapelet function by transforming the basis ellipse.
Constants, typedefs, and general-purpose functions for shapelets library.
table::Key< int > order