52 #ifndef __PCL_PSFFit_h
53 #define __PCL_PSFFit_h
58 #include <pcl/Diagnostics.h>
125 namespace PSFFitStatus
151 using psf_function = PSFunction::value_type;
156 using psf_fit_status = PSFFitStatus::value_type;
164 psf_function
function = PSFunction::Invalid;
166 psf_fit_status
status = PSFFitStatus::NotFitted;
212 operator bool()
const
214 return status == PSFFitStatus::FittedOk;
222 operator double()
const
235 return (i == 0) ?
c0.
x :
c0.
y;
330 double dx = k*
FWHMx()/2;
331 double dy = k*
FWHMy()/2;
356 double dx = k*
FWTMx()/2;
357 double dy = k*
FWTMy()/2;
392 static double FWHM( psf_function
function,
double sigma,
double beta = 2 )
394 PCL_PRECONDITION(
beta > 0 )
397 case PSFunction::Gaussian:
return 2.3548200450309493 * sigma;
398 case PSFunction::Moffat:
return 2 * sigma *
Sqrt(
Pow2( 1/
beta ) - 1 );
399 case PSFunction::MoffatA:
return 0.5358113941912513 * sigma;
400 case PSFunction::Moffat8:
return 0.6016900619596693 * sigma;
401 case PSFunction::Moffat6:
return 0.6998915581984769 * sigma;
402 case PSFunction::Moffat4:
return 0.8699588840921645 * sigma;
403 case PSFunction::Moffat25:
return 1.1305006161394060 * sigma;
404 case PSFunction::Moffat15:
return 1.5328418730817597 * sigma;
405 case PSFunction::Lorentzian:
return 2 * sigma;
406 case PSFunction::VariableShape:
return 2 * sigma *
Pow(
beta*0.6931471805599453, 1/
beta );
426 static double FWTM( psf_function
function,
double sigma,
double beta = 2 )
428 PCL_PRECONDITION(
beta > 0 )
431 case PSFunction::Gaussian:
return 4.291932052578694 * sigma;
432 case PSFunction::Moffat:
return 2 * sigma *
Sqrt(
Pow( 10.0, 1/
beta ) - 1 );
433 case PSFunction::MoffatA:
return 1.017694279819175 * sigma;
434 case PSFunction::Moffat8:
return 1.155026289161115 * sigma;
435 case PSFunction::Moffat6:
return 1.367917055412454 * sigma;
436 case PSFunction::Moffat4:
return 1.764402913213331 * sigma;
437 case PSFunction::Moffat25:
return 2.459175822514185 * sigma;
438 case PSFunction::Moffat15:
return 3.816589489904712 * sigma;
439 case PSFunction::Lorentzian:
return 6 * sigma;
440 case PSFunction::VariableShape:
return 2 * sigma *
Pow(
beta*2.302585092994045, 1/
beta );
466 static double Volume( psf_function
function,
double sigma_x,
double sigma_y,
double beta = 2 )
468 PCL_PRECONDITION(
beta > 0 )
469 PCL_PRECONDITION(
function != PSFunction::Lorentzian && (
function != PSFunction::Moffat ||
beta > 1) )
472 case PSFunction::Gaussian:
return 6.2831853071795862 * sigma_x*sigma_y;
473 case PSFunction::Moffat:
return 3.1415926535897931 * sigma_x*sigma_y/(
beta - 1);
474 case PSFunction::MoffatA:
return 0.3490658503988659 * sigma_x*sigma_y;
475 case PSFunction::Moffat8:
return 0.4487989505128276 * sigma_x*sigma_y;
476 case PSFunction::Moffat6:
return 0.6283185307179586 * sigma_x*sigma_y;
477 case PSFunction::Moffat4:
return 1.0471975511965976 * sigma_x*sigma_y;
478 case PSFunction::Moffat25:
return 2.0943951023931953 * sigma_x*sigma_y;
479 case PSFunction::Moffat15:
return 6.2831853071795862 * sigma_x*sigma_y;
577 psf_function
function = PSFunction::Gaussian,
bool circular =
false,
578 float betaMin = 1.0F,
float betaMax = 4.0F,
579 double tolerance = 1.0e-08,
float bkgMaxVar = 0.1F,
float growthForFlux = 1.0F );
605 operator bool()
const
623 float m_growthForFlux = 1.0F;
627 mutable float m_beta;
631 friend class PSFFitEngine;
Implements a generic, two-dimensional, shared or local image.
Generic dynamic matrix of arbitrary dimensions.
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
component y
Ordinate (vertical, or Y-axis coordinate).
A generic rectangle in the two-dimensional space.
Generic vector of arbitrary length.
Acts like a union for all types of images in PCL, with optional class-wide ownership of transported i...
Numerical Point Spread Function (PSF) fit to a source in an image.
PSFData::psf_function psf_function
PSFFit(PSFFit &&)=default
PSFFit & operator=(const PSFFit &x)=default
PSFFit(const PSFFit &)=default
PSFFit(const ImageVariant &image, const DPoint ¢er, const DRect &rect, psf_function function=PSFunction::Gaussian, bool circular=false, float betaMin=1.0F, float betaMax=4.0F, double tolerance=1.0e-08, float bkgMaxVar=0.1F, float growthForFlux=1.0F)
Complex< T1 > Pow(const Complex< T1 > &c, T2 x) noexcept
Complex< T > Sqrt(const Complex< T > &c) noexcept
constexpr T Pow2(T x) noexcept
PSFData(const PSFData &)=default
bool circular
Circular or elliptical PSF.
unsigned signalCount
Number of pixels used for signal evaluation.
PSFFitStatus::value_type psf_fit_status
DPoint q0
Centroid equatorial coordinates, when celestial=true.
String StatusText() const
double signal
Total flux above the local background, measured over the elliptical PSF region.
PSFData(PSFData &&)=default
psf_fit_status status
Status code (PSFFitStatus namespace).
PSFunction::value_type psf_function
DPoint::component component
bool celestial
True iff equatorial coordinates are available.
static double FWHM(psf_function function, double sigma, double beta=2)
void ToImage(Image &) const
double B
Local background estimate in pixel value units.
double A
Function amplitude (or estimated maximum) in pixel value units.
String FunctionName() const
double sy
Function width in pixels on the Y axis, sx >= sy.
DPoint b0
Barycenter position (initial star detection position) in image coordinates.
double sx
Function width in pixels on the X axis, sx >= sy.
double operator[](int i) const noexcept
DRect FWTMBounds(double k=1.0) const
bool HasCelestialCoordinates() const
double theta
Rotation angle of the sx axis in degrees, in the [0,180) range.
double beta
Moffat beta or shape parameter (dimensionless).
DRect Bounds(double k=1.0) const
static double Volume(psf_function function, double sigma_x, double sigma_y, double beta=2)
PSFData & operator=(const PSFData &)=default
DPoint c0
Fitted centroid position in image coordinates.
double flux
Total flux above the local background, measured over the rectangular fitting region.
static double FWTM(psf_function function, double sigma, double beta=2)