26#ifndef XSH_DATA_RESID_TAB_H
27#define XSH_DATA_RESID_TAB_H
32#define XSH_RESID_TAB_TABLE_NB_COL 20
34#define XSH_RESID_TAB_TABLE_COLNAME_WAVELENGTH "Wavelength"
35#define XSH_RESID_TAB_TABLE_UNIT_WAVELENGTH "nm"
37#define XSH_RESID_TAB_TABLE_COLNAME_SN "SN"
38#define XSH_RESID_TAB_TABLE_UNIT_SN "none"
40#define XSH_RESID_TAB_TABLE_COLNAME_ORDER "Order"
41#define XSH_RESID_TAB_TABLE_UNIT_ORDER "none"
43#define XSH_RESID_TAB_TABLE_COLNAME_SLITPOSITION "Slit_position"
44#define XSH_RESID_TAB_TABLE_UNIT_SLITPOSITION "arcsec"
46#define XSH_RESID_TAB_TABLE_COLNAME_SLITINDEX "Slit_index"
47#define XSH_RESID_TAB_TABLE_UNIT_SLITINDEX "none"
49#define XSH_RESID_TAB_TABLE_COLNAME_XTHPRE "Xthpre"
50#define XSH_RESID_TAB_TABLE_UNIT_XTHPRE "pixel"
52#define XSH_RESID_TAB_TABLE_COLNAME_YTHPRE "Ythpre"
53#define XSH_RESID_TAB_TABLE_UNIT_YTHPRE "pixel"
55#define XSH_RESID_TAB_TABLE_COLNAME_XTHCOR "Xthcor"
56#define XSH_RESID_TAB_TABLE_UNIT_XTHCOR "pixel"
58#define XSH_RESID_TAB_TABLE_COLNAME_YTHCOR "Ythcor"
59#define XSH_RESID_TAB_TABLE_UNIT_YTHCOR "pixel"
61#define XSH_RESID_TAB_TABLE_COLNAME_XGAUSS "XGauss"
62#define XSH_RESID_TAB_TABLE_UNIT_XGAUSS "pixel"
64#define XSH_RESID_TAB_TABLE_COLNAME_YGAUSS "YGauss"
65#define XSH_RESID_TAB_TABLE_UNIT_YGAUSS "pixel"
67#define XSH_RESID_TAB_TABLE_COLNAME_SIGMAXGAUSS "SigmaXGauss"
68#define XSH_RESID_TAB_TABLE_UNIT_SIGMAXGAUSS "pixel"
70#define XSH_RESID_TAB_TABLE_COLNAME_SIGMAYGAUSS "SigmaYGauss"
71#define XSH_RESID_TAB_TABLE_UNIT_SIGMAYGAUSS "pixel"
73#define XSH_RESID_TAB_TABLE_COLNAME_FWHMXGAUSS "FwhmXGauss"
74#define XSH_RESID_TAB_TABLE_UNIT_FWHMXGAUSS "pixel"
76#define XSH_RESID_TAB_TABLE_COLNAME_FWHMYGAUSS "FwhmYGauss"
77#define XSH_RESID_TAB_TABLE_UNIT_FWHMYGAUSS "pixel"
79#define XSH_RESID_TAB_TABLE_COLNAME_NORMGAUSS "NormGauss"
80#define XSH_RESID_TAB_TABLE_UNIT_NORMGAUSS "ADU"
82#define XSH_RESID_TAB_TABLE_COLNAME_XPOLY "Xpoly"
83#define XSH_RESID_TAB_TABLE_UNIT_XPOLY "pixel"
85#define XSH_RESID_TAB_TABLE_COLNAME_YPOLY "Ypoly"
86#define XSH_RESID_TAB_TABLE_UNIT_YPOLY "pixel"
88#define XSH_RESID_TAB_TABLE_COLNAME_XTHANNEAL "Xthanneal"
89#define XSH_RESID_TAB_TABLE_UNIT_XTHANNEAL "pixel"
91#define XSH_RESID_TAB_TABLE_COLNAME_YTHANNEAL "Ythanneal"
92#define XSH_RESID_TAB_TABLE_UNIT_YTHANNEAL "pixel"
94#define XSH_RESID_TAB_TABLE_COLNAME_RESIDXPOLY "ResidXpoly"
95#define XSH_RESID_TAB_TABLE_UNIT_RESIDXPOLY "pixel"
97#define XSH_RESID_TAB_TABLE_COLNAME_RESIDYPOLY "ResidYpoly"
98#define XSH_RESID_TAB_TABLE_UNIT_RESIDYPOLY "pixel"
100#define XSH_RESID_TAB_TABLE_COLNAME_RESIDXMODEL "ResidXmodel"
101#define XSH_RESID_TAB_TABLE_UNIT_RESIDXMODEL "pixel"
103#define XSH_RESID_TAB_TABLE_COLNAME_RESIDYMODEL "ResidYmodel"
104#define XSH_RESID_TAB_TABLE_UNIT_RESIDYMODEL "pixel"
106#define XSH_RESID_TAB_TABLE_COLNAME_FLAG "Flag"
107#define XSH_RESID_TAB_TABLE_UNIT_FLAG "none"
110#define PROPERTY_GET( OBJECT, PROPERTY, TYPE, DEFAULT)\
111TYPE OBJECT##_get_##PROPERTY( OBJECT* obj)\
113 TYPE result = DEFAULT;\
115 XSH_ASSURE_NOT_NULL( obj);\
116 result = obj->PROPERTY;\
123#define RESID_TAB_PROPERTY_GET( PROPERTY, TYPE, DEFAULT)\
124 PROPERTY_GET( xsh_resid_tab, PROPERTY, TYPE, DEFAULT)
176 double *slit,
double* sn,
int *slit_index,
177 double *thpre_x,
double *thpre_y,
178 double*corr_x,
double* corr_y,
179 double *gaussian_norm,
180 double *gaussian_fit_x,
double *gaussian_fit_y,
181 double *gaussian_sigma_x,
double *gaussian_sigma_y,
182 double *gaussian_fwhm_x,
double *gaussian_fwhm_y,
int* flag,
188 double *slit,
double* sn,
int *slit_index,
189 double *thpre_x,
double *thpre_y,
190 double*corr_x,
double* corr_y,
191 double *gaussian_norm,
192 double *gaussian_fit_x,
double *gaussian_fit_y,
193 double *gaussian_sigma_x,
double *gaussian_sigma_y,
194 double *gaussian_fwhm_x,
double *gaussian_fwhm_y,
int* flag,
216 const int solution_type);
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.
cpl_frame * xsh_resid_tab_erase_flagged(cpl_frame *resid, const char *name)
xsh_resid_tab * xsh_resid_tab_load(cpl_frame *resid_tab_frame)
Load a residual tab from a frame.
xsh_resid_tab * xsh_resid_tab_create(int size, double *lambda, double *order, double *slit, double *sn, int *slit_index, double *thpre_x, double *thpre_y, double *corr_x, double *corr_y, double *gaussian_norm, double *gaussian_fit_x, double *gaussian_fit_y, double *gaussian_sigma_x, double *gaussian_sigma_y, double *gaussian_fwhm_x, double *gaussian_fwhm_y, int *flag, xsh_wavesol *wavesol, int wavesol_type)
Create a residual tab structure.
double * xsh_resid_tab_get_thpre_y_data(xsh_resid_tab *resid)
Get the thpre_y array of the residual tab.
double * xsh_resid_tab_get_slitpos_data(xsh_resid_tab *resid)
Get the slit_pos array of the residual tab.
double * xsh_resid_tab_get_thpre_x_data(xsh_resid_tab *resid)
Get the slit_index array of the residual tab.
cpl_error_code xsh_frame_table_resid_merge(cpl_frame *self, cpl_frame *right, const int solution_type)
xsh_resid_tab * xsh_resid_tab_create_not_flagged(int size, double *lambda, double *order, double *slit, double *sn, int *slit_index, double *thpre_x, double *thpre_y, double *corr_x, double *corr_y, double *gaussian_norm, double *gaussian_fit_x, double *gaussian_fit_y, double *gaussian_sigma_x, double *gaussian_sigma_y, double *gaussian_fwhm_x, double *gaussian_fwhm_y, int *flag, xsh_wavesol *wavesol, int wavesol_type)
void xsh_resid_tab_log(xsh_resid_tab *resid, const char *filename)
Log the residual tab in a ASCII file
cpl_frame * xsh_resid_tab_save(xsh_resid_tab *resid, const char *filename, xsh_instrument *instr, const char *tag)
Save a residual tab to 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.
double median_diff_poly_fit_x
double mean_diff_poly_fit_y
cpl_propertylist * header
double stdev_diff_poly_fit_y
double mean_diff_poly_fit_x
double stdev_diff_poly_fit_x
double median_diff_poly_fit_y
int xsh_resid_tab_get_size(xsh_resid_tab *resid)
int * xsh_resid_tab_get_slit_index(xsh_resid_tab *resid)