40template <
typename realT>
43template <
typename _realT>
46template <
typename _realT>
70template <
typename fitterT>
75 typedef typename fitterT::realT realT;
77 static const int nparams = fitterT::nparams;
103 static_assert( nparams == 4,
"fitAiry2D: Wrong setGuess called for platescale and/or cen-obs variable." );
119 static_assert( nparams == 5,
"fitAiry2D: Wrong setGuess called for only platescale variable." );
137 static_assert( nparams == 6,
"fitAiry2D: Wrong setGuess called for cen-obs not variable." );
147 void setArray( realT *data,
int nx,
int ny )
156 void cenObs( realT co )
219template <
typename realT>
237template <
typename _realT>
240 typedef _realT realT;
242 static const int nparams = 4;
244 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
248 size_t idx_mat, idx_dat;
261 for(
int i = 0; i < arr->
nx; i++ )
263 for(
int j = 0; j < arr->
ny; j++ )
265 idx_mat = i + j * arr->
nx;
267 r = sqrt( pow( i - p[2], 2 ) + pow( j - p[3], 2 ) );
270 static_cast<realT
>( j ),
293template <
typename _realT>
296 typedef _realT realT;
298 static const int nparams = 5;
300 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
304 size_t idx_mat, idx_dat;
318 for(
int i = 0; i < arr->
nx; i++ )
320 for(
int j = 0; j < arr->
ny; j++ )
322 idx_mat = i + j * arr->
nx;
324 r = sqrt( pow( i - p[2], 2 ) + pow( j - p[3], 2 ) );
328 static_cast<realT
>( i ),
static_cast<realT
>( j ), p[0], p[1], p[2], p[3], p[4], arr->
cenObs ) -
344template <
typename _realT>
347 typedef _realT realT;
349 static const int nparams = 6;
351 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
355 size_t idx_mat, idx_dat;
370 for(
int i = 0; i < arr->
nx; ++i )
372 for(
int j = 0; j < arr->
ny; ++j )
374 idx_mat = i + j * arr->
nx;
380 static_cast<realT
>( i ),
static_cast<realT
>( j ), p[0], p[1], p[2], p[3], p[4], p[5] ) -
394template <
typename realT>
400template <
typename realT>
406template <
typename realT>
Utilities related to the Airy pattern point spread function.
Class to manage fitting a 2D Airy pattern to data via the levmarInterface.
void setGuess(realT A0, realT A, realT x0, realT y0, realT ps)
Set the initial guess when platescale is variable, and central obscuration is fixed.
void setGuess(realT A0, realT A, realT x0, realT y0)
Set the initial guess when platescale and central obscuration are fixed.
void setGuess(realT A0, realT A, realT x0, realT y0, realT ps, realT co)
Set the initial guess when central-obscuration is variable.
int fit()
Perform the fit.
void allocate_params()
Allocate parameters array based on previous call to nParams.
realT * p
Parameter array. On input is the initial estimates. On output has the estimated solution.
int n
I: measurement vector dimension.
levmarInterface()
Default constructor.
void * adata
Pointer to possibly additional data, passed uninterpreted to func & jacf.
mx::math::fit::fitAiry2D< mx::math::fit::airy2D_obs_fitter< realT > > fitAiry2DbothFixed
Alias for the fitAiry2D type with both platescale and cen-obs fixed.
mx::math::fit::fitAiry2D< mx::math::fit::airy2D_obs_fitter_ps< realT > > fitAiry2DcenObsFixed
Alias for the fitAiry2D type with cen-obs fixed.
mx::math::fit::fitAiry2D< mx::math::fit::airy2D_obs_fitter_ps_eps< realT > > fitAiry2DnoneFixed
Alias for the fitAiry2D type with none fixed.
realT airyPattern(realT x)
The classical Airy pattern.
A c++ interface to the templatized levmar minimization routines..
levmarInterface fitter structure for the obstructed Airy pattern, including platescale.
levmarInterface fitter structure for the centrally obscured Airy pattern.
Wrapper for a native array to pass to levmarInterface, with Airy details.
size_t ny
Y dimension of the array.
realT * data
Pointer to the array.
realT cenObs
is the ratio of the circular central obscuration diameter to the diameter.
realT ps
the platescale in
size_t nx
X dimension of the array.