45#define GRAVI_ACOEFF_RANGE 0.02
80 cpl_table * oivis_table,
81 cpl_table * oiwave_table,
116 cpl_ensure (vis_data, CPL_ERROR_NULL_INPUT, NULL);
126 cpl_size nrow = cpl_table_get_nrow (oiflux_table) /
ntel;
127 cpl_msg_info (cpl_func,
"Input vis_data has %lld observation",nrow);
131 cpl_error_set_message (cpl_func, CPL_ERROR_ILLEGAL_INPUT,
132 "Not enough observations to compute"
133 "a dispersion model. Check input SOF");
144 cpl_propertylist_append (disp_header, vis_header);
147 const char * qc_name =
"ESO QC DISP NEXP";
148 cpl_propertylist_update_int (disp_header, qc_name, nrow);
149 cpl_propertylist_set_comment (disp_header, qc_name,
"Number of exposures used");
156 cpl_table * linearity_table;
165 cpl_table * dispwave_table;
166 double GDrms = 0.0, Amin = 1e4, Amax = -1e4;
169 for (
int pol = 0; pol < npol; pol++) {
180 cpl_table * dispwave_table0;
182 oiwave_table, &GDrms,
189 dispwave_table = dispwave_table0;
196 cpl_table_delete (dispwave_table0);
202 qc_name =
"ESO QC DISP GDELAY_RMS";
204 cpl_propertylist_set_comment (disp_header, qc_name,
"[m] GDELAY rms over files");
206 qc_name =
"ESO QC DISP BETA_CORRECTION MIN";
208 cpl_propertylist_set_comment (disp_header, qc_name,
"Fine correction");
210 qc_name =
"ESO QC DISP BETA_CORRECTION MAX";
212 cpl_propertylist_set_comment (disp_header, qc_name,
"Fine correction");
214 qc_name =
"ESO QC DISP BETA_CORRECTION RANGE";
216 cpl_propertylist_set_comment (disp_header, qc_name,
"Fine correction");
226 cpl_table * dispth_table = cpl_table_duplicate (pos_table);
227 cpl_size nline = cpl_table_get_nrow (dispth_table);
230 dispwave_table,
"EFF_WAVE",
"BETA");
233 dispwave_table,
"EFF_WAVE",
"GAMMA");
243 cpl_table_duplicate_column (dispth_table,
"N_MEAN", dispth_table,
"BETA");
244 cpl_table_duplicate_column (dispth_table,
"N_DIFF", dispth_table,
"GAMMA");
246 for (cpl_size line = 0; line < nline; line++) {
247 double value = cpl_table_get (dispth_table,
"WAVE_TH", line, NULL) /
LAMBDA_MET;
248 cpl_array_multiply_scalar (cpl_table_get_data_array (dispth_table,
"N_MEAN")[line], value);
249 cpl_array_multiply_scalar (cpl_table_get_data_array (dispth_table,
"N_DIFF")[line], value);
256 cpl_table * disp_table = linearity_table;
265 cpl_size mindeg = 0, maxdeg = 3;
273 cpl_matrix * matrix = cpl_matrix_new (1, nline);
274 cpl_vector * vector = cpl_vector_new (nline);
275 cpl_polynomial * poly = cpl_polynomial_new (1);
276 cpl_array * coeff = cpl_array_new (maxdeg+1, CPL_TYPE_DOUBLE);
279 double wave0 = 2.2e-6;
280 for (cpl_size line = 0; line < nline; line++) {
281 double wave_th = cpl_table_get (dispth_table,
"WAVE_TH", line, NULL);
282 cpl_matrix_set (matrix, 0, line, wave0/wave_th - 1.);
285 for (cpl_size tel = 0; tel <
ntel; tel++) {
286 cpl_table_set (disp_table,
"WAVE0", tel, wave0);
289 for (cpl_size line = 0; line < nline; line++)
291 cpl_polynomial_fit (poly, matrix, NULL, vector, NULL, CPL_FALSE, &mindeg, &maxdeg);
292 for (cpl_size order = 0; order <= maxdeg; order ++)
293 cpl_array_set (coeff, order, cpl_polynomial_get_coeff (poly, &order));
294 cpl_table_set_array (disp_table,
"BETA", tel, coeff);
297 for (cpl_size line = 0; line < nline; line++)
299 cpl_polynomial_fit (poly, matrix, NULL, vector, NULL, CPL_FALSE, &mindeg, &maxdeg);
300 for (cpl_size order = 0; order <= maxdeg; order ++)
301 cpl_array_set (coeff, order, cpl_polynomial_get_coeff (poly, &order));
302 cpl_table_set_array (disp_table,
"GAMMA", tel, coeff);
305 for (cpl_size line = 0; line < nline; line++)
307 cpl_polynomial_fit (poly, matrix, NULL, vector, NULL, CPL_FALSE, &mindeg, &maxdeg);
308 for (cpl_size order = 0; order <= maxdeg; order ++)
309 cpl_array_set (coeff, order, cpl_polynomial_get_coeff (poly, &order));
310 cpl_table_set_array (disp_table,
"N_MEAN", tel, coeff);
313 for (cpl_size line = 0; line < nline; line++)
315 cpl_polynomial_fit (poly, matrix, NULL, vector, NULL, CPL_FALSE, &mindeg, &maxdeg);
316 for (cpl_size order = 0; order <= maxdeg; order ++)
317 cpl_array_set (coeff, order, cpl_polynomial_get_coeff (poly, &order));
318 cpl_table_set_array (disp_table,
"N_DIFF", tel, coeff);
320 CPLCHECK_NUL (
"Cannot fit the dispersion coefficients");
322 FREE (cpl_vector_delete, vector);
323 FREE (cpl_matrix_delete, matrix);
324 FREE (cpl_polynomial_delete, poly);
325 FREE (cpl_array_delete, coeff);
363 cpl_ensure_code (vis_data, CPL_ERROR_NULL_INPUT);
365 cpl_size nbase = 6,
ntel = 4, nclo = 4;
374 cpl_size nrow = cpl_table_get_nrow (oivis_table) / nbase;
377 cpl_array * flag_array = cpl_array_new (nrow, CPL_TYPE_INT);
378 cpl_array_fill_window (flag_array, 0, nrow, 0);
384 for (cpl_size row = 0; row < nrow; row++) {
385 for (cpl_size base = 0; base < nbase; base++) {
386 cpl_size
id = row * nbase + base;
387 double vis = cpl_array_get_median (cpl_table_get_array (oivis_table,
"VISAMP",
id));
389 if ( vis < 0.35) cpl_array_set (flag_array, row, 1);
399 cpl_size first = 0, nobs = 0;
403 for (cpl_size row = 0; row < nrow; row++) {
404 if (row < first || row >= first+nobs)
405 cpl_array_set (flag_array, row, 1);
409 cpl_msg_warning (cpl_func,
"LKDT not stable over all files "
410 "(keep %lld over %lld)", nobs, nrow);
419 for (
int type_data = 0; type_data < 2; type_data ++) {
421 for (
int pol = 0; pol < npol; pol ++) {
429 FREE (cpl_array_delete, flag_array);
432 cpl_size nrow_new = cpl_table_get_nrow (oivis_table) / nbase;
433 cpl_msg_info (cpl_func,
"Initial data had %lld obs, now %lld", nrow, nrow_new);
436 return CPL_ERROR_NONE;
467 cpl_ensure (oiflux_table, CPL_ERROR_NULL_INPUT, NULL);
469 cpl_size
ntel = 4, nbase = 6;
470 cpl_size nrow = cpl_table_get_nrow (oiflux_table) /
ntel;
473 cpl_matrix * rhs_matrix = cpl_matrix_new (nrow * nbase, 1);
474 cpl_matrix * model_matrix = cpl_matrix_new (nrow * nbase, nbase + 4 *
ntel);
476 for (
int base = 0; base < nbase; base++) {
480 for (cpl_size row=0; row<nrow; row++) {
481 int id = row * nbase + base;
482 int idi = row *
ntel + i;
483 int idj = row *
ntel + j;
486 double meti = cpl_table_get (oiflux_table,
"OPD_MET_FC", idi, NULL);
487 double metj = cpl_table_get (oiflux_table,
"OPD_MET_FC", idj, NULL);
488 cpl_matrix_set (rhs_matrix,
id, 0, (meti - metj)*1e6);
491 cpl_matrix_set (model_matrix,
id, base, 1.0);
494 double ft_posi = cpl_table_get (oiflux_table,
"FT_POS", idi, NULL);
495 double ft_posj = cpl_table_get (oiflux_table,
"FT_POS", idj, NULL);
496 cpl_matrix_set (model_matrix,
id, 6 +i, ft_posi);
497 cpl_matrix_set (model_matrix,
id, 6 +j, -1*ft_posj);
498 cpl_matrix_set (model_matrix,
id, 10+i, ft_posi*ft_posi);
499 cpl_matrix_set (model_matrix,
id, 10+j, -1*ft_posj*ft_posj);
502 double sc_posi = cpl_table_get (oiflux_table,
"SC_POS", idi, NULL);
503 double sc_posj = cpl_table_get (oiflux_table,
"SC_POS", idj, NULL);
504 cpl_matrix_set (model_matrix,
id, 14+i, -1*sc_posi);
505 cpl_matrix_set (model_matrix,
id, 14+j, sc_posj);
506 cpl_matrix_set (model_matrix,
id, 18+i, -1*sc_posi*sc_posi);
507 cpl_matrix_set (model_matrix,
id, 18+j, sc_posj*sc_posj);
512 cpl_matrix * res_matrix = cpl_matrix_solve_normal (model_matrix, rhs_matrix);
513 FREE (cpl_matrix_delete, model_matrix);
514 FREE (cpl_matrix_delete, rhs_matrix);
520 cpl_table * lin_table = cpl_table_new (
ntel);
524 cpl_array * coeff = cpl_array_new (3, CPL_TYPE_DOUBLE);
525 for (cpl_size tel = 0; tel <
ntel; tel++) {
526 cpl_array_set (coeff, 0, 0);
527 cpl_array_set (coeff, 1, cpl_matrix_get (res_matrix, 6 +tel, 0));
528 cpl_array_set (coeff, 2, cpl_matrix_get (res_matrix, 10+tel, 0));
529 cpl_table_set_array (lin_table,
"LIN_FDDL_FT", tel, coeff);
530 cpl_array_set (coeff, 0, 0);
531 cpl_array_set (coeff, 1, cpl_matrix_get (res_matrix, 14+tel, 0));
532 cpl_array_set (coeff, 2, cpl_matrix_get (res_matrix, 18+tel, 0));
533 cpl_table_set_array (lin_table,
"LIN_FDDL_SC", tel, coeff);
538 FREE (cpl_matrix_delete, res_matrix);
539 FREE (cpl_array_delete, coeff);
586 cpl_table * oivis_table,
587 cpl_table * oiwave_table,
593 cpl_ensure (oiflux_table, CPL_ERROR_NULL_INPUT, NULL);
594 cpl_ensure (oivis_table, CPL_ERROR_NULL_INPUT, NULL);
595 cpl_ensure (oiwave_table, CPL_ERROR_NULL_INPUT, NULL);
597 cpl_size nbase = 6,
ntel = 4;
598 cpl_size nrow = cpl_table_get_nrow (oiflux_table) / 4;
599 cpl_size nwave = cpl_table_get_column_depth (oiflux_table,
"FLUX");
605 double beta0 = 0.8651, beta1 = 0.8814;
607 cpl_table_new_column (oiwave_table,
"BETA", CPL_TYPE_DOUBLE);
608 for (cpl_size wave = 0; wave < nwave; wave ++) {
609 double lbd = cpl_table_get (oiwave_table,
"EFF_WAVE", wave, NULL);
610 double beta = beta0 + beta1 * (2.2e-6/lbd - 1.0);
611 cpl_table_set (oiwave_table,
"BETA", wave, beta);
616 double * metdata = cpl_table_get_data_double (oivis_table,
"OPD_MET_FC");
618 double * beta = cpl_table_get_data_double (oiwave_table,
"BETA");
619 float * effwave = cpl_table_get_data_float (oiwave_table,
"EFF_WAVE");
630 for (cpl_size base = 0; base < nbase ; base ++) {
631 for (cpl_size row = 0; row < nrow ; row ++) {
632 int id = row * nbase + base;
633 for (cpl_size wave = 0; wave < nwave; wave ++) {
634 visdata[id][wave] *= cexp (- 2*I*CPL_MATH_PI * beta[wave] * metdata[
id] /
LAMBDA_MET);
651 cpl_vector * GDb = cpl_vector_new (nbase);
653 for (cpl_size base = 0; base < nbase ; base ++) {
656 cpl_vector_set (GDb, base, mean);
659 for (cpl_size row = 0; row < nrow ; row ++) {
660 int id = row * nbase + base;
661 for (cpl_size wave = 0; wave < nwave; wave ++) {
662 visdata[id][wave] *= cexp (-2*I*CPL_MATH_PI * mean / effwave[wave]);
670 *GDrms = CPL_MAX (std, *GDrms);
687 double complex * phasor = cpl_calloc (nrow * nA,
sizeof (
double complex));
691 cpl_matrix * Abl = cpl_matrix_new (nbase, nwave);
694 for (cpl_size base = 0; base < nbase ; base ++) {
695 for (cpl_size wave = 0; wave < nwave ; wave ++) {
700 for (cpl_size iA = 0; iA < nA; iA++) {
705 double complex currentV = 0.0;
706 for (cpl_size row = 0; row < nrow; row++) {
707 if (wave==0) phasor[row*nA+iA] = cexp (-2.* CPL_MATH_PI * I * A *
708 metdata[row*nbase+base] /
710 currentV += phasor[row*nA+iA] * visdata[row*nbase+base][wave];
716 if (cabs (currentV) > maxV) {
717 cpl_matrix_set (Abl, base, wave, A);
719 maxV = cabs (currentV);
725 for (cpl_size row = 0; row < nrow; row++) {
726 visdata[row*nbase+base][wave] *= phasor[row*nA+iAmax];
731 FREE (cpl_free, phasor);
734 cpl_msg_info (cpl_func,
"Abl range = %g (beta correction)",
736 cpl_msg_info (cpl_func,
"Abl mean = %g (beta correction)",
737 cpl_matrix_get_mean (Abl));
738 cpl_msg_info (cpl_func,
"Abl std = %g (beta correction)",
739 cpl_matrix_get_stdev (Abl));
741 *Amax = CPL_MAX (*Amax, cpl_matrix_get_max (Abl));
742 *Amin = CPL_MIN (*Amin, cpl_matrix_get_min (Abl));
757 cpl_matrix * Obl = cpl_matrix_new (nbase, nwave);
760 for (cpl_size base = 0; base < nbase ; base ++) {
761 for (cpl_size wave = 0; wave < nwave ; wave ++) {
764 double complex currentV = 0.0;
765 for (cpl_size row = 0; row < nrow; row++) {
766 currentV += visdata[row*nbase+base][wave];
768 cpl_matrix_set (Obl, base, wave, carg (currentV));
772 for (cpl_size row = 0; row < nrow; row++) {
773 visdata[row*nbase+base][wave] *= conj (currentV);
790 cpl_matrix * disp_fits = cpl_matrix_new (nbase +
ntel * 2, nwave);
791 cpl_matrix * residuals_fits = cpl_matrix_new (nrow*nbase, nwave);
794 cpl_matrix * rhs_matrix = cpl_matrix_new (nrow * nbase, 1);
795 cpl_matrix * model_matrix = cpl_matrix_new (nrow * nbase, nbase +
ntel * 2);
797 for (cpl_size wave = 0; wave < nwave; wave ++) {
799 for (
int base = 0; base < nbase; base++) {
803 for (cpl_size row=0; row<nrow; row++) {
804 int id = row * nbase + base;
805 int idi = row *
ntel + i;
806 int idj = row *
ntel + j;
811 double phi = carg (visdata[
id][wave]);
812 phi += cpl_matrix_get (Obl, base, wave);
813 phi += CPL_MATH_2PI * cpl_matrix_get (Abl, base, wave) * metdata[id] /
LAMBDA_MET;
814 phi += CPL_MATH_2PI * cpl_vector_get (GDb, base) / effwave[wave];
815 phi += CPL_MATH_2PI * beta[wave] * metdata[id] /
LAMBDA_MET;
816 cpl_matrix_set (rhs_matrix,
id, 0, phi *
LAMBDA_MET / CPL_MATH_2PI);
819 cpl_matrix_set (model_matrix,
id, base, 1);
822 double fddli = cpl_table_get (oiflux_table,
"FDDL", idi, NULL);
823 double fddlj = cpl_table_get (oiflux_table,
"FDDL", idj, NULL);
824 cpl_matrix_set (model_matrix,
id, 6+i, fddli);
825 cpl_matrix_set (model_matrix,
id, 6+j, -1*fddlj);
828 double meti = cpl_table_get (oiflux_table,
"OPD_MET_FC", idi, NULL);
829 double metj = cpl_table_get (oiflux_table,
"OPD_MET_FC", idj, NULL);
830 cpl_matrix_set (model_matrix,
id, 10+i, meti);
831 cpl_matrix_set (model_matrix,
id, 10+j, -1*metj);
836 cpl_matrix * res_matrix = cpl_matrix_solve_normal (model_matrix, rhs_matrix);
839 cpl_matrix * residual_matrix = cpl_matrix_product_create ( model_matrix, res_matrix);
840 cpl_matrix_subtract(residual_matrix, rhs_matrix);
843 for (cpl_size param = 0; param < nbase +
ntel * 2; param++)
844 cpl_matrix_set (disp_fits, param, wave, cpl_matrix_get (res_matrix,param,0));
845 for (cpl_size param = 0; param < nrow * nbase; param++)
846 cpl_matrix_set (residuals_fits, param, wave, cpl_matrix_get (residual_matrix,param,0));
847 FREE (cpl_matrix_delete, res_matrix);
848 FREE (cpl_matrix_delete, residual_matrix);
851 FREE (cpl_matrix_delete, model_matrix);
852 FREE (cpl_matrix_delete, rhs_matrix);
855 FREE (cpl_free, visdata);
859 FREE (cpl_vector_delete, GDb);
860 FREE (cpl_matrix_delete, Abl);
861 FREE (cpl_matrix_delete, Obl);
866 cpl_table * dispwave_table = cpl_table_duplicate (oiwave_table);
874 for (cpl_size tel = 0; tel <
ntel; tel++) {
875 for (cpl_size wave = 0; wave < nwave; wave ++) {
877 cpl_matrix_get (disp_fits, 10+tel, wave));
879 cpl_matrix_get (disp_fits, 6+tel, wave));
885 for (cpl_size tel = 0; tel < nrow * nbase; tel++) {
886 for (cpl_size wave = 0; wave < nwave; wave ++) {
888 cpl_matrix_get (residuals_fits, tel, wave));
894 FREE (cpl_matrix_delete, disp_fits);
895 FREE (cpl_matrix_delete, residuals_fits);
898 return dispwave_table;
921 cpl_ensure_code (preproc_data, CPL_ERROR_NULL_INPUT);
935 cpl_ensure_code (spectrum_table, CPL_ERROR_ILLEGAL_INPUT);
936 cpl_ensure_code (oi_wave, CPL_ERROR_ILLEGAL_INPUT);
942 const cpl_array * array_data;
943 cpl_array * argon = cpl_array_new (nwave, CPL_TYPE_DOUBLE);
944 cpl_array_fill_window (argon, 0, nwave, 0.0);
947 for (cpl_size region = 0; region < n_region; region ++) {
948 array_data = cpl_table_get_array (spectrum_table,
GRAVI_DATA[region], 0);
949 cpl_array_add (argon, array_data);
952 cpl_array_divide_scalar (argon, n_region);
961 if ( cpl_table_has_column (line_wave_table ,
"ARGON_LINES") ) {
963 line_wave = cpl_table_get_data_double (line_wave_table,
"ARGON_LINES");
964 nlines = cpl_table_get_nrow (line_wave_table);
966 cpl_msg_info (cpl_func,
"line_wave [0] : %e", line_wave[0]);
967 cpl_msg_info (cpl_func,
"line_wave [1] : %e", line_wave[1]);
968 cpl_msg_info (cpl_func,
"line_wave [2] : %e", line_wave[2]);
969 cpl_msg_info (cpl_func,
"line_wave [3] : %e", line_wave[3]);
970 cpl_msg_info (cpl_func,
"line_wave [4] : %e", line_wave[4]);
971 cpl_msg_info (cpl_func,
"line_wave [5] : %e", line_wave[5]);
972 cpl_msg_info (cpl_func,
"line_wave [6] : %e", line_wave[6]);
973 cpl_msg_info (cpl_func,
"line_wave [7] : %e", line_wave[7]);
974 cpl_msg_info (cpl_func,
"line_wave [8] : %e", line_wave[8]);
975 cpl_msg_info (cpl_func,
"line_wave [9] : %e", line_wave[9]);
980 cpl_msg_error(cpl_func,
"Cannot get the default values for Argon line_wave");
981 return CPL_ERROR_ILLEGAL_INPUT;
989 int fitwidth = nwave > 500 ? 10 : 3;
990 int nfitwidth = fitwidth * 2;
993 cpl_table * outTable = cpl_table_new (nlines);
1002 cpl_vector * vector_x = cpl_vector_new (nfitwidth);
1003 cpl_vector * vector_y = cpl_vector_new (nfitwidth);
1005 for (cpl_size list = 0; list < nlines; list ++) {
1008 double waveI = line_wave[list];
1012 while ( cpl_table_get (oi_wave,
"EFF_WAVE", pixI, NULL) < waveI) {
1018 for (cpl_size i = 0; i < nfitwidth; i++) {
1019 cpl_size w = pixI - fitwidth + i;
1020 cpl_vector_set (vector_x, i, cpl_table_get (oi_wave,
"EFF_WAVE", w, NULL));
1021 cpl_vector_set (vector_y, i, cpl_array_get (argon, w, NULL));
1025 cpl_errorstate prestate = cpl_errorstate_get();
1026 double w0 = waveI, sigma, area, offset, mse;
1027 cpl_vector_fit_gaussian (vector_x, NULL, vector_y, NULL,
1028 CPL_FIT_ALL, &w0, &sigma, &area,
1029 &offset, &mse, NULL, NULL);
1031 if (cpl_error_get_code() == CPL_ERROR_CONTINUE){
1032 cpl_errorstate_set (prestate);
1033 cpl_msg_warning(cpl_func,
"The gaussian fit did not converge");
1034 cpl_vector_multiply (vector_x, vector_y);
1035 w0 = cpl_vector_get_mean (vector_x) /
1036 cpl_vector_get_mean (vector_y);
1041 double diff = w0 - waveI;
1042 double scale = (cpl_vector_get_max (vector_x) - cpl_vector_get_min (vector_x)) / (nfitwidth - 1);
1043 double diff_pix = diff / scale;
1046 cpl_msg_info (cpl_func,
"Argon line %lld: %.3g [nm] %.3g [pix] (over %i)",
1047 list, 1e9*diff, diff_pix, fitwidth);
1050 cpl_table_set (outTable,
"WAVE_TH", list, waveI);
1051 cpl_table_set (outTable,
"WAVE", list, w0);
1052 cpl_table_set (outTable,
"SIGMA", list, sigma);
1053 cpl_table_set (outTable,
"DIFF", list, diff);
1054 cpl_table_set (outTable,
"DIFF_PIX", list, diff_pix);
1057 cpl_array * tmp_array = cpl_array_wrap_double (cpl_vector_get_data (vector_y), nfitwidth);
1058 cpl_table_set_array (outTable,
"DATA_MEAN", list, tmp_array);
1059 FREE (cpl_array_unwrap, tmp_array);
1065 FREE (cpl_vector_delete, vector_y);
1066 FREE (cpl_vector_delete, vector_x);
1067 FREE (cpl_array_delete, argon);
1073 cpl_table_get_column_min (outTable,
"DIFF") * 1e9,
1074 cpl_table_get_column_max (outTable,
"DIFF") * 1e9,
1075 cpl_table_get_column_stdev (outTable,
"DIFF") * 1e9);
1081 return CPL_ERROR_NONE;
#define gravi_table_set_value(table, name, row, value, val)
#define gravi_table_get_value(table, name, row, value)
typedefCPL_BEGIN_DECLS struct _gravi_data_ gravi_data
#define gravi_data_get_spectrum_data(data, type)
#define gravi_data_get_oi_t3(data, type, pol, npol)
#define gravi_data_get_oi_flux(data, type, pol, npol)
#define gravi_data_get_header(data)
#define gravi_data_get_oi_vis2(data, type, pol, npol)
#define gravi_data_get_oi_wave(data, type, pol, npol)
#define gravi_data_get_oi_vis(data, type, pol, npol)
cpl_msg_debug(cpl_func, "Spectra has <50 pixels -> don't flat")
cpl_propertylist * header
cpl_msg_info(cpl_func, "Compute WAVE_SCAN for %s", GRAVI_TYPE(type_data))
cpl_propertylist_update_double(header, "ESO QC MINWAVE SC", cpl_propertylist_get_double(plist, "ESO QC MINWAVE SC"))
#define gravi_spectrum_get_npol(table)
#define gravi_msg_function_exit(flag)
#define FREE(function, variable)
#define CPLCHECK_NUL(msg)
#define gravi_msg_function_start(flag)
#define CPLCHECK_MSG(msg)
cpl_error_code gravi_table_add_columns(cpl_table *oi_vis1, const char *name1, cpl_table *oi_vis2, const char *name2)
double gravi_table_get_column_mean(cpl_table *table, const char *name, int base, int nbase)
cpl_error_code gravi_table_new_column(cpl_table *table, const char *name, const char *unit, cpl_type type)
double complex ** gravi_table_get_data_array_double_complex(cpl_table *table, const char *name)
cpl_error_code gravi_table_compute_group_delay(cpl_table *table, const char *input, const char *flag, const char *output, cpl_table *oi_wave)
cpl_error_code gravi_table_init_column_array(cpl_table *table, const char *name, const char *unit, cpl_type type, cpl_size size)
double gravi_table_get_column_std(cpl_table *table, const char *name, int base, int nbase)
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.
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)
cpl_error_code gravi_table_new_column_array(cpl_table *table, const char *name, const char *unit, cpl_type type, cpl_size size)
gravi_data * gravi_data_new(int nb_ext)
Create an empty gravi_data.
cpl_error_code gravi_data_add_table(gravi_data *self, cpl_propertylist *plist, const char *extname, cpl_table *table)
Add a BINTABLE extension in gravi_data.
cpl_table * gravi_data_get_table(gravi_data *self, const char *extname)
Return a pointer on a table extension by its EXTNAME.
gravi_data * gravi_compute_disp(gravi_data *vis_data)
Compute the DISP_MODEL calibration map.
cpl_error_code gravi_disp_cleanup(gravi_data *vis_data)
Cleanup a VIS gravi_data before calibrating the dispersion.
cpl_table * gravi_fit_fddl_lin(cpl_table *oiflux_table)
Compute the linearity coefficient of FDDLs.
cpl_table * gravi_fit_dispersion(cpl_table *oiflux_table, cpl_table *oivis_table, cpl_table *oiwave_table, double *GDrms, double *Amin, double *Amax)
Compute the dispersion coefficient of FDDLs.
cpl_error_code gravi_compute_argon_pos(gravi_data *preproc_data, gravi_data *wave_param)
Compute position of argon lines in SC spectrum.
#define GRAVI_ACOEFF_RANGE
int gravi_pfits_get_pola_num(const cpl_propertylist *plist, int type_data)
cpl_error_code gravi_flux_create_fddllin_sc(cpl_table *flux_SC, cpl_table *disp_table)
Compute the (FDDL_SC + FDDL_FT)/2 position in [m].
cpl_error_code gravi_msg_warning(const char *component, const char *msg)
cpl_size gravi_spectrum_get_nwave(const cpl_table *table)
cpl_error_code gravi_lkdt_get_sequence(cpl_table *oi_table, cpl_size ntel, cpl_size *first, cpl_size *nobs)
Return the longuest sequence with constant LKDT.
cpl_size gravi_spectrum_get_nregion(const cpl_table *table)
cpl_error_code gravi_vis_erase_obs(cpl_table *oi_table, cpl_array *flag_array, cpl_size ntel)
Erase observation from an OIFITS table.