9 #include <gsl/gsl_fit.h>
10 #include <gsl/gsl_vector.h>
11 #include <gsl/gsl_matrix.h>
12 #include <gsl/gsl_multifit.h>
18 const QString getGuideStatusString(GuideState state,
bool translated)
20 return translated ?
i18n(guideStates[state]) : guideStates[state];
24 return translated ?
i18n(captureStates[state]) : captureStates[state];
26 const QString getFocusStatusString(FocusState state,
bool translated)
28 return translated ?
i18n(focusStates[state]) : focusStates[state];
30 const QString getAlignStatusString(AlignState state,
bool translated)
32 return translated ?
i18n(alignStates[state]) : alignStates[state];
34 const QString getFilterStatusString(FilterState state,
bool translated)
36 return translated ?
i18n(filterStates[state]) : filterStates[state];
38 const QString getSchedulerStatusString(FilterState state,
bool translated)
40 return translated ?
i18n(schedulerStates[state]) : schedulerStates[state];
44 std::vector<double> gsl_polynomial_fit(
const double *
const data_x,
const double *
const data_y,
const int n,
45 const int order,
double &chisq)
48 std::vector<double> vc;
51 y = gsl_vector_alloc(n);
52 c = gsl_vector_alloc(order + 1);
53 X = gsl_matrix_alloc(n, order + 1);
54 cov = gsl_matrix_alloc(order + 1, order + 1);
56 for (
int i = 0; i < n; i++)
58 for (
int j = 0; j < order + 1; j++)
60 gsl_matrix_set(X, i, j, pow(data_x[i], j));
62 gsl_vector_set(y, i, data_y[i]);
66 gsl_set_error_handler_off();
68 gsl_multifit_linear_workspace *work = gsl_multifit_linear_alloc(n, order + 1);
69 status = gsl_multifit_linear(X, y, c, cov, &chisq, work);
71 if (status != GSL_SUCCESS)
73 qDebug() << Q_FUNC_INFO <<
"GSL multifit error:" << gsl_strerror(status);
77 gsl_multifit_linear_free(work);
79 for (
int i = 0; i < order + 1; i++)
81 vc.push_back(gsl_vector_get(c, i));
96 argument << static_cast<int>(source);
107 dest =
static_cast<Ekos::CommunicationStatus
>(a);
114 argument << static_cast<int>(source);
132 argument << static_cast<int>(source);
143 dest =
static_cast<Ekos::FocusState
>(a);
150 argument << static_cast<int>(source);
161 dest =
static_cast<Ekos::GuideState
>(a);
168 argument << static_cast<int>(source);
179 dest =
static_cast<Ekos::AlignState
>(a);
186 argument << static_cast<int>(source);
197 dest =
static_cast<Ekos::SchedulerState
>(a);