45template <
typename realT>
69 void setFixed(
bool I0,
bool I,
bool x0,
bool alpha,
bool beta )
113 void I0( realT *p, realT nI0 )
137 void I( realT *p, realT nI )
161 void x0( realT *p, realT nx0 )
173 realT alpha( realT *p )
175 if( m_alpha_idx < 0 )
181 return p[m_alpha_idx];
185 void alpha( realT *p, realT nalpha )
187 if( m_alpha_idx < 0 )
193 p[m_alpha_idx] = nalpha;
197 realT beta( realT *p )
205 return p[m_beta_idx];
209 void beta( realT *p, realT nbeta )
217 p[m_beta_idx] = nbeta;
247template <
typename _realT>
250 typedef _realT realT;
252 static const int nparams = 6;
254 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
258 size_t idx_mat, idx_dat;
262 realT I0 = arr->I0( p );
263 realT I = arr->I( p );
264 realT x0 = arr->x0( p );
265 realT alpha = arr->alpha( p );
266 realT beta = arr->beta( p );
270 for(
int i = 0; i < arr->
nx; ++i )
277 for(
int i = 0; i < arr->
nx; ++i )
295template <
typename _realT>
300 typedef _realT realT;
344 arr.I0( this->p,
I0 );
346 arr.x0( this->p,
x0 );
347 arr.alpha( this->p,
alpha );
348 arr.beta( this->p,
beta );
381 return arr.I0( this->p );
390 return arr.I( this->p );
399 return arr.x0( this->p );
408 return arr.alpha( this->p );
417 return arr.beta( this->p );
431template <
typename realT>
432struct array2FitMoffat;
435template <
typename _realT>
436struct moffat2D_sym_fitter;
448template <
typename fitterT>
453 typedef typename fitterT::realT realT;
498 arr.I0( this->p,
I0 );
500 arr.x0( this->p,
x0 );
501 arr.y0( this->p,
y0 );
502 arr.alpha( this->p,
alpha );
503 arr.beta( this->p,
beta );
525 return arr.I0( this->p );
534 return arr.I( this->p );
543 return arr.x0( this->p );
552 return arr.y0( this->p );
561 return arr.alpha( this->p );
570 return arr.beta( this->p );
586template <
typename realT>
604 int m_alpha_idx{ 4 };
612 void setFixed(
bool I0,
bool I,
bool x0,
bool y0,
bool alpha,
bool beta )
661 void I0( realT *p, realT nI0 )
685 void I( realT *p, realT nI )
709 void x0( realT *p, realT nx0 )
733 void y0( realT *p, realT ny0 )
745 realT alpha( realT *p )
747 if( m_alpha_idx < 0 )
753 return p[m_alpha_idx];
757 void alpha( realT *p, realT nalpha )
759 if( m_alpha_idx < 0 )
765 p[m_alpha_idx] = nalpha;
769 realT beta( realT *p )
777 return p[m_beta_idx];
781 void beta( realT *p, realT nbeta )
789 p[m_beta_idx] = nbeta;
803template <
typename _realT>
806 typedef _realT realT;
808 static const int nparams = 6;
810 static void func( realT *p, realT *hx,
int m,
int n,
void *adata )
814 size_t idx_mat, idx_dat;
818 realT I0 = arr->I0( p );
819 realT I = arr->I( p );
820 realT x0 = arr->x0( p );
821 realT y0 = arr->y0( p );
822 realT alpha = arr->alpha( p );
823 realT beta = arr->beta( p );
825 for(
int i = 0; i < arr->
nx; ++i )
827 for(
int j = 0; j < arr->
ny; ++j )
829 idx_mat = i + j * arr->
nx;
842template <
typename realT>
realT beta()
Return the shape parameter.
void setGuess(realT I0, realT I, realT x0, realT alpha, realT beta)
Set the initial guess for a symmetric Moffat.
void setArray(realT *data, realT *coords, int nx)
Set the data aray and the coordinates.
void setArray(realT *data, int nx)
Set the data aray.
realT x0()
Get the center x-.
realT alpha()
Return the width parameter.
realT I0()
Get the current value of I0, the constant.
realT fwhm()
Return the full-width at half maximum.
realT I()
Get the current value of I, the peak scaling.
void setFixed(bool I0, bool I, bool x0, bool alpha, bool beta)
Set whether each parameter is fixed.
Class to manage fitting a 2D Moffat to data via the levmarInterface.
void setFixed(bool I0, bool I, bool x0, bool y0, bool alpha, bool beta)
Set whether each parameter is fixed.
void setArray(realT *data, int nx, int ny)
Set the data aray.
void setGuess(realT I0, realT I, realT x0, realT y0, realT alpha, realT beta)
Set the initial guess for a symmetric Moffat.
realT fwhm()
Return the full-width at half maximum.
Tools for using the eigen library for image processing.
realT moffatFWHM(realT alpha, realT beta)
Compute the full-width at half-maximum of a Moffat profile.
realT moffat(const realT x, const realT I0, const realT Ipk, const realT x0, const realT alpha, const realT beta)
Find value at position (x) of the 1D arbitrarily-centered symmetric unnormalized Moffat function.
realT moffat2D(const realT x, const realT y, const realT I0, const realT Ipk, const realT x0, const realT y0, const realT alpha, const realT beta)
Find value at position (x,y) of the 2D arbitrarily-centered unnormalized symmetric Moffat function.
mx::math::fit::fitMoffat2D< mx::math::fit::moffat2D_sym_fitter< realT > > fitMoffat2Dsym
Alias for the fitMoffat2D type fitting the symmetric Moffat profile.
A c++ interface to the templatized levmar minimization routines..
Declarations for utilities related to the Moffat function.
Wrapper for a native array to pass to levmarInterface, with Moffat details.
realT * data
Pointer to the array of y values.
void setFixed(bool I0, bool I, bool x0, bool alpha, bool beta)
Set whether each parameter is fixed.
size_t nx
X dimension of the array.
realT * coords
Pointer to the array of x values (optional).
Wrapper for a native array to pass to levmarInterface, with Moffat details.
void setFixed(bool I0, bool I, bool x0, bool y0, bool alpha, bool beta)
Set whether each parameter is fixed.
size_t nx
X dimension of the array.
size_t ny
Y dimension of the array.
realT * data
Pointer to the array.
levmarInterface fitter structure for the 1D Moffat.
levmarInterface fitter structure for the symmetric Moffat.