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_RESID_TAB_H
00027 #define XSH_DATA_RESID_TAB_H
00028
00029 #include <cpl.h>
00030 #include <xsh_data_wavesol.h>
00031
00032 #define XSH_RESID_TAB_TABLE_NB_COL 20
00033
00034 #define XSH_RESID_TAB_TABLE_COLNAME_WAVELENGTH "Wavelength"
00035 #define XSH_RESID_TAB_TABLE_UNIT_WAVELENGTH "nm"
00036
00037 #define XSH_RESID_TAB_TABLE_COLNAME_ORDER "Order"
00038 #define XSH_RESID_TAB_TABLE_UNIT_ORDER "none"
00039
00040 #define XSH_RESID_TAB_TABLE_COLNAME_SLITPOSITION "Slit_position"
00041 #define XSH_RESID_TAB_TABLE_UNIT_SLITPOSITION "arcsec"
00042
00043 #define XSH_RESID_TAB_TABLE_COLNAME_SLITINDEX "Slit_index"
00044 #define XSH_RESID_TAB_TABLE_UNIT_SLITINDEX "none"
00045
00046 #define XSH_RESID_TAB_TABLE_COLNAME_XTHPRE "Xthpre"
00047 #define XSH_RESID_TAB_TABLE_UNIT_XTHPRE "pixel"
00048
00049 #define XSH_RESID_TAB_TABLE_COLNAME_YTHPRE "Ythpre"
00050 #define XSH_RESID_TAB_TABLE_UNIT_YTHPRE "pixel"
00051
00052 #define XSH_RESID_TAB_TABLE_COLNAME_XTHCOR "Xthcor"
00053 #define XSH_RESID_TAB_TABLE_UNIT_XTHCOR "pixel"
00054
00055 #define XSH_RESID_TAB_TABLE_COLNAME_YTHCOR "Ythcor"
00056 #define XSH_RESID_TAB_TABLE_UNIT_YTHCOR "pixel"
00057
00058 #define XSH_RESID_TAB_TABLE_COLNAME_XGAUSS "XGauss"
00059 #define XSH_RESID_TAB_TABLE_UNIT_XGAUSS "pixel"
00060
00061 #define XSH_RESID_TAB_TABLE_COLNAME_YGAUSS "YGauss"
00062 #define XSH_RESID_TAB_TABLE_UNIT_YGAUSS "pixel"
00063
00064 #define XSH_RESID_TAB_TABLE_COLNAME_SIGMAXGAUSS "SigmaXGauss"
00065 #define XSH_RESID_TAB_TABLE_UNIT_SIGMAXGAUSS "pixel"
00066
00067 #define XSH_RESID_TAB_TABLE_COLNAME_SIGMAYGAUSS "SigmaYGauss"
00068 #define XSH_RESID_TAB_TABLE_UNIT_SIGMAYGAUSS "pixel"
00069
00070 #define XSH_RESID_TAB_TABLE_COLNAME_XPOLY "Xpoly"
00071 #define XSH_RESID_TAB_TABLE_UNIT_XPOLY "pixel"
00072
00073 #define XSH_RESID_TAB_TABLE_COLNAME_YPOLY "Ypoly"
00074 #define XSH_RESID_TAB_TABLE_UNIT_YPOLY "pixel"
00075
00076 #define XSH_RESID_TAB_TABLE_COLNAME_XTHANNEAL "Xthanneal"
00077 #define XSH_RESID_TAB_TABLE_UNIT_XTHANNEAL "pixel"
00078
00079 #define XSH_RESID_TAB_TABLE_COLNAME_YTHANNEAL "Ythanneal"
00080 #define XSH_RESID_TAB_TABLE_UNIT_YTHANNEAL "pixel"
00081
00082 #define XSH_RESID_TAB_TABLE_COLNAME_RESIDXPOLY "ResidXpoly"
00083 #define XSH_RESID_TAB_TABLE_UNIT_RESIDXPOLY "pixel"
00084
00085 #define XSH_RESID_TAB_TABLE_COLNAME_RESIDYPOLY "ResidYpoly"
00086 #define XSH_RESID_TAB_TABLE_UNIT_RESIDYPOLY "pixel"
00087
00088 #define XSH_RESID_TAB_TABLE_COLNAME_RESIDXMODEL "ResidXmodel"
00089 #define XSH_RESID_TAB_TABLE_UNIT_RESIDXMODEL "pixel"
00090
00091 #define XSH_RESID_TAB_TABLE_COLNAME_RESIDYMODEL "ResidYmodel"
00092 #define XSH_RESID_TAB_TABLE_UNIT_RESIDYMODEL "pixel"
00093
00094
00095 #define PROPERTY_GET( OBJECT, PROPERTY, TYPE, DEFAULT)\
00096 TYPE OBJECT##_get_##PROPERTY( OBJECT* obj)\
00097 {\
00098 TYPE result = DEFAULT;\
00099 \
00100 XSH_ASSURE_NOT_NULL( obj);\
00101 result = obj->PROPERTY;\
00102 \
00103 cleanup:\
00104 return result;\
00105 }
00106
00107
00108 #define RESID_TAB_PROPERTY_GET( PROPERTY, TYPE, DEFAULT)\
00109 PROPERTY_GET( xsh_resid_tab, PROPERTY, TYPE, DEFAULT)
00110
00111 typedef struct{
00112
00113 int solution_type;
00114
00115 double *lambda;
00116
00117 double *order;
00118
00119 double *slit;
00120
00121 int* slit_index;
00122 double *thpre_x;
00123 double *thpre_y;
00124 double *thcor_x;
00125 double *thcor_y;
00126 double *xgauss;
00127 double *ygauss;
00128 double *sig_xgauss;
00129 double *sig_ygauss;
00130 double *xpoly;
00131 double *ypoly;
00132 double *thanneal_x;
00133 double *thanneal_y;
00134
00135 int size;
00136
00137 double median_diff_poly_fit_x;
00138
00139 double median_diff_poly_fit_y;
00140
00141 double mean_diff_poly_fit_x;
00142
00143 double mean_diff_poly_fit_y;
00144
00145 double stdev_diff_poly_fit_x;
00146
00147 double stdev_diff_poly_fit_y;
00148
00149 cpl_propertylist* header;
00150 }xsh_resid_tab;
00151
00152 xsh_resid_tab* xsh_resid_tab_create(int size, double *lambda, double *order,
00153 double *slit, int *slit_index,
00154 double *thpre_x, double *thpre_y, double*corr_x, double* corr_y,
00155 double *gaussian_fit_x, double *gaussian_fit_y, double *gaussian_sigma_x,
00156 double *gaussian_sigma_y, xsh_wavesol *wavesol, int solution_type);
00157
00158 xsh_resid_tab* xsh_resid_tab_load( cpl_frame* resid_tab_frame);
00159 int xsh_resid_tab_get_size( xsh_resid_tab *resid);
00160 double * xsh_resid_tab_get_lambda_data(xsh_resid_tab *resid) ;
00161 double * xsh_resid_tab_get_order_data(xsh_resid_tab *resid) ;
00162 double * xsh_resid_tab_get_slitpos_data(xsh_resid_tab *resid) ;
00163 int* xsh_resid_tab_get_slit_index( xsh_resid_tab *resid);
00164 double * xsh_resid_tab_get_thpre_x_data(xsh_resid_tab *resid) ;
00165 double * xsh_resid_tab_get_thpre_y_data(xsh_resid_tab *resid) ;
00166 double * xsh_resid_tab_get_xgauss_data(xsh_resid_tab *resid) ;
00167 double * xsh_resid_tab_get_ygauss_data(xsh_resid_tab *resid) ;
00168
00169 void xsh_resid_tab_free( xsh_resid_tab **resid);
00170 cpl_frame* xsh_resid_tab_save( xsh_resid_tab *resid, const char *filename,
00171 xsh_instrument* instr,const char* tag);
00172 void xsh_resid_tab_log( xsh_resid_tab* resid, const char *filename) ;
00173 #endif