30#include <gsl/gsl_errno.h>
31#include <gsl/gsl_spline.h>
33#define moo_drand() ((double)rand() / (double)RAND_MAX)
34#define moo_ensure_status(CMD, STATUS) \
35 cpl_error_ensure(((STATUS = CMD), status == CPL_ERROR_NONE), STATUS, \
36 goto moo_try_cleanup, " ")
39#define moo_try_assure(BOOL, CODE, ...) \
40 cpl_error_ensure(BOOL, CODE, goto moo_try_cleanup, __VA_ARGS__)
42#define moo_try_check(CMD, ...) \
43 cpl_error_ensure((CMD, cpl_error_get_code() == CPL_ERROR_NONE), \
44 cpl_error_get_code(), goto moo_try_cleanup, __VA_ARGS__)
51 cpl_polynomial *solution;
57} moo_tcheby_polynomial;
61 cpl_polynomial *solution;
70} moo_tcheby2d_polynomial;
74 gsl_interp_accel *acc;
105 cpl_fit_mode fit_pars,
150void moo_tcheby_polynomial_delete(moo_tcheby_polynomial *self);
151void moo_tcheby2d_polynomial_delete(moo_tcheby2d_polynomial *self);
152double moo_tcheby_polynomial_eval(moo_tcheby_polynomial *self,
double x);
154moo_tcheby2d_polynomial_eval(moo_tcheby2d_polynomial *self,
double x,
double y);
158cpl_vector *moo_hpfilter(cpl_vector *v,
double s);
161 cpl_vector *fout_errs,
163 const cpl_bivector *fref,
164 const cpl_vector *fref_errs,
165 const int *fref_qual);
175moo_sky_distance(
double alpha1,
double delta1,
double alpha2,
double delta2);
177moo_spline *moo_spline_create(cpl_bivector *data);
178double moo_spline_eval(moo_spline *self,
double data);
179void moo_spline_delete(moo_spline *self);
182 const cpl_vector *vw,
183 const cpl_vector *vy,
184 const cpl_vector *vy_err,
202 double max_error_frac,
208cpl_error_code moo_hdrl_bpm_fit_compute(
const hdrl_parameter *par,
209 const hdrl_imagelist *data,
210 const cpl_vector *sample_pos,
211 cpl_image **out_mask);
219moo_date moo_get_date_from_string(
const char *
string);
cpl_vector * moo_savgol_filter(cpl_vector *v, int window_length, int poly_order)
Apply a Savitzky-Golay filter to a vector.
double moo_sky_distance(double alpha1, double delta1, double alpha2, double delta2)
Compute sky distance (in rad)
cpl_error_code moo_gaussian_eval_inv(double y, double center, double width, double background, double area, double *x1, double *x2)
Find the x positions of the gaussian at the given y position.
cpl_size moo_table_or_selected_sequal_string(cpl_table *table, const char *name, const char *string)
Select from unselected table rows, by comparing column values with a constant.
hdrl_image * moo_image_collapse_median_create(hdrl_image *image)
Collapse row of an image using a median and compute associate error.
double moo_vector_get_min(const cpl_vector *v, int *flags)
Find minimum values in a vector using flags.
cpl_bivector * moo_bivector_filter_nan(cpl_bivector *v)
Create new bi vector with nan values filter.
double moo_gaussian_eval(double x, double center, double width, double background, double area)
Evaluate the gaussian at the given x position.
moo_tcheby_polynomial * moo_tcheby_polynomial_fit(cpl_bivector *data, int degree, double xmin, double xmax)
Computes Tchebitchev transformation of data.
cpl_mask * moo_kappa_sigma_clipping(cpl_image *sigma_img, int niter, double kappa, double cdiff, double maxfrac)
Compute mask of rejected pixels using kappa sigma algorithm.
cpl_error_code moo_gaussian_fit(cpl_bivector *points, cpl_fit_mode fit_pars, double *center, double *width, double *background, double *area)
Fit the data with a gaussian.
cpl_vector * moo_vector_filter_nan(cpl_vector *v)
Create new vector with nan values filter.
cpl_image * moo_imagelist_collapse_bitwiseor(cpl_imagelist *list, hdrl_imagelist *input)
get the QUAL resulting in a bitwise OR operation on the QUAL list
cpl_size moo_table_and_selected_sequal_string(cpl_table *table, const char *name, const char *string)
Select from unselected table rows, by comparing column values with a constant.
cpl_error_code moo_find_threshold_limits(cpl_bivector *points, double treshold, double *ymin, double *ymax)
Find threshold limits of a 1D signal.
moo_tcheby2d_polynomial * moo_tcheby2d_polynomial_fit(cpl_vector *x, int xdegree, double xmin, double xmax, cpl_vector *y, int ydegree, double ymin, double ymax, cpl_vector *l, double lmin, double lmax)
Computes Tchebitchev transformation of data.
double moo_image_get_ron(cpl_image *image, int llx, int lly, int urx, int ury, int nb_boxes, int box_hsize, double max_error_frac, int max_niter)
compute ron in a diff image using boxes
double moo_vector_get_max(const cpl_vector *v, int *flags)
Find maximum values in a vector using flags.
const char * moo_get_license(void)
Get the pipeline copyright and license.
cpl_error_code moo_fit_mul(const cpl_vector *vx, const cpl_vector *vw, const cpl_vector *vy, const cpl_vector *vy_err, double *c, double *sig_c)
This function computes the best-fit linear regression coefficient c1 of the model Y = c_1 X for the w...
cpl_error_code moo_interpolate_linear(cpl_bivector *fout, cpl_vector *fout_errs, int *fout_qual, const cpl_bivector *fref, const cpl_vector *fref_errs, const int *fref_qual)
Linear interpolation of a 1d-function.
cpl_error_code moo_tchebychev_fit(cpl_bivector *data, int *cflag, int degree, double xmin, double xmax, double ymin, double ymax)
Computes Tchebitchev transformation of data.
cpl_vector * moo_median_filter(cpl_vector *v, int winhsize)
Apply a median filter to a vector.
double moo_vector_get_dersnr(const cpl_vector *v)
This function computes the signal to noise ratio DER_SNR following the definition set forth by the Sp...
cpl_error_code moo_image_get_quartile(cpl_image *image, double *qmin, double *qmax)
compute first and last quartile from an image
double moo_vector_get_percentile(cpl_vector *v, double f)
Get percentile of input vector.
cpl_error_code moo_barycenter_fit(cpl_bivector *points, double *center, double *width)
Fit positions using weighted fluxes.
int moo_string_is_strictly_equal(const char *a, const char *b)
This function compares to string to see if the two string are stricly equal.
cpl_image * moo_compute_sigma_map(cpl_imagelist *list, cpl_imagelist *qlist, cpl_image *img)
Compute image of sigma variation.