X-shooter Pipeline Reference Manual 3.8.15
xsh_data_resid_tab.h
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library is/ free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2012-06-19 07:45:26 $
23 * $Revision: 1.23 $
24 * $Name: not supported by cvs2svn $
25 */
26#ifndef XSH_DATA_RESID_TAB_H
27#define XSH_DATA_RESID_TAB_H
28
29#include <cpl.h>
30#include <xsh_data_wavesol.h>
31
32#define XSH_RESID_TAB_TABLE_NB_COL 20
33
34#define XSH_RESID_TAB_TABLE_COLNAME_WAVELENGTH "Wavelength"
35#define XSH_RESID_TAB_TABLE_UNIT_WAVELENGTH "nm"
36
37#define XSH_RESID_TAB_TABLE_COLNAME_SN "SN"
38#define XSH_RESID_TAB_TABLE_UNIT_SN "none"
39
40#define XSH_RESID_TAB_TABLE_COLNAME_ORDER "Order"
41#define XSH_RESID_TAB_TABLE_UNIT_ORDER "none"
42
43#define XSH_RESID_TAB_TABLE_COLNAME_SLITPOSITION "Slit_position"
44#define XSH_RESID_TAB_TABLE_UNIT_SLITPOSITION "arcsec"
45
46#define XSH_RESID_TAB_TABLE_COLNAME_SLITINDEX "Slit_index"
47#define XSH_RESID_TAB_TABLE_UNIT_SLITINDEX "none"
48
49#define XSH_RESID_TAB_TABLE_COLNAME_XTHPRE "Xthpre"
50#define XSH_RESID_TAB_TABLE_UNIT_XTHPRE "pixel"
51
52#define XSH_RESID_TAB_TABLE_COLNAME_YTHPRE "Ythpre"
53#define XSH_RESID_TAB_TABLE_UNIT_YTHPRE "pixel"
54
55#define XSH_RESID_TAB_TABLE_COLNAME_XTHCOR "Xthcor"
56#define XSH_RESID_TAB_TABLE_UNIT_XTHCOR "pixel"
57
58#define XSH_RESID_TAB_TABLE_COLNAME_YTHCOR "Ythcor"
59#define XSH_RESID_TAB_TABLE_UNIT_YTHCOR "pixel"
60
61#define XSH_RESID_TAB_TABLE_COLNAME_XGAUSS "XGauss"
62#define XSH_RESID_TAB_TABLE_UNIT_XGAUSS "pixel"
63
64#define XSH_RESID_TAB_TABLE_COLNAME_YGAUSS "YGauss"
65#define XSH_RESID_TAB_TABLE_UNIT_YGAUSS "pixel"
66
67#define XSH_RESID_TAB_TABLE_COLNAME_SIGMAXGAUSS "SigmaXGauss"
68#define XSH_RESID_TAB_TABLE_UNIT_SIGMAXGAUSS "pixel"
69
70#define XSH_RESID_TAB_TABLE_COLNAME_SIGMAYGAUSS "SigmaYGauss"
71#define XSH_RESID_TAB_TABLE_UNIT_SIGMAYGAUSS "pixel"
72
73#define XSH_RESID_TAB_TABLE_COLNAME_FWHMXGAUSS "FwhmXGauss"
74#define XSH_RESID_TAB_TABLE_UNIT_FWHMXGAUSS "pixel"
75
76#define XSH_RESID_TAB_TABLE_COLNAME_FWHMYGAUSS "FwhmYGauss"
77#define XSH_RESID_TAB_TABLE_UNIT_FWHMYGAUSS "pixel"
78
79#define XSH_RESID_TAB_TABLE_COLNAME_NORMGAUSS "NormGauss"
80#define XSH_RESID_TAB_TABLE_UNIT_NORMGAUSS "ADU"
81
82#define XSH_RESID_TAB_TABLE_COLNAME_XPOLY "Xpoly"
83#define XSH_RESID_TAB_TABLE_UNIT_XPOLY "pixel"
84
85#define XSH_RESID_TAB_TABLE_COLNAME_YPOLY "Ypoly"
86#define XSH_RESID_TAB_TABLE_UNIT_YPOLY "pixel"
87
88#define XSH_RESID_TAB_TABLE_COLNAME_XTHANNEAL "Xthanneal"
89#define XSH_RESID_TAB_TABLE_UNIT_XTHANNEAL "pixel"
90
91#define XSH_RESID_TAB_TABLE_COLNAME_YTHANNEAL "Ythanneal"
92#define XSH_RESID_TAB_TABLE_UNIT_YTHANNEAL "pixel"
93
94#define XSH_RESID_TAB_TABLE_COLNAME_RESIDXPOLY "ResidXpoly"
95#define XSH_RESID_TAB_TABLE_UNIT_RESIDXPOLY "pixel"
96
97#define XSH_RESID_TAB_TABLE_COLNAME_RESIDYPOLY "ResidYpoly"
98#define XSH_RESID_TAB_TABLE_UNIT_RESIDYPOLY "pixel"
99
100#define XSH_RESID_TAB_TABLE_COLNAME_RESIDXMODEL "ResidXmodel"
101#define XSH_RESID_TAB_TABLE_UNIT_RESIDXMODEL "pixel"
102
103#define XSH_RESID_TAB_TABLE_COLNAME_RESIDYMODEL "ResidYmodel"
104#define XSH_RESID_TAB_TABLE_UNIT_RESIDYMODEL "pixel"
105
106#define XSH_RESID_TAB_TABLE_COLNAME_FLAG "Flag"
107#define XSH_RESID_TAB_TABLE_UNIT_FLAG "none"
108
109/* get property PROPERTY of type TYPE from OBJECT */
110#define PROPERTY_GET( OBJECT, PROPERTY, TYPE, DEFAULT)\
111TYPE OBJECT##_get_##PROPERTY( OBJECT* obj)\
112{\
113 TYPE result = DEFAULT;\
114\
115 XSH_ASSURE_NOT_NULL( obj);\
116 result = obj->PROPERTY;\
117\
118 cleanup:\
119 return result;\
120}
121
122/* get property PROPERTY of type TYPE from resid_tab */
123#define RESID_TAB_PROPERTY_GET( PROPERTY, TYPE, DEFAULT)\
124 PROPERTY_GET( xsh_resid_tab, PROPERTY, TYPE, DEFAULT)
125
126typedef struct{
127 /* solution type */
129 /* Lambda lines */
130 double *lambda;
131 /* order lines */
132 double *order;
133 /* slit lines */
134 double *slit;
135 double *sn;
136 /* slit index */
138 double *thpre_x;
139 double *thpre_y;
140 double *thcor_x;
141 double *thcor_y;
142 double *xgauss;
143 double *ygauss;
144 double *sig_xgauss;
145 double *sig_ygauss;
146 double *fwhm_xgauss;
147 double *fwhm_ygauss;
148 double *norm_gauss;
149 double *xpoly;
150 double *ypoly;
151 double *thanneal_x;
152 double *thanneal_y;
153 int* flag; /* to indicate if a line has been detected. If not why */
154 /* size of the residual map */
155 int size;
156 /* median of difference between theoretical and polynomial fit in x */
158 /* median of difference between theoretical and polynomial fit in y */
160 /* mean of difference between theoretical and polynomial fit in x */
162 /* mean of difference between theoretical and polynomial fit in y */
164 /* stdev of difference between theoretical and polynomial fit in x */
166 /* stdev of difference between theoretical and polynomial fit in y */
168
169
170 /* header fits */
171 cpl_propertylist* header;
173
175xsh_resid_tab_create(int size, double *lambda, double *order,
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,
183 xsh_wavesol *wavesol, int wavesol_type);
184
185
187xsh_resid_tab_create_not_flagged(int size, double *lambda, double *order,
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,
195 xsh_wavesol *wavesol, int wavesol_type);
196
197xsh_resid_tab* xsh_resid_tab_load( cpl_frame* resid_tab_frame);
207
208void xsh_resid_tab_free( xsh_resid_tab **resid);
209cpl_frame* xsh_resid_tab_save( xsh_resid_tab *resid, const char *filename,
210 xsh_instrument* instr,const char* tag);
211void xsh_resid_tab_log( xsh_resid_tab* resid, const char *filename) ;
212cpl_frame* xsh_resid_tab_erase_flagged( cpl_frame* resid,const char* name);
213
214cpl_error_code
215xsh_frame_table_resid_merge(cpl_frame* self, cpl_frame* right,
216 const int solution_type);
217
218#endif /* XSH_DATA_RESID_TAB_H */
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.
int size
double median_diff_poly_fit_x
cpl_propertylist * header
double stdev_diff_poly_fit_y
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)
wavesol_type
int order
Definition: xsh_detmon_lg.c:80