GRAVI Pipeline Reference Manual 1.9.3
Loading...
Searching...
No Matches
gravi_cpl.h
Go to the documentation of this file.
1/* $Id: gravi_cpl.h,v 1.12 2014/11/12 06:10:40 nazouaoui Exp $
2 *
3 * This file is part of the GRAVI Pipeline
4 * Copyright (C) 2002,2003 European Southern Observatory
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef GRAVI_CPL_H_
22#define GRAVI_CPL_H_
23
24/*-----------------------------------------------------------------------------
25 Includes
26 -----------------------------------------------------------------------------*/
27
28#include <cpl.h>
29
30/*-----------------------------------------------------------------------------
31 Prototypes
32 -----------------------------------------------------------------------------*/
33
34cpl_array ** gravi_array_new_list (int n, cpl_type type, int size);
35
36double ** gravi_table_get_data_array_double (cpl_table * table, const char * name);
37float ** gravi_table_get_data_array_float (cpl_table * table, const char * name);
38float complex ** gravi_table_get_data_array_float_complex (cpl_table * table, const char * name);
39double complex ** gravi_table_get_data_array_double_complex (cpl_table * table, const char * name);
40int ** gravi_table_get_data_array_int (cpl_table * table, const char * name);
41
42double gravi_table_get_column_mean (cpl_table * table, const char * name, int base, int nbase);
43double gravi_table_get_column_flagged_mean (cpl_table * table, const char * name);
44double gravi_table_get_column_flagged_max (cpl_table * table, const char * name);
45double gravi_table_get_column_std (cpl_table * table, const char * name, int base, int nbase);
46cpl_array * gravi_table_get_column_sum_array (cpl_table * table, const char * name, int base, int nbase);
47cpl_array * gravi_table_get_column_mean_array (cpl_table * table, const char * name, int base, int nbase);
48
49#define gravi_table_get_value(table,name,row,value) cpl_array_get (cpl_table_get_array (table,name,row), value, NULL)
50#define gravi_table_set_value(table,name,row,value,val) cpl_array_set (cpl_table_get_data_array (table,name)[row], value, val);
51
52int gravi_array_threshold_min (cpl_array * array, double lo_cut);
53
54cpl_array * gravi_array_init_double (long n , double value);
55cpl_array * gravi_array_init_int (long n, int value);
56cpl_array * gravi_array_init_double_complex (long n, double complex value);
57cpl_array * gravi_array_init_float_complex (long n, float complex value);
58
59cpl_array * gravi_array_wrap_complex (cpl_array * input_re, cpl_array * input_im);
60cpl_array * gravi_array_wrap_float_complex (cpl_array * input_re, cpl_array * input_im);
61cpl_array * gravi_array_compute_norm2 (cpl_array * input_re, cpl_array * input_im);
62cpl_array * gravi_array_smooth (cpl_array * input, int nsmooth);
63cpl_array * gravi_array_rebin (const cpl_array * input, const cpl_array * errs,
64 cpl_table * oi_wave_sc, cpl_table * oi_wave_ft);
65cpl_array * gravi_array_create_inverse (cpl_array *input);
66cpl_array * gravi_array_cexp (double complex factor, const cpl_array * input);
67
68cpl_error_code gravi_array_normalize_complex (cpl_array * input);
69cpl_error_code gravi_array_phase_unwrap (cpl_array * input);
70cpl_error_code gravi_array_phase_wrap (cpl_array * input);
71cpl_error_code gravi_array_multiply_phasor (cpl_array * input, double complex factor, cpl_array * phase);
72cpl_error_code gravi_array_add_phasor (cpl_array * input, double complex factor, cpl_array * phase);
73cpl_error_code gravi_array_add_phase (cpl_array * input, double factor, cpl_array * phase);
74cpl_error_code gravi_array_multiply_conj (cpl_array * input1, cpl_array * input2);
75cpl_error_code gravi_array_add_phasors (cpl_array * input, cpl_array * add, cpl_array * sub);
76
77cpl_error_code gravi_table_set_array_double_complex (cpl_table * table, const char * name,
78 cpl_size row, cpl_array * visR, cpl_array * visI);
79cpl_error_code gravi_table_set_array_phase (cpl_table * table, const char * name,
80 cpl_size row, cpl_array * phase);
81cpl_error_code gravi_table_set_string_fixlen (cpl_table *table, const char *name,
82 int row, const char *value, int len);
83int gravi_table_are_equal (cpl_table * first, cpl_table * second);
84
85cpl_error_code gravi_table_new_column (cpl_table * table, const char * name, const char * unit, cpl_type type);
86cpl_error_code gravi_table_new_column_array (cpl_table * table, const char * name, const char * unit, cpl_type type, cpl_size size);
87cpl_error_code gravi_table_init_column_array (cpl_table * table, const char * name, const char * unit, cpl_type type, cpl_size size);
88
89cpl_error_code gravi_table_interpolate_column (cpl_table * to_table,
90 const char * to_x,
91 const char * to_y,
92 const cpl_table * from_table,
93 const char * from_x,
94 const char * from_y);
95
96cpl_error_code gravi_table_add_columns (cpl_table * oi_vis1, const char *name1,
97 cpl_table * oi_vis2, const char *name2);
98cpl_error_code gravi_table_runint_column (cpl_table * oi_vis, const char *input_name,
99 const char *output_name, int nsmooth, int nbase);
100cpl_error_code gravi_table_smooth_column (cpl_table * oi_vis, const char *input_name,
101 const char *output_name, int nsmooth, int nbase);
102
103cpl_error_code gravi_table_multiply_scalar (cpl_table * table, const char * name, int base, int nbase, double value);
104cpl_error_code gravi_table_add_scalar (cpl_table * table, const char * name, int base, int nbase, double value);
105
106cpl_array * gravi_table_create_sigma_array (cpl_table * oi_wave);
107cpl_array * gravi_table_create_wave_array (cpl_table * oi_wave);
108
109cpl_error_code gravi_array_get_group_delay_loop (cpl_array ** input,
110 cpl_array ** flag,
111 cpl_array * sigma,
112 double * gd, cpl_size nrow,
113 double max_width, int verbose);
114
115cpl_error_code gravi_table_compute_group_delay (cpl_table * table,
116 const char *input,
117 const char *flag,
118 const char *output, cpl_table * oi_wave);
119
120cpl_matrix * get_matrix_from_vector (cpl_vector * , cpl_vector * );
121
122cpl_imagelist * gravi_imagelist_from_column (cpl_table * table_data, const char * data_x);
123cpl_imagelist * gravi_imagelist_wrap_column (cpl_table * table_data, const char * data_x);
124cpl_error_code gravi_imagelist_unwrap_images (cpl_imagelist * imglist);
125double gravi_image_get_noise_window (cpl_image *img,
126 cpl_size llx, cpl_size lly,
127 cpl_size urx, cpl_size ury);
128
129cpl_vector * gravi_table_get_vector (cpl_table * , cpl_size , const char * );
130cpl_vector * gravi_table_get_vector_scalar (cpl_table * table,
131 const char * name,
132 cpl_size base,
133 cpl_size nbase);
134
135cpl_vector * gravi_table_get_vector_diff (cpl_table * spectrum_data, int index,
136 const char * regname1,
137 const char * regname2);
138
139cpl_array * gravi_array_wrap_image (cpl_image *);
140
141cpl_image * gravi_image_collapse_median_x (cpl_image * img,
142 cpl_size drop_from,
143 cpl_size drop_to);
144
145cpl_error_code gravi_image_subtract_collapse (cpl_image * img,
146 const cpl_image * collapse,
147 int direction);
148
149cpl_error_code gravi_image_subtract_window (cpl_image * img1, const cpl_image * img2,
150 cpl_size llx, cpl_size lly,
151 cpl_size urx, cpl_size ury,
152 cpl_size llx2, cpl_size lly2);
153
154cpl_error_code gravi_image_replace_window (cpl_image * img1, const cpl_image * img2,
155 cpl_size llx, cpl_size lly,
156 cpl_size urx, cpl_size ury,
157 cpl_size llx2, cpl_size lly2);
158
159cpl_error_code gravi_image_fill (cpl_image * img, double value);
160cpl_image * gravi_image_wrap_matrix (cpl_matrix * matrix);
161cpl_image * gravi_image_from_matrix (cpl_matrix * matrix);
162cpl_image * gravi_image_wrap_vector (cpl_vector * vector);
163cpl_image * gravi_image_from_vector (cpl_vector * vector);
164cpl_image * gravi_image_from_column (cpl_table * table_data, const char * data_x, cpl_size row);
165
166double gravi_image_get_quantile (const cpl_image * img, double value);
167double gravi_array_get_quantile (cpl_array * arr, double value);
168
169cpl_vector * gravi_vector_median (const cpl_vector * vector, cpl_size hw);
170cpl_error_code gravi_vector_abs (cpl_vector * vector);
171cpl_size gravi_vector_get_maxpos (cpl_vector * vector);
172cpl_vector * gravi_vector_extract (const cpl_vector * vector, int start, int step);
173cpl_error_code gravi_vector_unwrap_with_guess (cpl_vector * vector, cpl_vector * ref, double ref_to_phase);
174
175double gravi_vector_get_mean_clip (cpl_vector * vector_in,
176 double percent, double nsigma);
177
178cpl_array * gravi_table_get_column_dimension (const cpl_table * table, const char * name);
179
180cpl_matrix * gravi_matrix_interpolate_col (cpl_matrix * matrix,
181 cpl_vector * xref,
182 cpl_vector * xout);
183
184cpl_matrix * gravi_matrix_invertSV_create (cpl_matrix * a_in);
185
186cpl_table * gravi_table_extract_time_interval (cpl_table *table, double start, double end);
187
188
189#endif /* GRAVI_CPL_H_ */
190
191
cpl_array * gravi_array_init_int(long n, int value)
Definition: gravi_cpl.c:608
cpl_error_code gravi_table_set_array_double_complex(cpl_table *table, const char *name, cpl_size row, cpl_array *visR, cpl_array *visI)
Definition: gravi_cpl.c:714
cpl_array * gravi_array_smooth(cpl_array *input, int nsmooth)
Definition: gravi_cpl.c:1285
cpl_table * gravi_table_extract_time_interval(cpl_table *table, double start, double end)
Extract rows from table based on the TIME column.
Definition: gravi_cpl.c:3261
cpl_error_code gravi_table_smooth_column(cpl_table *oi_vis, const char *input_name, const char *output_name, int nsmooth, int nbase)
Definition: gravi_cpl.c:1004
cpl_error_code gravi_table_add_columns(cpl_table *oi_vis1, const char *name1, cpl_table *oi_vis2, const char *name2)
Definition: gravi_cpl.c:840
float complex ** gravi_table_get_data_array_float_complex(cpl_table *table, const char *name)
Definition: gravi_cpl.c:521
cpl_error_code gravi_table_runint_column(cpl_table *oi_vis, const char *input_name, const char *output_name, int nsmooth, int nbase)
Definition: gravi_cpl.c:911
cpl_vector * gravi_vector_extract(const cpl_vector *vector, int start, int step)
Extract part of a vector.
Definition: gravi_cpl.c:2696
double gravi_table_get_column_flagged_mean(cpl_table *table, const char *name)
Function to compute the mean of a column table with arrays.
Definition: gravi_cpl.c:217
double gravi_image_get_noise_window(cpl_image *img, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
Estimate the median noise in a window. This noise is estimated as the median{img**2}**0....
Definition: gravi_cpl.c:1839
cpl_array * gravi_array_create_inverse(cpl_array *input)
Definition: gravi_cpl.c:1071
cpl_array * gravi_table_get_column_dimension(const cpl_table *table, const char *name)
Return an array ready for cpl_table_set_column_dimension.
Definition: gravi_cpl.c:2114
double gravi_table_get_column_mean(cpl_table *table, const char *name, int base, int nbase)
Definition: gravi_cpl.c:343
cpl_image * gravi_image_wrap_matrix(cpl_matrix *matrix)
Wrap matrix into an image (data not duplicated)
Definition: gravi_cpl.c:2415
cpl_error_code gravi_table_new_column(cpl_table *table, const char *name, const char *unit, cpl_type type)
Definition: gravi_cpl.c:1656
double complex ** gravi_table_get_data_array_double_complex(cpl_table *table, const char *name)
Definition: gravi_cpl.c:546
cpl_image * gravi_image_from_vector(cpl_vector *vector)
Definition: gravi_cpl.c:2451
cpl_array * gravi_array_cexp(double complex factor, const cpl_array *input)
Compute the complex exponention of an array: cexp (factor * input)
Definition: gravi_cpl.c:1137
cpl_vector * gravi_table_get_vector_scalar(cpl_table *table, const char *name, cpl_size base, cpl_size nbase)
Definition: gravi_cpl.c:2291
cpl_vector * gravi_table_get_vector_diff(cpl_table *spectrum_data, int index, const char *regname1, const char *regname2)
Create a vector from the row index of the column regname.
Definition: gravi_cpl.c:2356
cpl_error_code gravi_table_compute_group_delay(cpl_table *table, const char *input, const char *flag, const char *output, cpl_table *oi_wave)
Definition: gravi_cpl.c:1535
cpl_array * gravi_array_init_float_complex(long n, float complex value)
Definition: gravi_cpl.c:630
cpl_image * gravi_image_from_column(cpl_table *table_data, const char *data_x, cpl_size row)
Create an image from a column array in table.
Definition: gravi_cpl.c:2052
cpl_error_code gravi_image_fill(cpl_image *img, double value)
Fill entire image with value.
Definition: gravi_cpl.c:2398
cpl_matrix * gravi_matrix_invertSV_create(cpl_matrix *a_in)
Invers a matrix with singular value decomposition.
Definition: gravi_cpl.c:2921
cpl_imagelist * gravi_imagelist_from_column(cpl_table *table_data, const char *data_x)
Create an imagelist from a column array in table.
Definition: gravi_cpl.c:2084
cpl_error_code gravi_array_phase_unwrap(cpl_array *input)
Definition: gravi_cpl.c:1088
cpl_error_code gravi_table_init_column_array(cpl_table *table, const char *name, const char *unit, cpl_type type, cpl_size size)
Definition: gravi_cpl.c:1692
cpl_error_code gravi_array_add_phase(cpl_array *input, double factor, cpl_array *phase)
Add a REAL phase to a REAL phase array, in-place: input = input + factor * phase.
Definition: gravi_cpl.c:1241
cpl_error_code gravi_vector_abs(cpl_vector *vector)
Return the running median of a vector, with special care for the boundaray, that are filled with the ...
Definition: gravi_cpl.c:2588
double gravi_image_get_quantile(const cpl_image *img, double value)
Compute the quantile of an image.
Definition: gravi_cpl.c:2477
double gravi_table_get_column_flagged_max(cpl_table *table, const char *name)
Function to compute the maximum of a column table with arrays.
Definition: gravi_cpl.c:290
cpl_error_code gravi_vector_unwrap_with_guess(cpl_vector *vector, cpl_vector *ref, double ref_to_phase)
Unwrap a phase vector following a guess vector. The difference is actually unwrap and shall thus be s...
Definition: gravi_cpl.c:2719
cpl_array * gravi_table_create_wave_array(cpl_table *oi_wave)
Definition: gravi_cpl.c:1037
cpl_array * gravi_array_wrap_image(cpl_image *)
Wrap the data of na image into an array.
Definition: gravi_cpl.c:2141
cpl_error_code gravi_table_set_array_phase(cpl_table *table, const char *name, cpl_size row, cpl_array *phase)
Definition: gravi_cpl.c:738
cpl_array * gravi_array_init_double(long n, double value)
Definition: gravi_cpl.c:597
double ** gravi_table_get_data_array_double(cpl_table *table, const char *name)
Definition: gravi_cpl.c:473
cpl_error_code gravi_array_normalize_complex(cpl_array *input)
Definition: gravi_cpl.c:1053
cpl_imagelist * gravi_imagelist_wrap_column(cpl_table *table_data, const char *data_x)
Wrap a column array of a table into an imagelist.
Definition: gravi_cpl.c:1757
cpl_vector * gravi_vector_median(const cpl_vector *vector, cpl_size hw)
Return the running median of a vector, with special care for the boundaray, that are filled with the ...
Definition: gravi_cpl.c:2547
cpl_error_code gravi_image_subtract_window(cpl_image *img1, const cpl_image *img2, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size llx2, cpl_size lly2)
Definition: gravi_cpl.c:1971
double gravi_array_get_quantile(cpl_array *arr, double value)
Compute the value of the vector corresponding to the quantile 'thr' (0 < thr < 1)
Definition: gravi_cpl.c:2511
cpl_error_code gravi_imagelist_unwrap_images(cpl_imagelist *imglist)
Unwrap an imagelist an all its images.
Definition: gravi_cpl.c:1727
cpl_error_code gravi_array_get_group_delay_loop(cpl_array **input, cpl_array **flag, cpl_array *sigma, double *gd, cpl_size nrow, double max_width, int verbose)
Optimized computation of GDELAY for a list of arrays.
Definition: gravi_cpl.c:1403
cpl_array * gravi_table_get_column_sum_array(cpl_table *table, const char *name, int base, int nbase)
Definition: gravi_cpl.c:427
cpl_image * gravi_image_from_matrix(cpl_matrix *matrix)
Definition: gravi_cpl.c:2423
cpl_error_code gravi_array_add_phasor(cpl_array *input, double complex factor, cpl_array *phase)
Add a REAL phase to a COMPLEX array, in-place: input = input + cexp (factor * phase)
Definition: gravi_cpl.c:1185
cpl_matrix * gravi_matrix_interpolate_col(cpl_matrix *matrix, cpl_vector *xref, cpl_vector *xout)
Linear interpolation of matrix column.
Definition: gravi_cpl.c:2867
cpl_vector * gravi_table_get_vector(cpl_table *, cpl_size, const char *)
Create a vector from the row index of the column regname.
Definition: gravi_cpl.c:2235
cpl_error_code gravi_table_set_string_fixlen(cpl_table *table, const char *name, int row, const char *value, int len)
Set string in table, ensuring fixed length (right space padding). see cpl_table_set_string.
Definition: gravi_cpl.c:769
cpl_array * gravi_array_wrap_float_complex(cpl_array *input_re, cpl_array *input_im)
Definition: gravi_cpl.c:664
cpl_array * gravi_array_compute_norm2(cpl_array *input_re, cpl_array *input_im)
Definition: gravi_cpl.c:688
int gravi_array_threshold_min(cpl_array *array, double lo_cut)
Definition: gravi_cpl.c:71
cpl_error_code gravi_image_replace_window(cpl_image *img1, const cpl_image *img2, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size llx2, cpl_size lly2)
Definition: gravi_cpl.c:2004
double gravi_table_get_column_std(cpl_table *table, const char *name, int base, int nbase)
Definition: gravi_cpl.c:388
cpl_array * gravi_table_get_column_mean_array(cpl_table *table, const char *name, int base, int nbase)
Definition: gravi_cpl.c:449
cpl_error_code gravi_image_subtract_collapse(cpl_image *img, const cpl_image *collapse, int direction)
Definition: gravi_cpl.c:1921
cpl_image * gravi_image_wrap_vector(cpl_vector *vector)
Wrap vector into an image (data not duplicated)
Definition: gravi_cpl.c:2443
cpl_array * gravi_array_rebin(const cpl_array *input, const cpl_array *errs, cpl_table *oi_wave_sc, cpl_table *oi_wave_ft)
Definition: gravi_cpl.c:792
cpl_array * gravi_table_create_sigma_array(cpl_table *oi_wave)
Definition: gravi_cpl.c:1024
double gravi_vector_get_mean_clip(cpl_vector *vector_in, double percent, double nsigma)
Return the mean of a vector after extrema and RMS clipping.
Definition: gravi_cpl.c:2642
cpl_error_code gravi_table_multiply_scalar(cpl_table *table, const char *name, int base, int nbase, double value)
Multiply scalar or array column by scalar.
Definition: gravi_cpl.c:2766
cpl_matrix * get_matrix_from_vector(cpl_vector *, cpl_vector *)
Copy the content of two vector into a newly allocated 2D matrix.
Definition: gravi_cpl.c:2185
cpl_error_code gravi_array_phase_wrap(cpl_array *input)
Definition: gravi_cpl.c:1119
cpl_array * gravi_array_init_double_complex(long n, double complex value)
Definition: gravi_cpl.c:619
int ** gravi_table_get_data_array_int(cpl_table *table, const char *name)
Definition: gravi_cpl.c:570
cpl_array ** gravi_array_new_list(int n, cpl_type type, int size)
Allocate a list of arrays, pre-filled with 0.0.
Definition: gravi_cpl.c:93
cpl_error_code gravi_array_multiply_phasor(cpl_array *input, double complex factor, cpl_array *phase)
Multiply a REAL phase to a COMPLEX array, in-place: input = input * cexp (factor * phase)
Definition: gravi_cpl.c:1159
cpl_size gravi_vector_get_maxpos(cpl_vector *vector)
Return the index of maximum in a vector. If several indexes exists with the maximum value,...
Definition: gravi_cpl.c:2614
cpl_error_code gravi_table_add_scalar(cpl_table *table, const char *name, int base, int nbase, double value)
Multply scalar or array column by scalar.
Definition: gravi_cpl.c:2816
cpl_error_code gravi_array_add_phasors(cpl_array *input, cpl_array *add, cpl_array *sub)
Add a pair of COMPLEX arrays to a COMPLEX array, in-place: input = input + add*conj(sub)
Definition: gravi_cpl.c:1211
float ** gravi_table_get_data_array_float(cpl_table *table, const char *name)
Definition: gravi_cpl.c:497
cpl_array * gravi_array_wrap_complex(cpl_array *input_re, cpl_array *input_im)
Definition: gravi_cpl.c:641
cpl_error_code gravi_table_interpolate_column(cpl_table *to_table, const char *to_x, const char *to_y, const cpl_table *from_table, const char *from_x, const char *from_y)
Definition: gravi_cpl.c:121
cpl_error_code gravi_table_new_column_array(cpl_table *table, const char *name, const char *unit, cpl_type type, cpl_size size)
Definition: gravi_cpl.c:1678
int gravi_table_are_equal(cpl_table *first, cpl_table *second)
Check if two tables have the same content.
Definition: gravi_cpl.c:1585
cpl_error_code gravi_array_multiply_conj(cpl_array *input1, cpl_array *input2)
Definition: gravi_cpl.c:1262
cpl_image * gravi_image_collapse_median_x(cpl_image *img, cpl_size drop_from, cpl_size drop_to)
collapse image along the x direction, droping a part of the image
Definition: gravi_cpl.c:1884