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