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_WAVESOL_H
00027 #define XSH_DATA_WAVESOL_H
00028
00029 #include <cpl.h>
00030 #include <xsh_parameters.h>
00031
00032 #define XSH_SLIT_RANGE 1.2
00033
00034 #define XSH_WAVESOL_TABLE_NB_COL 4
00035 #define XSH_WAVESOL_TABLE_NB_ROWS 2
00036 #define XSH_WAVESOL_TABLE_COLNAME_AXIS "AXIS"
00037 #define XSH_WAVESOL_TABLE_COLNAME_DEGLAMBDA "DEGLAMBDA"
00038 #define XSH_WAVESOL_TABLE_COLNAME_DEGORDER "DEGORDER"
00039 #define XSH_WAVESOL_TABLE_COLNAME_DEGSLIT "DEGSLIT"
00040
00041 enum wavesol_type{
00042 XSH_WAVESOL_GUESS,
00043 XSH_WAVESOL_2D,
00044 XSH_WAVESOL_UNDEFINED
00045 };
00046
00047 typedef struct{
00048 enum wavesol_type type;
00049 int bin_x;
00050 int bin_y;
00051 cpl_polynomial* polx;
00052 cpl_polynomial* poly;
00053 cpl_propertylist* header;
00054 cpl_vector* dim;
00055 int * coefs;
00056 int nbcoefs;
00057 int deg_slit;
00058 int deg_order;
00059 int deg_lambda;
00060 double min_lambda;
00061 double max_lambda;
00062 double min_order;
00063 double max_order;
00064 double min_slit;
00065 double max_slit;
00066 double min_x;
00067 double max_x;
00068 double min_y;
00069 double max_y;
00070
00071 } xsh_wavesol;
00072
00073
00074 xsh_wavesol* xsh_wavesol_create(
00075 cpl_frame* spectral_format_frame, xsh_detect_arclines_param* p,
00076 xsh_instrument *instrument);
00077
00078 xsh_wavesol * xsh_wavesol_duplicate( xsh_wavesol * org ) ;
00079 void xsh_wavesol_add_poly( xsh_wavesol * to, xsh_wavesol * from ) ;
00080 void xsh_wavesol_dump( xsh_wavesol * wsol, const char * fname, int nb ) ;
00081
00082 void xsh_wavesol_set_type(xsh_wavesol * wsol, enum wavesol_type type);
00083 enum wavesol_type xsh_wavesol_get_type(xsh_wavesol *wsol);
00084
00085 cpl_polynomial* xsh_wavesol_get_poly(xsh_wavesol* sol);
00086 cpl_polynomial* xsh_wavesol_get_polx(xsh_wavesol* sol);
00087 cpl_propertylist* xsh_wavesol_get_header(xsh_wavesol* sol);
00088 double xsh_wavesol_eval_polx(xsh_wavesol* sol, double lambda, double order,
00089 double slit);
00090 double xsh_wavesol_eval_poly(xsh_wavesol* sol, double lambda, double order,
00091 double slit);
00092 void xsh_wavesol_compute(xsh_wavesol* sol, int size,
00093 double* posdata, double *minpos, double *maxpos, double* lambda, double* order,
00094 double* slit, cpl_polynomial* res);
00095 void xsh_wavesol_residual(xsh_wavesol* sol, xsh_wavesol * adj, int size,
00096 double* new_pos, double* lambda,
00097 double* order, double* slit,
00098 cpl_polynomial* result, char axis) ;
00099
00100 cpl_frame*
00101 xsh_wavesol_save(xsh_wavesol *w, cpl_table* trace, const char* filename,const char* tag);
00102 void xsh_wavesol_free(xsh_wavesol** w);
00103 xsh_wavesol * xsh_wavesol_load( cpl_frame * frame,
00104 xsh_instrument * instrument ) ;
00105 cpl_table*
00106 xsh_wavesol_trace( xsh_wavesol * wsol, double* lambda,
00107 double* order, double* slit,int size);
00108 void xsh_wavesol_set_bin_x( xsh_wavesol * wsol, int bin ) ;
00109 void xsh_wavesol_set_bin_y( xsh_wavesol * wsol, int bin ) ;
00110 void xsh_wavesol_apply_shift( xsh_wavesol *wsol, float shift_x, float shift_y);
00111
00112 #endif