|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Class to manage fitting a 2D Moffat to data via the levmarInterface.
Fits The Moffat Function to a 2-dimensional array of data.
This class allows for treating any of the parameters as fixed.
| fitterT | a type meeting the requirements specified in levmarInterface. |
Definition at line 61 of file fitEmpirical.hpp.
#include <math/fit/fitEmpirical.hpp>
Inheritance diagram for mx::math::fit::fitEmpirical2DGen< fitterT >:Public Member Functions | |
| void | setFixed (bool scale, bool dx, bool dy) |
| Set whether each parameter is fixed. | |
| void | setGuess (realT scale, realT dx, realT dy) |
| Set the initial guess for the empirical fit. | |
| void | setArray (const eigenImage< realT > *data, const eigenImage< realT > *ref, const eigenImage< realT > *weights) |
| Set the data aray. | |
| void | setArray (const eigenImage< realT > *data, const eigenImage< realT > *ref) |
| Set the data aray. | |
| realT | scale () |
| Get the current value of the scale factor. | |
| realT | dx () |
| Get the current value of dx, the x shift. | |
| realT | dy () |
| Get the current value of dy, the y shift. | |
Public Member Functions inherited from mx::math::fit::levmarInterface< fitterT > | |
| levmarInterface () | |
| Default constructor. | |
| levmarInterface (realT *i_p, realT *i_x, int i_m, int i_n, void *i_adata) | |
| Setup constructor. | |
| ~levmarInterface () | |
| Destructor. | |
| void | nParams (int i_m) |
| Set number of parameters, but don't allocate. | |
| int | nParams () |
| Get the current number of parameters. | |
| void | allocate_params () |
| Allocate parameters array based on previous call to nParams. | |
| void | allocate_params (int i_m) |
| Set number of parameters and allocate. | |
| void | point_params (realT *i_p) |
| Point the parameter pointer at an externally allocated array. | |
| void | point_params (realT *i_p, int i_m) |
| Point the parameter pointer at an externally allocated array. | |
| void | set_params (realT *i_p) |
| Copy parameters to the parameter array. | |
| realT * | get_params () |
| Get current pointer array address. | |
| void | set_itmax (int i_itmax) |
| Set the maximum number of iterations. | |
| int | get_itmax () |
| Get the maximum number of iterations. | |
| void | allocate_work () |
| Allocate the work and covar matrices. | |
| void | set_opts (int n, realT val) |
| Set one of the minimization options to val. | |
| void | set_opts_default (int n=-1) |
| Set one or all of the minimization options to the default. | |
| realT | get_opts (int n) |
| Get the current value of an option. | |
| int | fit () |
| Perform the fit. | |
| realT | get_initial_norm () |
| Returns the L2-norm before minimization occurs. | |
| realT | get_final_norm () |
| Returns the L2-norm at the end of the minimization. | |
| int | get_iterations () |
| Get the number of iterations taken during the minimization. | |
| int | get_reason_code () |
| Get a code specifying the reason minimization terminated. | |
| std::string | get_reason_string () |
| Get the descriptive string describing the reason minimization terminated. | |
| int | get_fevals () |
| Get the number of function evaluations during the minimization. | |
| int | get_jevals () |
| Get the number of jacobian evaluations during the minimization. | |
| int | get_nlinsys () |
| Get the number of linear system solutions during the minimization. | |
| double | get_deltaT () |
| Get the elapsed time of the fit. | |
| template<typename iosT , char comment = '#'> | |
| iosT & | dumpParameters (iosT &ios) |
| Output current parameters to a stream. | |
| template<char comment = '#'> | |
| std::ostream & | dumpParameters () |
| Dump the parameter vector to stdout. | |
| template<typename iosT , char comment = '#'> | |
| iosT & | dumpReport (iosT &ios, bool dumpParams=true) |
| Output current parameters to a stream. | |
| template<char comment = '#'> | |
| std::ostream & | dumpReport (bool dumpParams=true) |
| Dump a status report to stdout. | |
Additional Inherited Members | |
Public Attributes inherited from mx::math::fit::levmarInterface< fitterT > | |
| realT * | x |
| I: measurement vector. NULL implies a zero vector. | |
| int | n |
| I: measurement vector dimension. | |
| realT | opts [LM_OPTS_SZ] |
| Options passed to the minimization routines. See set_opts for details. | |
| realT | info [LM_INFO_SZ] |
| Information regarding the minimization. | |
| double | deltaT |
| Elapsed time of the fitting procedure. | |
| realT * | work |
| Working memory passed to the levmar routines. | |
| int | work_sz |
| The current size of the work array. | |
| realT * | covar |
| Covariance matrix corresponding to LS solution; mxm. | |
| int | covar_sz |
| The current size of the covar array. | |
| bool | getCovar |
| Controls whether the covar array is allocated. | |
| void * | adata |
| Pointer to possibly additional data, passed uninterpreted to func & jacf. | |
Protected Attributes inherited from mx::math::fit::levmarInterface< fitterT > | |
| realT * | p |
| Parameter array. On input is the initial estimates. On output has the estimated solution. | |
| realT * | init_p |
| Parameter array on input, saved for comparison. | |
| int | m |
| Parameter vector dimension (i.e. number of unknowns) | |
| bool | own_p |
| Flag indicating whether the p array is owned by this object (for de-allocation). | |
| int | itmax |
| Maximum number of iterations, default is 100. | |
|
inline |
Get the current value of dx, the x shift.
Definition at line 141 of file fitEmpirical.hpp.
References mx::math::fit::levmarInterface< fitterT >::p.
Referenced by mx::math::fit::fitEmpirical2DGen< fitterT >::setFixed().
|
inline |
Get the current value of dy, the y shift.
Definition at line 150 of file fitEmpirical.hpp.
References mx::math::fit::levmarInterface< fitterT >::p.
Referenced by mx::math::fit::fitEmpirical2DGen< fitterT >::setFixed().
|
inline |
Get the current value of the scale factor.
Definition at line 132 of file fitEmpirical.hpp.
References mx::math::fit::levmarInterface< fitterT >::p.
Referenced by mx::math::fit::fitEmpirical2DGen< fitterT >::setFixed().
|
inline |
Set the data aray.
| [in] | data | pointer to an nx X ny array of data to be fit |
| [in] | ref | pointer to the empirical function to fit |
Definition at line 121 of file fitEmpirical.hpp.
References mx::math::fit::fitEmpirical2DGen< fitterT >::setArray(), and mx::math::six_fifths().
|
inline |
Set the data aray.
| [in] | data | pointer to an nx X ny array of data to be fit |
| [in] | ref | pointer to the empirical function to fit |
Definition at line 110 of file fitEmpirical.hpp.
References mx::math::fit::array2FitEmpirical< realT >::m_nx, mx::math::fit::array2FitEmpirical< realT >::m_ny, mx::math::fit::levmarInterface< fitterT >::n, and mx::math::six_fifths().
Referenced by mx::math::fit::fitEmpirical2DGen< fitterT >::setArray().
|
inline |
Set whether each parameter is fixed.
Sets the parameter indices appropriately.
| [in] | scale | if true, then scale will be not be part of the fit |
| [in] | dx | if true, then dx will be not be part of the fit |
| [in] | dy | if true, then dy will be not be part of the fit |
Definition at line 89 of file fitEmpirical.hpp.
References mx::math::fit::levmarInterface< fitterT >::allocate_params(), mx::math::fit::fitEmpirical2DGen< fitterT >::dx(), mx::math::fit::fitEmpirical2DGen< fitterT >::dy(), mx::math::fit::fitEmpirical2DGen< fitterT >::scale(), and mx::math::fit::array2FitEmpirical< realT >::setFixed().
|
inline |
Set the initial guess for the empirical fit.
| [in] | scale | the scale factr |
| [in] | dx | the x shift |
| [in] | dy | the y shift |
Definition at line 99 of file fitEmpirical.hpp.
References mx::math::fit::levmarInterface< fitterT >::p.