29 #include"gravi_data.h" 36 #define gravi_bit_set(number, pos) do{(number) |= (1 << ((int)pos));}while(0) 37 #define gravi_bit_clear(number, pos) do{(number) &= (~(1 << ((int)pos)));}while(0) 38 #define gravi_bit_get(number, pos) (1 & ((number) >> ((int)pos))) 42 #define CPLCHECK(msg) do{int code; if( (code=cpl_error_get_code ()) ) { cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, code, msg); }} while (0) 45 #define CPLCHECK_MSG(msg) do{int code; if( (code=cpl_error_get_code ()) ) { cpl_msg_error(cpl_func,msg); return cpl_error_set_message(cpl_func, code, msg); }} while (0) 48 #define CPLCHECK_NUL(msg) do{int code; if( (code=cpl_error_get_code ()) ) { cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, code, msg); return NULL; }} while (0) 51 #define CPLCHECK_INT(msg) do{int code; if( (code=cpl_error_get_code ()) ) { cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, code, msg); return code; }} while (0) 54 #define CPLCHECK_CLEAN(msg) do{int code; if( (code=cpl_error_get_code ()) ) { cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, code, msg); goto cleanup; }} while (0) 57 #define CPLCHECK_GOTO(msg,tag) do{int code; if( (code=cpl_error_get_code ()) ) { cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, code, msg); goto tag; }} while (0) 60 #define ERROR_CLEAN(code,msg) do{cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, code, msg); goto cleanup;} while (0) 63 #define CHECK_NUL(flag,msg) do{ if( flag ) { cpl_msg_error(cpl_func,msg); cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, msg); return NULL; }} while (0) 66 #define CHECK_MSG(flag,msg) do{ if( flag ) { cpl_msg_error(cpl_func,msg); return cpl_error_set_message(cpl_func, CPL_ERROR_ILLEGAL_INPUT, msg); }} while (0) 69 #define FREE(function,variable) do{ if (variable) { function(variable); variable=NULL;} } while (0) 72 #define FREELOOP(function,variable,n) do{ if (variable) { for (int iloopfree = 0 ; iloopfree < n; iloopfree++) { if (variable[iloopfree]) { function( variable[iloopfree] ); variable[iloopfree] = NULL; } } if (variable) { cpl_free (variable); variable = NULL; } } } while (0) 75 #define FILESHORT(file) (strrchr(file, '/') ? strrchr(file, '/') + 1 : file) 77 #define TEST_MESSAGE cpl_msg_info (cpl_func,">>>>>>> TEST <<<<<<<") 81 #define gravi_pow2(data) data*data 84 # define gravi_msg_function_start(flag) clock_t timer_function = clock(); do{ if(flag) cpl_msg_info(cpl_func,"Start function %s", cpl_func); }while(0) 85 # define gravi_msg_function_exit(flag) do{ if(flag) cpl_msg_info(cpl_func,"Exit function %s (%.6f s)",cpl_func,(double)(clock()-timer_function)/(double)CLOCKS_PER_SEC); }while(0) 88 # define gravi_data_get_shutter(data,tel) gravi_get_shutter (gravi_data_get_header(data),tel) 89 # define gravi_data_check_shutter(data,t0,t1,t2,t3) gravi_check_shutter (gravi_data_get_header(data), t0,t1,t2,t3) 90 # define gravi_data_check_shutter_closed(data) gravi_check_shutter (gravi_data_get_header(data), 0,0,0,0) 91 # define gravi_data_check_shutter_open(data) gravi_check_shutter (gravi_data_get_header(data), 1,1,1,1) 92 # define gravi_spectrum_get_npol(table) (gravi_spectrum_get_nregion (table) > 24 ? 2 : 1) 105 extern int GRAVI_BASE_TEL[6][2];
106 extern char GRAVI_BASE_NAME[6][3];
107 extern int GRAVI_TRI_BASE[6][2][2];
108 extern int GRAVI_TRI_SIGN[6][2][2];
109 extern int GRAVI_CLO_BASE[4][3];
110 extern int GRAVI_CLO_TEL[4][3];
111 extern char GRAVI_CLO_NAME[4][4];
112 extern char GRAVI_DATA[50][7];
113 extern char GRAVI_DATAERR[50][10];
115 #define GRAVI_LBD_FTSC 6 118 #define GRAVI_MATH_RAD_MAS 4.848136811095360246362499795228298560267887751251691952347755e-09 123 #define GRAVI_LABINPUT_1 7 124 #define GRAVI_LABINPUT_2 5 125 #define GRAVI_LABINPUT_3 3 126 #define GRAVI_LABINPUT_4 1 127 extern int GRAVI_LABINPUT[4];
130 #define SHUTTER_KEY "IPAG INS SHUT" //"GRAVITY SHUT" 131 #define SHUTTER_KEY1 "IPAG INS SHUT1 ST" //"GRAVITY SHUT 1" 132 #define SHUTTER_KEY2 "IPAG INS SHUT2 ST" //"GRAVITY SHUT 2" 133 #define SHUTTER_KEY3 "IPAG INS SHUT3 ST" //"GRAVITY SHUT 3" 134 #define SHUTTER_KEY4 "IPAG INS SHUT4 ST" //"GRAVITY SHUT 4" 135 #define GRAVI_SHUTTER_KEY "ESO INS SHUT" 136 #define GRAVI_SHUTTER_KEY1 "ESO INS SHUT 1" 137 #define GRAVI_SHUTTER_KEY2 "ESO INS SHUT 2" 138 #define GRAVI_SHUTTER_KEY3 "ESO INS SHUT 3" 139 #define GRAVI_SHUTTER_KEY4 "ESO INS SHUT 4" 143 #define GRAVI_POLAR(pol,npol) (npol==1 ? "C" : (pol==0 ? "S" : "P") ) 148 #define COHERENCE "COHERENCE" 149 #define TRANSMISSION "TRANSMISSION" 150 #define PHASE "PHASE" 152 #define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg) 153 #define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a)) 154 #define IMIN(a,b) (((a) < (b)) ? (a) : (b)) 161 cpl_error_code gravi_msg_warning (
const char * component,
const char * msg);
162 cpl_error_code gravi_dump_the_boss (
double ra,
double dec);
164 int gravi_get_shutter (cpl_propertylist *,
int);
165 int gravi_check_shutter (cpl_propertylist *,
int,
int,
int,
int);
166 int gravi_data_check_shutter_beam (gravi_data ** datas,
int nb_datas);
167 int gravi_get_shutter_id (cpl_propertylist * header);
168 int gravi_get_shutter_baseid (cpl_propertylist * header);
184 short gravi_sta_index (
int gravi_input, cpl_table * optical_train_table, cpl_table * array_geometry_table);
186 cpl_size gravi_spectrum_get_nregion (
const cpl_table * table);
187 cpl_size gravi_spectrum_get_nwave (
const cpl_table * table);
199 int gravi_conf_get_iss (
int gravi_beam, cpl_propertylist * header);
200 const char * gravi_conf_get_telname (
int gravi_beam, cpl_propertylist * header);
short gravi_sta_index(int gravi_input, cpl_table *optical_train_table, cpl_table *array_geometry_table)
Retrieve STA_INDEX corresponding to a given input.
int gravi_region_get_pol(cpl_table *imaging_detector, int region)
Return the polarisation id of a region.
int gravi_region_get_base(cpl_table *imaging_detector, int region)
Return the base of a region.
int gravi_region_get_base_sign(cpl_table *imaging_detector, int base)
Return the sign of a base by looking at the PORT order.
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.
double gravi_imagelist_get_flux(const cpl_imagelist *imglist)
Return the total flux in imagelist.
cpl_vector * gravi_compute_envelope(const cpl_vector *opd, int wave, int n_wave)
Compute the envelope value.
int gravi_get_region(cpl_table *img_det, int base, char phase, int pol)
Find the region matching base, phase and pol.
int * gravi_image_extract_dimension(cpl_image *)
Compute startx and nx of the illuminated part of the image.
int gravi_region_get_phaseid(cpl_table *imaging_detector, int region)
Return the phase id of a region.
const char * gravi_get_license(void)
Get the pipeline copyright and license.
double gravi_spectrum_get_flux(const cpl_table *table)
Return the total flux in DATA# regions.
char gravi_region_get_phase(cpl_table *imaging_detector, int region)
Return the phase character of a region.
int gravi_region_get_tel(cpl_table *imaging_detector, int region, int beam)
Return the telescope id (0,1,2,3) in a beam of a region.
int gravi_wave_get_nlambda(cpl_table *wave_data, double lambda_min, double lambda_max)
Get the number of spectral element between lambdamin et lambdamax.
cpl_table * gravi_table_oi_create(int, int, const char *)
Create the oi table (oi_vis, oi_vis2, oi_t3)