UVES Pipeline Reference Manual  5.4.0
uves_utils_wrappers.h
1 /*
2  * This file is part of the ESO UVES Pipeline
3  * Copyright (C) 2004,2005 European Southern Observatory
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
18  */
19 
20 /*
21  * $Author: amodigli $
22  * $Date: 2012-05-01 06:28:00 $
23  * $Revision: 1.67 $
24  * $Name: not supported by cvs2svn $
25  */
26 #ifndef UVES_UTILS_WRAPPERS_H
27 #define UVES_UTILS_WRAPPERS_H
28 
29 #ifdef HAVE_CONFIG_H
30 # include <config.h>
31 #endif
32 /*-----------------------------------------------------------------------------
33  Includes
34  -----------------------------------------------------------------------------*/
35 #include <uves_cpl_size.h>
36 
37 #include <uves_propertylist.h>
38 #include <irplib_utils.h>
39 
40 #include <cpl.h>
41 
42 #include <stdbool.h>
43 /*-----------------------------------------------------------------------------
44  Defines
45  -----------------------------------------------------------------------------*/
46 
47 
48 /*-----------------------------------------------------------------------------
49  Prototypes
50  -----------------------------------------------------------------------------*/
51 #define uves_sprintf(...) cpl_sprintf(__VA_ARGS__)
52 
53 cpl_image *
54 uves_image_filter_median(const cpl_image * img, const cpl_matrix * mx);
55 
56 
57 cpl_image *
58 uves_image_filter_linear(const cpl_image *img, const cpl_matrix * mx);
59 
60 
61 
62 
63 const char *uves_find_frame(const cpl_frameset *frames, const char **wanted,
64  int N, int *found, const cpl_frame **frame);
65 cpl_error_code uves_cast_image(cpl_image **image, cpl_type to_type);
66 cpl_error_code uves_crop_image(cpl_image **image, int x1, int y_1, int x2, int y2);
67 
68 cpl_error_code uves_get_property_value(const uves_propertylist *plist,
69  const char *keyword, cpl_type keywordtype,
70  void *result);
71 cpl_error_code uves_get_parameter(const cpl_parameterlist *parameters,
72  const char *context, const char *recipe_id,
73  const char *name, cpl_type type, void *value);
74 cpl_error_code uves_set_parameter(cpl_parameterlist *parameters,
75  const char *context, const char *name,
76  cpl_type type, void *value);
77 cpl_error_code uves_set_parameter_default(cpl_parameterlist *parameters,
78  const char *context,
79  const char *parname,
80  cpl_type type, void *value);
81 
82 void uves_image_reject_all(cpl_image *image);
83 
84 cpl_size uves_get_nextensions(const char *filename);
85 int uves_select_table_rows(cpl_table *t, const char *column,
86  cpl_table_select_operator operator,
87  double value);
88 int uves_erase_invalid_table_rows(cpl_table *t, const char *column);
89 int uves_erase_table_rows(cpl_table *t, const char *column,
90  cpl_table_select_operator operator,
91  double value);
92 int uves_extract_table_rows_local(cpl_table *t, const char *column,
93  cpl_table_select_operator operator, double value);
94 
95 cpl_table *uves_extract_table_rows(const cpl_table *t, const char *column,
96  cpl_table_select_operator operator,
97  double value);
98 
99 cpl_error_code
100 uves_table_sort_dfsxxxx(cpl_table *table, const uves_propertylist *reflist);
101 
102 void uves_sort_table_1(cpl_table *t, const char *column1,
103  bool reverse1);
104 void uves_sort_table_2(cpl_table *t, const char *column1,
105  const char *column2, bool reverse1,
106  bool reverse2);
107 void uves_sort_table_3(cpl_table *t, const char *column1,
108  const char *column2, const char *column3,
109  bool reverse1, bool reverse2, bool reverse3);
110 
111 
112 cpl_error_code uves_fit(const cpl_matrix *x, const cpl_matrix *sigma_x,
113  const cpl_vector *y, const cpl_vector *sigma_y,
114  cpl_vector *a, const int ia[],
115  int (*f)(const double x[], const double a[],
116  double *result),
117  int (*dfda)(const double x[], const double a[],
118  double result[]),
119  double *mse,
120  double *red_chisq,
121  cpl_matrix **covariance);
122 
123 cpl_error_code
124 uves_fit_1d(cpl_vector *x, const cpl_vector *sigma_x,
125  cpl_vector *y, const cpl_vector *sigma_y,
126  cpl_fit_mode fit_pars, bool fit_back,
127  double *x0, double *sigma, double *area, double *offset, double *slope,
128  double *mse, double *red_chisq,
129  cpl_matrix **covariance,
130  int (*f) (const double x[], const double a[], double *result),
131  int (*dfda)(const double x[], const double a[], double result[]),
132  int M);
133 
134 cpl_error_code
135 uves_fit_1d_image(const cpl_image *image, const cpl_image *noise,
136  const cpl_binary *image_badmap,
137  bool horizontal, bool fix_back, bool fit_back,
138  int xlo, int xhi, int y_0,
139  double *x0, double *sigma, double *norm, double *background,
140  double *slope,
141  double *mse, double *red_chisq,
142  cpl_matrix **covariance,
143  int (*f) (const double x[], const double a[], double *result),
144  int (*dfda)(const double x[], const double a[], double result[]),
145  int M);
146 
147 
148 void uves_propertylist_append_property(uves_propertylist *result, const cpl_property *p);
149 
150 cpl_error_code uves_table_erase_selected_dfs02356(cpl_table *t);
151 int uves_table_and_selected_invalid(cpl_table *t, const char *column);
152 
153 void uves_raise_to_median_frac(cpl_table *t, const char *column, double fraction);
154 void uves_free(const void *mem);
155 void uves_free_image(cpl_image **i);
156 void uves_free_mask(cpl_mask **m);
157 void uves_free_imagelist(cpl_imagelist **i);
158 void uves_free_table(cpl_table **t);
159 void uves_free_table_const(const cpl_table **t);
160 void uves_free_propertylist(uves_propertylist **p);
161 void uves_free_propertylist_const(const uves_propertylist **p);
162 void uves_free_property(cpl_property **p);
163 void uves_free_polynomial(cpl_polynomial **p);
164 void uves_free_matrix(cpl_matrix **m);
165 void uves_free_vector(cpl_vector **v);
166 void uves_free_bivector(cpl_bivector **b);
167 void uves_free_stats(cpl_stats **s);
168 void uves_unwrap_vector(cpl_vector **v);
169 void uves_unwrap_vector_const(const cpl_vector **v);
170 void uves_unwrap_bivector_vectors(cpl_bivector **b);
171 void uves_free_parameterlist(cpl_parameterlist **p);
172 void uves_free_frameset(cpl_frameset **f);
173 void uves_free_frame(cpl_frame **f);
174 void uves_free_array(cpl_array **a);
175 void uves_free_int(int **i);
176 void uves_free_int_const(const int **i);
177 void uves_free_float(float **f);
178 void uves_free_double(double **d);
179 void uves_free_string(char **s);
180 void uves_free_string_const(const char **s);
181 cpl_image*
182 uves_image_filter_mode(const cpl_image* b,
183  const cpl_matrix * ker,
184  cpl_filter_mode filter);
185 
186 
187 #endif
188 
189 
190 
191 
192 
193 
194 
195 
196 
197 
198 
199