58 double* da = NULL, *db = NULL;
63 da = (
double*)(a->
data);
64 db = (
double*)(b->
data);
75 cpl_frame* spectralformat_frame,
76 cpl_frame *resid_frame,
83 cpl_frame *result = NULL ;
87 cpl_propertylist *header = NULL ;
88 double *vlambda = NULL;
90 double *xgauss = NULL, *ygauss = NULL, *vorder = NULL ;
91 double *pos_x = NULL, *pos_y = NULL ;
92 int size, i, nlinecat;
95 const char *model_date = NULL;
96 const char *tag = NULL;
99 cpl_table* spc_fmt_tab=NULL;
100 FILE* debug_out = NULL;
102 xsh_msg(
"Creating the Order Table");
134 for( i = 0 ; i<
size ; i++ ) {
135 *(pos_x+i) = *(xgauss+i) ;
136 *(pos_y+i) = *(ygauss+i) ;
154 for( i=0; i < list->
size; i++){
158 spc_fmt_tab=cpl_table_load(cpl_frame_get_filename(spectralformat_frame),1,0);
160 for( i=0; i < list->
size; i++){
167 xsh_msg(
" Save the produced order table" ) ;
169 if ( cpl_error_get_code() == CPL_ERROR_NONE){
173 xsh_msg(
"create order tab. nlinecat=%d",nlinecat);
180 sprintf(fname,
"%s%s",tag,
".fits");
189 debug_out = fopen(
"predict_cen_points.log",
"w");
190 for(dy=0;dy<
size; dy++){
191 fprintf(debug_out,
"%f %f\n",pos_x[dy],pos_y[dy]);
195 debug_out = fopen(
"predict_cen.log",
"w");
197 for(dor = 0; dor < list->
size; dor++){
198 for(dy=0;dy<pre->
ny;dy++){
202 fprintf(debug_out,
"%f %d\n",dx,dy);
212 xsh_msg(
"********** Not enough orders to produce ORDER_TABLE");
217 if(debug_out!=NULL) {
static xsh_instrument * instrument
void xsh_arclist_free(xsh_arclist **list)
free memory associated to a arclist
int xsh_arclist_get_size(xsh_arclist *list)
get size of arcline list
xsh_arclist * xsh_arclist_load(cpl_frame *frame)
load an arcline list frame in arclist structure
xsh_order_list * xsh_order_list_create(xsh_instrument *instr)
create an empty order list
cpl_frame * xsh_order_list_save(xsh_order_list *order_list, xsh_instrument *instrument, const char *filename, const char *tag, const int ny)
Save an order list to a frame.
cpl_propertylist * xsh_order_list_get_header(xsh_order_list *list)
get header of the table
void xsh_order_list_fit(xsh_order_list *list, int size, double *order, double *posx, double *posy, int deg_poly)
fit the polynomial solution of given points
void xsh_order_list_free(xsh_order_list **list)
free memory associated to an order_list
xsh_pre * xsh_pre_load(cpl_frame *frame, xsh_instrument *instr)
Load a xsh_pre structure from a frame.
void xsh_pre_free(xsh_pre **pre)
Free a xsh_pre structure.
double * xsh_resid_tab_get_lambda_data(xsh_resid_tab *resid)
Get the size of the residual tab.
double * xsh_resid_tab_get_ygauss_data(xsh_resid_tab *resid)
Get the ygauss array of the residual tab.
void xsh_resid_tab_free(xsh_resid_tab **resid)
Free memory associated to a resid_tab.
xsh_resid_tab * xsh_resid_tab_load(cpl_frame *resid_tab_frame)
Load a residual tab from a frame.
double * xsh_resid_tab_get_order_data(xsh_resid_tab *resid)
Get the Orders array of the residual tab.
double * xsh_resid_tab_get_xgauss_data(xsh_resid_tab *resid)
Get the xgauss array of the residual tab.
#define XSH_ASSURE_NOT_NULL(pointer)
#define xsh_msg_dbg_medium(...)
#define xsh_msg(...)
Print a message on info level.
#define xsh_msg_dbg_high(...)
const char * xsh_pfits_get_date(const cpl_propertylist *plist)
find out the DATE
void xsh_pfits_set_qc_nlinecat(cpl_propertylist *plist, double value)
void xsh_pfits_set_qc_nlinefound(cpl_propertylist *plist, double value)
void xsh_pfits_set_qc(cpl_propertylist *plist, void *value, const char *kw, xsh_instrument *instrument)
int xsh_debug_level_get(void)
get debug level
int * xsh_sort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
Sort an array and give is index table.
void xsh_reindex(double *data, int *idx, int size)
TO BE DESCRIBED.
void xsh_free_table(cpl_table **t)
Deallocate a table and set the pointer to NULL.
cpl_propertylist * header
static int data_order_compare(const void *one, const void *two)
cpl_frame * xsh_create_order_table(cpl_frame *in_frame, cpl_frame *spectralformat_frame, cpl_frame *resid_frame, cpl_frame *arclines, xsh_detect_arclines_param *da, xsh_clipping_param *dac, xsh_instrument *instrument)
int xsh_resid_tab_get_size(xsh_resid_tab *resid)
#define XSH_ORDER_TAB_GUESS
#define XSH_GET_TAG_FROM_ARM(TAG, instr)
#define XSH_QC_MODEL_FMTCHK_DATE
#define XSH_FREE(POINTER)
#define XSH_CALLOC(POINTER, TYPE, SIZE)