lsst.meas.modelfit  15.0-4-g535e784+7
RegularizedMoments.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * This file is part of package_name.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef LSST_MEAS_MODELFIT_REGULARIZEDMOMENTS_H
26 #define LSST_MEAS_MODELFIT_REGULARIZEDMOMENTS_H
27 
28 #include <Eigen/Dense>
29 
30 namespace lsst {
31 namespace meas {
32 namespace modelfit {
33 
52 class MomentsModel {
53 public:
54  using Element = double;
55  using Moments = Eigen::Matrix<Element, 6, 1>;
56  using Jacobian = Eigen::Matrix<Element, 6, 6>;
57  using FirstMoment = Eigen::Matrix<Element, 2, 1>;
58  using SecondMoment = Eigen::Matrix<Element, 2, 2>;
59 
67  explicit MomentsModel(Moments const &W) : W(W) {}
68 
69  /*
70  * default copy and move constructors
71  */
72  MomentsModel(const MomentsModel &) = default;
73  MomentsModel(MomentsModel &&) = default;
74 
84  void setParameters(Moments const &Q);
85 
92  Moments computeValues() const;
93 
102  Jacobian computeJacobian() const;
103 
104 private:
105  // Calculates the Model evaluated at the input intrinsic moments given the specified weighted moments
106  void evaluateModel();
107 
108  // Storage variables
109  Moments W, Q, values;
110 
111  Element scalar;
112 
113  FirstMoment alpha;
114 
115  SecondMoment beta;
116 };
117 
118 // Tests for classes in anonymous name spaces
119 double constexpr DEFAULT_TEST_TOLERANCE = 1.0e-6;
120 bool testScalar(double tol = DEFAULT_TEST_TOLERANCE);
121 
122 bool testAlphaX(double tol = DEFAULT_TEST_TOLERANCE);
123 bool testAlphaY(double tol = DEFAULT_TEST_TOLERANCE);
124 
125 bool testBetaX(double tol = DEFAULT_TEST_TOLERANCE);
126 bool testBetaY(double tol = DEFAULT_TEST_TOLERANCE);
127 bool testBetaXY(double tol = DEFAULT_TEST_TOLERANCE);
128 } // namespace modelfit
129 } // namespace meas
130 } // namespace lsst
131 
132 #endif // LSST_MEAS_MODELFIT_REGULARIZEDMOMENTS_H
bool testAlphaY(double tol=DEFAULT_TEST_TOLERANCE)
bool testBetaY(double tol=DEFAULT_TEST_TOLERANCE)
Eigen::Matrix< Element, 6, 1 > Moments
Moments computeValues() const
Returns the value of the biased weighted moments given the input weight and object&#39;s intrinsic moment...
MomentsModel(Moments const &W)
Construct a MomentsModel object with a given vector of weight function moments.
Eigen::Matrix< Element, 2, 2 > SecondMoment
Eigen::Matrix< Element, 6, 6 > Jacobian
bool testAlphaX(double tol=DEFAULT_TEST_TOLERANCE)
void setParameters(Moments const &Q)
Sets the moments corresponding to the astronomical object&#39;s intrinsic moments.
double constexpr DEFAULT_TEST_TOLERANCE
bool testBetaX(double tol=DEFAULT_TEST_TOLERANCE)
A model for calculating observed shape moments and their derivatives.
Eigen::Matrix< Element, 2, 1 > FirstMoment
bool testScalar(double tol=DEFAULT_TEST_TOLERANCE)
Jacobian computeJacobian() const
Computes and returns the gradient of the model biased weighted moments along each of the intrinsic mo...
bool testBetaXY(double tol=DEFAULT_TEST_TOLERANCE)