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