226 #include <uves_cpl_size.h>
231 #include <uves_utils_polynomial.h>
232 #include <uves_extract_iterate.h>
233 #include <uves_extract_profile.h>
234 #include <uves_chip.h>
244 #if defined HAVE_DECL___FUNC__ && !HAVE_DECL___FUNC__
247 #define __func__ "<fct.id>"
265 #ifndef WANT_BIG_LOGFILE
266 #define WANT_BIG_LOGFILE 0
273 #ifndef WANT_TIME_MEASURE
274 #define WANT_TIME_MEASURE 0
278 #if WANT_TIME_MEASURE
279 #define UVES_TIME_START(what) uves_msg("Timing (%s, l%d) %s start", \
280 __FILE__, __LINE__, what)
281 #define UVES_TIME_END uves_msg("Timing (%s, l%d) end", \
284 #define UVES_TIME_START(what) uves_msg_debug("Timing (%s, l%d) %s start", \
285 __FILE__, __LINE__, what)
286 #define UVES_TIME_END uves_msg_debug("Timing (%s, l%d) end", \
293 #define stringify(X) #X
294 #define make_str(X) stringify(X)
298 #define TWOSQRT2LN2 2.35482004503095
301 #define M_PI 3.1415926535897932384626433832795
304 #define SPEED_OF_LIGHT 299792458
306 #define COS_DEG(x) cos(((x)/180)*M_PI)
307 #define SIN_DEG(x) sin(((x)/180)*M_PI)
308 #define ACOS_DEG(x) (acos(x)*180/M_PI)
316 const cpl_image *spectrum,
const cpl_image *sky,
317 const cpl_image *cosmic_image,
318 const uves_extract_profile *profile,
342 uves_round_double(
double x)
344 return (x >=0) ? (long)(x+0.5) : (long)(x-0.5);
358 uves_max_double(
double x,
double y)
360 return (x >=y) ? x : y;
373 uves_max_int(
int x,
int y)
375 return (x >=y) ? x : y;
389 uves_min_double(
double x,
double y)
391 return (x <=y) ? x : y;
404 uves_min_int(
int x,
int y)
406 return (x <=y) ? x : y;
422 uves_error_fraction(
double x,
double y,
double dx,
double dy)
427 return sqrt( dx*dx/(y*y) + x*x*dy*dy/(y*y*y*y) );
435 char *
uves_initialize(cpl_frameset *frames,
const cpl_parameterlist *parlist,
436 const char *recipe_id,
const char *short_descr);
437 cpl_error_code
uves_end(
const char *recipe_id,
const cpl_frameset *frames);
440 const char *bunit,
const double bscale,
441 double crval1 ,
double crval2,
442 double crpix1 ,
double crpix2,
443 double crdelt1,
double crdelt2);
449 int ncom,
enum uves_chip);
451 const cpl_image *image2,
const cpl_image *noise2,
457 const cpl_image *master_dark,
462 const char *X1,
const char *X2,
const char *Y,
464 const char *polynomial_fit,
465 const char *residual_square,
466 const char *variance_fit,
467 double *mean_squared_error,
double *red_chisq,
469 int maxdeg1,
int maxdeg2,
double min_rms,
472 const double *min_val,
473 const double *max_val,
474 int npos,
double positions[][2]);
478 const char *X1,
const char *X2,
const char *Y,
480 int degree1,
int degree2,
481 const char *polynomial_fit,
const char *residual_square,
482 const char *variance_fit,
483 double *mse,
double *red_chisq,
488 const char *X,
const char *Y,
const char *sigmaY,
490 const char *polynomial_fit,
const char *residual_square,
491 double *mean_squared_error,
const double kappa);
496 const char *column_y,
int *istart );
498 double uves_spline_hermite(
double xp,
const double *x,
const double *y,
int n,
int *istart );
500 double uves_spline_cubic(
double xp,
double *x,
float *y,
float *y2,
int n,
int *kstart );
506 const char *residual2,
512 int fibre_ID,
double fibre_offset,
int fibre_mask);
515 int uves_moffat(
const double x[],
const double a[],
double *result);
517 int uves_gauss(
const double x[],
const double a[],
double *result);
521 void uves_check_version(
void);
522 void uves_frameset_dump(cpl_frameset*
set);
535 uves_image_smooth_x(cpl_image * inp,
const int r);
537 uves_image_smooth_y(cpl_image * inp,
const int r);
540 uves_image_smooth_mean_x(cpl_image * inp,
const int r);
543 uves_image_smooth_median_x(cpl_image * inp,
const int r);
545 uves_image_smooth_fft(cpl_image * inp,
const int fx);
548 uves_ksigma_stack(
const cpl_imagelist *imlist,
double klow,
double khigh,
int kiter);
553 const cpl_table *ordertable,
555 const cpl_vector* gain_vals,
560 const cpl_table *ordertable,
562 const cpl_image* mflat);
571 const cpl_parameterlist *parameters,
572 const cpl_table *ordertable,
573 const cpl_table *linetable,
576 const int first_abs_order,
577 const int last_abs_order,
578 const int slit_size);