LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
|
Fit an lsst::afw::math::Function1 object to a set of data points in one dimension. More...
#include <LeastSqFitter1d.h>
Public Member Functions | |
LeastSqFitter1d (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &s, unsigned int order) | |
Eigen::VectorXd | getParams () |
Return the best fit parameters as an Eigen::Matrix. More... | |
Eigen::VectorXd | getErrors () |
Return the 1 sigma uncertainties in the best fit parameters as an Eigen::Matrix. More... | |
FittingFunc | getBestFitFunction () |
Return the best fit polynomial as a lsst::afw::math::Function1 object. More... | |
double | valueAt (double x) |
Calculate the value of the function at a given point. More... | |
std::vector< double > | residuals () |
double | getChiSq () |
Return a measure of the goodness of fit.
\[ \chi_r^2 = \sum \left( \frac{y_i - f(x_i)}{s} \right)^2 \] . More... | |
double | getReducedChiSq () |
Return a measure of the goodness of fit.
\[ \chi_r^2 = \sum \left( \frac{y_i - f(x_i)}{s} \right)^2 \div (N-p) \] Where \( N \) is the number of data points, and \( p \) is the number of parameters in the fit. More... | |
Private Member Functions | |
void | initFunctions () |
double | func1d (double value, int exponent) |
Private Attributes | |
std::vector< double > | _x |
std::vector< double > | _y |
std::vector< double > | _s |
int | _order |
int | _nData |
Eigen::JacobiSVD< Eigen::MatrixXd > | _svd |
Eigen::VectorXd | _par |
std::vector< boost::shared_ptr < FittingFunc > > | _funcArray |
Fit an lsst::afw::math::Function1 object to a set of data points in one dimension.
The class is templated over the kind of object to fit.
Input is a list of x ordinates for a set of points, the y coordinate, and the uncertainties, s. order is order of the polynomial to fit (e.g if the templated function is lsst::afw::math::PolynomialFunction1, then order=3 => fit a function of the form \(ax^2+bx+c\)
FittingFunc | The 1d function to fit in both dimensions. Must inherit from lsst::afw::math::Function1 |
x | Ordinate of points to fit |
y | Co-ordinate of pionts to fit |
s | 1 \(\sigma\) uncertainties in z |
order | Polynomial order to fit |
Definition at line 69 of file LeastSqFitter1d.h.
lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::LeastSqFitter1d | ( | const std::vector< double > & | x, |
const std::vector< double > & | y, | ||
const std::vector< double > & | s, | ||
unsigned int | order | ||
) |
Fit a 1d polynomial to a set of data points z(x, y)
FittingFunc | The type of function to fit. This function extends the base class of lsst::afw::math::Function1 |
x | vector of x positions of data |
y | vector of y positions of data |
s | Vector of measured uncertainties in the values of z |
order | Order of 2d function to fit |
Definition at line 110 of file LeastSqFitter1d.h.
|
private |
Definition at line 254 of file LeastSqFitter1d.h.
FittingFunc lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::getBestFitFunction | ( | ) |
Return the best fit polynomial as a lsst::afw::math::Function1 object.
Definition at line 170 of file LeastSqFitter1d.h.
double lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::getChiSq | ( | ) |
Return a measure of the goodness of fit.
\[ \chi_r^2 = \sum \left( \frac{y_i - f(x_i)}{s} \right)^2 \]
.
Definition at line 211 of file LeastSqFitter1d.h.
Eigen::VectorXd lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::getErrors | ( | ) |
Return the 1 sigma uncertainties in the best fit parameters as an Eigen::Matrix.
Definition at line 158 of file LeastSqFitter1d.h.
Eigen::VectorXd lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::getParams | ( | ) |
Return the best fit parameters as an Eigen::Matrix.
Definition at line 147 of file LeastSqFitter1d.h.
double lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::getReducedChiSq | ( | ) |
Return a measure of the goodness of fit.
\[ \chi_r^2 = \sum \left( \frac{y_i - f(x_i)}{s} \right)^2 \div (N-p) \]
Where \( N \) is the number of data points, and \( p \) is the number of parameters in the fit.
Definition at line 230 of file LeastSqFitter1d.h.
|
private |
Initialise the array of functions. _funcArray[i] is a object of type math::Function1 of order _norder
Definition at line 238 of file LeastSqFitter1d.h.
std::vector< double > lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::residuals | ( | ) |
Return a vector of residuals of the fit (i.e the difference between the input y values, and the value of the fitting function at that point.
Definition at line 194 of file LeastSqFitter1d.h.
double lsst::meas.astrom.sip::LeastSqFitter1d< FittingFunc >::valueAt | ( | double | x | ) |
Calculate the value of the function at a given point.
Definition at line 184 of file LeastSqFitter1d.h.
|
private |
Definition at line 97 of file LeastSqFitter1d.h.
|
private |
Definition at line 92 of file LeastSqFitter1d.h.
|
private |
Definition at line 91 of file LeastSqFitter1d.h.
|
private |
Definition at line 95 of file LeastSqFitter1d.h.
|
private |
Definition at line 90 of file LeastSqFitter1d.h.
|
private |
Definition at line 94 of file LeastSqFitter1d.h.
|
private |
Definition at line 90 of file LeastSqFitter1d.h.
|
private |
Definition at line 90 of file LeastSqFitter1d.h.