00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef XSH_DATA_ORDER_H
00027 #define XSH_DATA_ORDER_H
00028
00029 #include <cpl.h>
00030 #include <xsh_data_instrument.h>
00031
00032 #define XSH_ORDER_TABLE_COLNAME_ORDER "ORDER"
00033 #define XSH_ORDER_TABLE_COLNAME_ABSORDER "ABSORDER"
00034 #define XSH_ORDER_TABLE_COLNAME_CENTER "CENCOEF"
00035 #define XSH_ORDER_TABLE_COLNAME_EDGUP "EDGUPCOEF"
00036 #define XSH_ORDER_TABLE_COLNAME_EDGLO "EDGLOCOEF"
00037 #define XSH_ORDER_TABLE_COLNAME_SLICUP "SLICUPCOEF"
00038 #define XSH_ORDER_TABLE_COLNAME_SLICLO "SLICLOCOEF"
00039 #define XSH_ORDER_TABLE_DEGY "DEGY"
00040 #define XSH_ORDER_TABLE_COLNAME_STARTY "STARTY"
00041 #define XSH_ORDER_TABLE_COLNAME_ENDY "ENDY"
00042
00043 #define XSH_ORDER_TABLE_COLNAME_CENTERX "CENTER_X"
00044 #define XSH_ORDER_TABLE_COLNAME_CENTERY "CENTER_Y"
00045 #define XSH_ORDER_TABLE_COLNAME_EDGUPX "EDG_UP_X"
00046 #define XSH_ORDER_TABLE_COLNAME_EDGUPY "EDG_UP_Y"
00047 #define XSH_ORDER_TABLE_COLNAME_EDGLOX "EDG_LO_X"
00048 #define XSH_ORDER_TABLE_COLNAME_EDGLOY "EDG_LO_Y"
00049 #define XSH_ORDER_TABLE_COLNAME_SLICLOX "SLIC_LO_X"
00050 #define XSH_ORDER_TABLE_COLNAME_SLICLOY "SLIC_LO_Y"
00051 #define XSH_ORDER_TABLE_COLNAME_SLICUPX "SLIC_UP_X"
00052 #define XSH_ORDER_TABLE_COLNAME_SLICUPY "SLIC_UP_Y"
00053
00054
00055
00056 typedef struct{
00057
00058 int order;
00059
00060 int absorder;
00061
00062 cpl_polynomial *cenpoly;
00063
00064 cpl_polynomial *edguppoly;
00065
00066 cpl_polynomial *edglopoly;
00067
00068 cpl_polynomial *blazepoly;
00069
00070 cpl_polynomial *sliclopoly;
00071 cpl_polynomial *slicuppoly;
00072
00073 int pol_degree ;
00074
00075 int starty;
00076
00077 int endy;
00078
00079
00080
00081
00082
00083
00084
00085
00086 }xsh_order;
00087
00088
00089 typedef struct{
00090 int size;
00091 int bin_x;
00092 int bin_y;
00093 int absorder_min;
00094 int absorder_max;
00095 xsh_order* list;
00096 xsh_instrument* instrument;
00097 cpl_propertylist* header;
00098 }xsh_order_list;
00099
00100
00101 typedef struct {
00102 double residmin ;
00103 double residmax ;
00104 double residavg ;
00105 double residrms ;
00106
00107
00108 int max_pred ;
00109 int min_pred ;
00110 int npred ;
00111
00112 int max_det ;
00113 int min_det ;
00114 int ndet ;
00115
00116 int nposall ;
00117 int npossel ;
00118 } ORDERPOS_QC_PARAM ;
00119
00120 xsh_order_list* xsh_order_list_new( int size);
00121 xsh_order_list* xsh_order_list_create(xsh_instrument* instr);
00122 xsh_order_list* xsh_order_list_load(cpl_frame* frame, xsh_instrument* instr);
00123 cpl_propertylist* xsh_order_list_get_header(xsh_order_list* list);
00124 void xsh_order_list_set_starty( xsh_order_list* list, int i, int starty);
00125 void xsh_order_list_set_endy( xsh_order_list* list, int i, int endy);
00126 int xsh_order_list_get_starty(xsh_order_list* list, int i);
00127 int xsh_order_list_get_endy(xsh_order_list* list, int i);
00128 int xsh_order_list_get_index_by_absorder( xsh_order_list* list,
00129 double absorder);
00130 void xsh_order_list_free(xsh_order_list** list);
00131 xsh_order_list* xsh_order_list_merge( xsh_order_list* lista,
00132 xsh_order_list* listb);
00133
00134 cpl_frame*
00135 xsh_order_list_save(xsh_order_list* list,
00136 xsh_instrument* instrument,
00137 const char* filename,
00138 const char* tag,const int ny);
00139 void xsh_order_list_set_bin_x( xsh_order_list* list, int bin);
00140 void xsh_order_list_set_bin_y( xsh_order_list* list, int bin);
00141 double xsh_order_list_eval( xsh_order_list* list, cpl_polynomial *poly,
00142 double y);
00143 int xsh_order_list_eval_int( xsh_order_list* list, cpl_polynomial *poly,
00144 double y);
00145
00146 void xsh_order_list_dump( xsh_order_list* list, const char * fname ) ;
00147 void xsh_order_list_fit(xsh_order_list *list, int size, double* vorderdata,
00148 double* posx, double* posy, int deg_poly);
00149 int xsh_order_list_get_order( xsh_order_list * list, int absorder ) ;
00150 void xsh_order_list_verify( xsh_order_list * list, int ny ) ;
00151 void xsh_order_list_apply_shift( xsh_order_list *list, double xshift, double yshift);
00152
00153 void xsh_order_split_qth_d2( cpl_frame* order_tab_frame,
00154 cpl_frame* spectrum_format_frame, cpl_frame** qth_order_tab_frame,
00155 cpl_frame** d2_order_tab_frame, xsh_instrument* instr);
00156
00157 #endif