Kstars
curvefit.h
18// solver as provided the Gnu Science Library (GSL). See the comments at the start of curvefit.cpp
24// For compatibility with existing Ekos functionality a Quadratic option using the exising Ekos linear
25// least squares solver (again provided by GSL) is supported. The Quadratic and Parabola curves are
26// the same thing mathematically but Parabola uses the non-linear least squares LM solver whilst Quadratic
29// Users of CurveFitting operate on focuser position and HFR. Within CurveFitting the curve uses the more
36 typedef enum { FOCUS_QUADRATIC, FOCUS_HYPERBOLA, FOCUS_PARABOLA, FOCUS_2DGAUSSIAN, FOCUS_3DGAUSSIAN, FOCUS_PLANE } CurveFit;
107 // fitCurve takes in the vectors with the position, hfr and weight (e.g. variance in HFR) values
117 // Start and end define the x,y coordinates of a box around the star, start is top left corner, end is bottom right
119 void fitCurve3D(const T *imageBuffer, const int imageWidth, const QPair<int, int> start, const QPair<int, int> end,
131 qCDebug(KSTARS_EKOS_FOCUS) << QString("CurveFitting::fitCurve3D imageWidth=%1").arg(imageWidth);
138 qCDebug(KSTARS_EKOS_FOCUS) << QString("CurveFitting::fitCurve3D called with useWeights. Not yet implemented");
147 // The pixel reference x, y refers to the top left corner of the pizel so add 0.5 to x and y to reference the
154 m_dataPoints.push_back(i + 0.5, j + 0.5, imageBuffer[start.first + i + ((start.second + j) * imageWidth)], 1.0);
163 // Something went wrong, log an error and reset state so solver starts from scratch if called again
164 qCDebug(KSTARS_EKOS_FOCUS) << QString("CurveFitting::fitCurve3D called with curveFit=%1").arg(curveFit);
178 bool findMinMax(double expected, double minPosition, double maxPosition, double *position, double *value, CurveFit curveFit,
223 QVector<double> polynomial_fit(const double *const data_x, const double *const data_y, const int n, const int order);
225 QVector<double> hyperbola_fit(FittingGoal goal, const QVector<double> data_x, const QVector<double> data_y,
226 const QVector<double> weights, const QVector<bool> outliers, bool useWeights, const OptimisationDirection optDir);
227 QVector<double> parabola_fit(FittingGoal goal, const QVector<double> data_x, const QVector<double> data_y,
230 QVector<double> gaussian2D_fit(FittingGoal goal, const QVector<double> data_x, const QVector<double> data_y,
236 bool minimumQuadratic(double expected, double minPosition, double maxPosition, double *position, double *value);
237 bool minMaxHyperbola(double expected, double minPosition, double maxPosition, double *position, double *value,
239 bool minMaxParabola(double expected, double minPosition, double maxPosition, double *position, double *value,
241 bool minMax2DGaussian(double expected, double minPosition, double maxPosition, double *position, double *value,
246 void hypSetupParams(FittingGoal goal, gsl_multifit_nlinear_parameters *params, int *numIters, double *xtol, double *gtol,
250 void parSetupParams(FittingGoal goal, gsl_multifit_nlinear_parameters *params, int *numIters, double *xtol, double *gtol,
253 void gau2DSetupParams(FittingGoal goal, gsl_multifit_nlinear_parameters *params, int *numIters, double *xtol, double *gtol,
256 void gauSetupParams(gsl_multifit_nlinear_parameters *params, int *numIters, double *xtol, double *gtol, double *ftol);
258 void plaSetupParams(gsl_multifit_nlinear_parameters *params, int *numIters, double *xtol, double *gtol, double *ftol);
263 // Calculation engine for the R-squared which is a measure of how well the curve fits the datapoints
264 double calcR2(const QVector<double> dataPoints, const QVector<double> curvePoints, const QVector<double> scale,
280 // State variables used by the LM solver. These variables provide a way of optimising the starting
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
KIOCORE_EXPORT QString dir(const QString &fileClass)
void push_back(parameter_type value)
QString arg(Args &&... args) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Nov 6 2024 12:13:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Nov 6 2024 12:13:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.