36#define XSH_RESIDX_THRESHOLD 0.1
79 double * posx,
double * posy,
80 double * resx,
double* polx )
107 for( i=0; i<
size; i++) {
108 result->
order[i] = orders[i];
109 result->
pos_x[i] = posx[i];
110 result->
pos_y[i] = posy[i];
111 result->
res_x[i] = resx[i];
112 result->
pol_x[i] = polx[i];
116 if ( cpl_error_get_code() != CPL_ERROR_NONE){
137 cpl_table * table = NULL;
138 const char * tablename = NULL;
146 check( tablename = cpl_frame_get_filename( resid_tab_frame));
150 check(
size = cpl_table_get_nrow(table));
153 check (result->
header = cpl_propertylist_load( tablename, 0));
162 for(i=0; i<
size;i++){
166 CPL_TYPE_INT, i, &result->
order[i]));
170 CPL_TYPE_DOUBLE, i, &result->
pos_x[i]));
174 CPL_TYPE_DOUBLE, i, &result->
pos_y[i]));
178 CPL_TYPE_DOUBLE, i, &result->
res_x[i]));
182 CPL_TYPE_DOUBLE, i, &result->
pol_x[i]));
186 if (cpl_error_get_code () != CPL_ERROR_NONE) {
188 cpl_frame_get_filename(resid_tab_frame));
205 if ( resid && *resid) {
241 const char* filename,
246 cpl_frame *result = NULL ;
247 cpl_table *table = NULL;
248 cpl_propertylist *header = NULL;
296 check(cpl_table_set_size( table, resid->
size));
299 for (i=0; i<resid->
size; i++) {
301 i, resid->
order[i]));
303 i, resid->
pos_x[i]));
305 i, resid->
pos_y[i]));
307 i, resid->
res_x[i]));
309 i, resid->
pol_x[i]));
321 check(ord_qc_param->
npossel=cpl_table_and_selected_double(table,
324 check(ord_qc_param->
npossel=cpl_table_and_selected_double(table,
328 check(ord_qc_param->
npossel=cpl_table_and_selected_double(table,
330 check(ord_qc_param->
npossel=cpl_table_and_selected_double(table,
332 check(sel=cpl_table_extract_selected(table));
371 check( cpl_table_save(table, header,NULL,filename, CPL_IO_DEFAULT));
377 CPL_FRAME_TYPE_TABLE,
378 CPL_FRAME_GROUP_PRODUCT,
379 CPL_FRAME_LEVEL_TEMPORARY));
384 if (cpl_error_get_code() != CPL_ERROR_NONE){
424 cpl_table *table = NULL;
438 xsh_msg(
" xsh_resid_order_save, size = %d", resid->
size ) ;
459 check(cpl_table_set_size( table, resid->
size));
486 for (i=0; i<resid->
size; i++) {
503 check(ord_qc_param->
npossel=cpl_table_and_selected_double(table,
507 check(ord_qc_param->
npossel=cpl_table_and_selected_double(table,
509 check(sel=cpl_table_extract_selected(table));
524 xsh_msg(
"after selection: avg=%g med=%g rms=%g min=%g max=%g",
static xsh_instrument * instrument
xsh_resid_order_tab * xsh_resid_order_create(int size, int *orders, double *posx, double *posy, double *resx, double *polx)
Create a residual tab structure.
void xsh_resid_order_free(xsh_resid_order_tab **resid)
Free memory associated to a resid_tab.
cpl_table * xsh_resid_order_2tab(xsh_resid_order_tab *resid, xsh_instrument *instrument, ORDERPOS_QC_PARAM *ord_qc_param)
convert a residual tab structure to a cpl_table
xsh_resid_order_tab * xsh_resid_order_load(cpl_frame *resid_tab_frame)
Load a residual tab from a frame.
cpl_frame * xsh_resid_order_save(xsh_resid_order_tab *resid, const char *filename, xsh_instrument *instrument, ORDERPOS_QC_PARAM *ord_qc_param, const char *tag)
Save a residual tab to a frame.
#define XSH_ASSURE_NOT_ILLEGAL(cond)
#define xsh_error_msg(...)
#define XSH_ASSURE_NOT_NULL(pointer)
#define xsh_msg(...)
Print a message on info level.
#define xsh_msg_dbg_low(...)
#define xsh_msg_dbg_high(...)
void xsh_pfits_set_pcatg(cpl_propertylist *plist, const char *value)
Write the PCATG value.
void xsh_pfits_set_qc(cpl_propertylist *plist, void *value, const char *kw, xsh_instrument *instrument)
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
cpl_error_code xsh_get_table_value(const cpl_table *table, const char *colname, cpl_type coltype, int i, void *result)
Read a table value from a fits table.
cpl_propertylist * header
#define XSH_RESIDX_THRESHOLD
#define XSH_RESID_ORDER_TABLE_UNIT_ORDER
#define XSH_RESID_ORDER_TABLE_UNIT_POSX
#define XSH_RESID_ORDER_TABLE_COLNAME_RESX
#define XSH_RESID_ORDER_TABLE_COLNAME_POSY
#define XSH_RESID_ORDER_TABLE_COLNAME_POLX
#define XSH_RESID_ORDER_TABLE_UNIT_RESX
#define XSH_RESID_ORDER_TABLE_UNIT_POLX
#define XSH_RESID_ORDER_TABLE_UNIT_POSY
#define XSH_RESID_ORDER_TABLE_COLNAME_ORDER
#define XSH_RESID_ORDER_TABLE_NB_COL
#define XSH_RESID_ORDER_TABLE_COLNAME_POSX
cpl_frame * xsh_frame_product(const char *fname, const char *tag, cpl_frame_type type, cpl_frame_group group, cpl_frame_level level)
Creates a frame with given characteristics.
#define QC_ORD_ORDERPOS_RESIDMAX
#define QC_ORD_ORDERPOS_RESIDAVG
#define QC_ORD_ORDERPOS_RESIDMIN_SEL
#define QC_ORD_ORDERPOS_RESIDMIN
#define QC_ORD_ORDERPOS_RESIDAVG_SEL
#define QC_ORD_ORDERPOS_RESIDRMS_SEL
#define QC_ORD_ORDERPOS_RESIDRMS
#define QC_ORD_ORDERPOS_RESIDMAX_SEL
#define XSH_TABLE_NEW_COL(TABLE, NAME, UNIT, TYPE)
#define XSH_FREE(POINTER)
#define XSH_CALLOC(POINTER, TYPE, SIZE)
#define XSH_TABLE_LOAD(TABLE, NAME)
#define XSH_TABLE_FREE(TABLE)