00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef UVES_UTILS_WRAPPERS_H
00027 #define UVES_UTILS_WRAPPERS_H
00028
00029 #ifdef HAVE_CONFIG_H
00030 # include <config.h>
00031 #endif
00032
00033
00034
00035
00036 #include <uves_propertylist.h>
00037 #include <irplib_utils.h>
00038
00039 #include <cpl.h>
00040
00041 #include <stdbool.h>
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define uves_sprintf(...) cpl_sprintf(__VA_ARGS__)
00051
00052 cpl_image *
00053 uves_image_filter_median(const cpl_image * img, const cpl_matrix * mx);
00054
00055
00056 cpl_image *
00057 uves_image_filter_linear(const cpl_image *img, const cpl_matrix * mx);
00058
00059
00060
00061
00062 const char *uves_find_frame(const cpl_frameset *frames, const char **wanted,
00063 int N, int *found, const cpl_frame **frame);
00064 cpl_error_code uves_cast_image(cpl_image **image, cpl_type to_type);
00065 cpl_error_code uves_crop_image(cpl_image **image, int x1, int y_1, int x2, int y2);
00066
00067 cpl_error_code uves_get_property_value(const uves_propertylist *plist,
00068 const char *keyword, cpl_type keywordtype,
00069 void *result);
00070 cpl_error_code uves_get_parameter(const cpl_parameterlist *parameters,
00071 const char *context, const char *recipe_id,
00072 const char *name, cpl_type type, void *value);
00073 cpl_error_code uves_set_parameter(cpl_parameterlist *parameters,
00074 const char *context, const char *name,
00075 cpl_type type, void *value);
00076 cpl_error_code uves_set_parameter_default(cpl_parameterlist *parameters,
00077 const char *context,
00078 const char *parname,
00079 cpl_type type, void *value);
00080
00081 void uves_image_reject_all(cpl_image *image);
00082
00083 int uves_get_nextensions(const char *filename);
00084 int uves_select_table_rows(cpl_table *t, const char *column,
00085 cpl_table_select_operator operator,
00086 double value);
00087 int uves_erase_invalid_table_rows(cpl_table *t, const char *column);
00088 int uves_erase_table_rows(cpl_table *t, const char *column,
00089 cpl_table_select_operator operator,
00090 double value);
00091 int uves_extract_table_rows_local(cpl_table *t, const char *column,
00092 cpl_table_select_operator operator, double value);
00093
00094 cpl_table *uves_extract_table_rows(const cpl_table *t, const char *column,
00095 cpl_table_select_operator operator,
00096 double value);
00097
00098 cpl_error_code
00099 uves_table_sort_dfsxxxx(cpl_table *table, const uves_propertylist *reflist);
00100
00101 void uves_sort_table_1(cpl_table *t, const char *column1,
00102 bool reverse1);
00103 void uves_sort_table_2(cpl_table *t, const char *column1,
00104 const char *column2, bool reverse1,
00105 bool reverse2);
00106 void uves_sort_table_3(cpl_table *t, const char *column1,
00107 const char *column2, const char *column3,
00108 bool reverse1, bool reverse2, bool reverse3);
00109
00110
00111 cpl_error_code uves_fit(const cpl_matrix *x, const cpl_matrix *sigma_x,
00112 const cpl_vector *y, const cpl_vector *sigma_y,
00113 cpl_vector *a, const int ia[],
00114 int (*f)(const double x[], const double a[],
00115 double *result),
00116 int (*dfda)(const double x[], const double a[],
00117 double result[]),
00118 double *mse,
00119 double *red_chisq,
00120 cpl_matrix **covariance);
00121
00122 cpl_error_code
00123 uves_fit_1d(cpl_vector *x, const cpl_vector *sigma_x,
00124 cpl_vector *y, const cpl_vector *sigma_y,
00125 cpl_fit_mode fit_pars, bool fit_back,
00126 double *x0, double *sigma, double *area, double *offset, double *slope,
00127 double *mse, double *red_chisq,
00128 cpl_matrix **covariance,
00129 int (*f) (const double x[], const double a[], double *result),
00130 int (*dfda)(const double x[], const double a[], double result[]),
00131 int M);
00132
00133 cpl_error_code
00134 uves_fit_1d_image(const cpl_image *image, const cpl_image *noise,
00135 const cpl_binary *image_badmap,
00136 bool horizontal, bool fix_back, bool fit_back,
00137 int xlo, int xhi, int y_0,
00138 double *x0, double *sigma, double *norm, double *background,
00139 double *slope,
00140 double *mse, double *red_chisq,
00141 cpl_matrix **covariance,
00142 int (*f) (const double x[], const double a[], double *result),
00143 int (*dfda)(const double x[], const double a[], double result[]),
00144 int M);
00145
00146
00147 void uves_propertylist_append_property(uves_propertylist *result, const cpl_property *p);
00148
00149 cpl_error_code uves_table_erase_selected_dfs02356(cpl_table *t);
00150 int uves_table_and_selected_invalid(cpl_table *t, const char *column);
00151
00152 void uves_raise_to_median_frac(cpl_table *t, const char *column, double fraction);
00153 void uves_free(const void *mem);
00154 void uves_free_image(cpl_image **i);
00155 void uves_free_mask(cpl_mask **m);
00156 void uves_free_imagelist(cpl_imagelist **i);
00157 void uves_free_table(cpl_table **t);
00158 void uves_free_table_const(const cpl_table **t);
00159 void uves_free_propertylist(uves_propertylist **p);
00160 void uves_free_propertylist_const(const uves_propertylist **p);
00161 void uves_free_property(cpl_property **p);
00162 void uves_free_polynomial(cpl_polynomial **p);
00163 void uves_free_matrix(cpl_matrix **m);
00164 void uves_free_vector(cpl_vector **v);
00165 void uves_free_bivector(cpl_bivector **b);
00166 void uves_free_stats(cpl_stats **s);
00167 void uves_unwrap_vector(cpl_vector **v);
00168 void uves_unwrap_vector_const(const cpl_vector **v);
00169 void uves_unwrap_bivector_vectors(cpl_bivector **b);
00170 void uves_free_parameterlist(cpl_parameterlist **p);
00171 void uves_free_frameset(cpl_frameset **f);
00172 void uves_free_frame(cpl_frame **f);
00173 void uves_free_array(cpl_array **a);
00174 void uves_free_int(int **i);
00175 void uves_free_int_const(const int **i);
00176 void uves_free_float(float **f);
00177 void uves_free_double(double **d);
00178 void uves_free_string(char **s);
00179 void uves_free_string_const(const char **s);
00180 cpl_image*
00181 uves_image_filter_mode(const cpl_image* b,
00182 const cpl_matrix * ker,
00183 cpl_filter_mode filter);
00184
00185
00186 #endif
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198