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
00027
00028 #ifndef XSH_DETMON_LG_H
00029 #define XSH_DETMON_LG_H
00030
00031
00032
00033
00034
00035 #include <cpl.h>
00036
00037
00038
00039
00040
00041 #define NIR TRUE
00042 #define OPT FALSE
00043
00044 #define DETMON_QC_COUNTS_MIN "ESO QC COUNTS MIN"
00045 #define DETMON_QC_COUNTS_MIN_C "Minimum median value used in linearity test (in a user defined region) [ADU]"
00046
00047 #define DETMON_QC_COUNTS_MAX "ESO QC COUNTS MAX"
00048 #define DETMON_QC_COUNTS_MAX_C "Maximum median value used in linearity test (in a user defined region) [ADU]"
00049
00050 #define DETMON_QC_CONAD "ESO QC CONAD"
00051 #define DETMON_QC_CONAD_C "CONAD value [el/ADU]"
00052
00053 #define DETMON_QC_CONAD_CORR "ESO QC CONAD CORR"
00054 #define DETMON_QC_CONAD_CORR_C "CONAD value taken QC.AUTOCORR into account [el/ADU]"
00055
00056 #define DETMON_QC_GAIN "ESO QC GAIN"
00057 #define DETMON_QC_GAIN_C "GAIN (see QC.METHOD) [ADU/el]"
00058
00059 #define DETMON_QC_GAIN_MSE "ESO QC GAIN MSE"
00060 #define DETMON_QC_GAIN_MSE_C "Measured Squared error in GAIN computation"
00061
00062 #define DETMON_QC_RON "ESO QC RON"
00063 #define DETMON_QC_RON_C "RON obtained as independent term (PTC method)"
00064
00065 #define DETMON_QC_AUTOCORR "ESO QC AUTOCORR"
00066 #define DETMON_QC_AUTOCORR_C "Autocorrelation factor computed as sum of " \
00067 "all pixels in autocorrelation image"
00068 #define DETMON_QC_GAIN_CORR "ESO QC GAIN CORR"
00069 #define DETMON_QC_GAIN_CORR_C "GAIN taken QC.AUTOCORR into account [el/ADU]"
00070
00071 #define DETMON_QC_LAMP_FLUX "ESO QC LAMP FLUX"
00072 #define DETMON_QC_LAMP_FLUX_C "Lamp flux"
00073
00074 #define DETMON_QC_NUM_BPM "ESO QC NUM BPM"
00075 #define DETMON_QC_NUM_BPM_C "Number of bad pixels detected according to "\
00076 "polynomial information"
00077
00078 #define DETMON_QC_LAMP_STAB "ESO QC LAMP STAB"
00079 #define DETMON_QC_LAMP_STAB_C "Lamp stability"
00080
00081 #define DETMON_QC_METHOD "ESO QC METHOD"
00082 #define DETMON_QC_METHOD_C "Method applied to compute GAIN"
00083
00084 #define DETMON_QC_LIN_EFF "ESO QC LIN EFF"
00085 #define DETMON_QC_LIN_EFF_C "Effective non-linearity correction"
00086
00087 #define DETMON_QC_LIN_EFF_FLUX "ESO QC LIN EFF FLUX"
00088 #define DETMON_QC_LIN_EFF_FLUX_C "FLux level at which effective non-linearity correction is computed"
00089
00090 #define DETMON_QC_LIN_COEF "ESO QC LIN COEF"
00091 #define DETMON_QC_LIN_COEF_C "Linearity coefficient value"
00092
00093
00094 #define DETMON_QC_LIN_COEF_ERR "ESO QC LIN EFF ERR"
00095 #define DETMON_QC_LIN_COEF_ERR_C "Linearity coefficient error value"
00096 #define DETMON_QC_LIN_COEF_MSE_ERR_C "Linearity coefficient measured square error value"
00097
00098
00099 #define DETMON_QC_ERRFIT "ESO QC ERRFIT"
00100 #define DETMON_QC_ERRFIT_C "Error of fit"
00101 #define DETMON_QC_ERRFIT_MSE_C "Measured square error of fit"
00102
00103
00104 #define DETMON_QC_CONTAM "ESO QC CONTAM"
00105 #define DETMON_QC_CONTAM_C "Detector contamination in a region"
00106
00107 #define DETMON_QC_FPN "ESO QC FPN"
00108 #define DETMON_QC_FPN_C "Flat pattern noise"
00109
00110
00111 #define xsh_detmon_lg_get_description(RECIPE_NAME, PIPE_NAME, \
00112 DETMON_IR_LG_ON_RAW, \
00113 DETMON_IR_LG_OFF_RAW) \
00114 RECIPE_NAME " -- " PIPE_NAME " linearity/gain recipe for OPT/IR.\n" \
00115 "The files listed in the Set Of Frames must be tagged:\n" \
00116 "the raw-on-file.fits "DETMON_IR_LG_ON_RAW" and\n" \
00117 "the raw-off-file.fits "DETMON_IR_LG_OFF_RAW"\n" \
00118 "The recipe requires at least order+1 valid pairs of ON frames\n" \
00119 "and order+1 valid pairs of OFF frames, \n" \
00120 "where order is the value of the 'order' parameter.\n" \
00121 "There is no requirement for pairs of OFF frames if collapse parameter" \
00122 "is set to true.\n" \
00123 "Frames with median flux over --filter will be excluded from the" \
00124 "computation.\n" \
00125 "To perform a stability check you need frames with at least 2 DIT" \
00126 "values\n" \
00127 "NOTE for multiextension cases: it is mandatory to modify the --exts" \
00128 "parameter, either to -1 (all extensions) or to any valid extension nb.\n"
00129
00130 #define REGEXP "ARCFILE|MJD-OBS|ESO TPL ID|DATE-OBS|ESO DET DIT|ESO DET NDIT"
00131
00132 typedef unsigned long irplib_gain_flag;
00133
00134 #define IRPLIB_GAIN_PTC ((irplib_gain_flag) 1 << 1)
00135 #define IRPLIB_GAIN_MEDIAN ((irplib_gain_flag) 1 << 2)
00136 #define IRPLIB_GAIN_NO_COLLAPSE ((irplib_gain_flag) 1 << 3)
00137 #define IRPLIB_GAIN_COLLAPSE ((irplib_gain_flag) 1 << 4)
00138 #define IRPLIB_GAIN_WITH_AUTOCORR ((irplib_gain_flag) 1 << 5)
00139 #define IRPLIB_GAIN_WITH_RESCALE ((irplib_gain_flag) 1 << 6)
00140 #define IRPLIB_GAIN_OPT ((irplib_gain_flag) 1 << 7)
00141 #define IRPLIB_GAIN_NIR ((irplib_gain_flag) 1 << 8)
00142
00143 typedef unsigned long irplib_lin_flag;
00144
00145 #define IRPLIB_LIN_NO_COLLAPSE ((irplib_lin_flag) 1 << 10)
00146 #define IRPLIB_LIN_COLLAPSE ((irplib_lin_flag) 1 << 11)
00147 #define IRPLIB_LIN_PIX2PIX ((irplib_lin_flag) 1 << 12)
00148 #define IRPLIB_LIN_WITH_RESCALE ((irplib_lin_flag) 1 << 13)
00149 #define IRPLIB_LIN_OPT ((irplib_lin_flag) 1 << 14)
00150 #define IRPLIB_LIN_NIR ((irplib_lin_flag) 1 << 15)
00151
00152 cpl_error_code
00153 xsh_detmon_lg(cpl_frameset * frameset,
00154 const cpl_parameterlist * parlist,
00155 const char * tag_on,
00156 const char * tag_off,
00157 const char * recipe_name,
00158 const char * pipeline_name,
00159 const char * pafregexp,
00160 const cpl_propertylist * pro_lintbl,
00161 const cpl_propertylist * pro_gaintbl,
00162 const cpl_propertylist * pro_coeffscube,
00163 const cpl_propertylist * pro_bpm,
00164 const cpl_propertylist * pro_corr,
00165 const cpl_propertylist * pro_diff,
00166 const char * package,
00167 int (* compare) (const cpl_frame *,
00168 const cpl_frame *),
00169 int (* load_fset) (const cpl_frameset *,
00170 cpl_type,
00171 cpl_imagelist *),
00172 const cpl_boolean opt_nir);
00173
00174
00175 cpl_image * xsh_detmon_image_correlate(const cpl_image *,
00176 const cpl_image *,
00177 const int ,
00178 const int );
00179
00180 cpl_error_code
00181 xsh_detmon_lg_fill_parlist_nir_default(cpl_parameterlist *,
00182 const char *,
00183 const char *);
00184
00185 cpl_error_code
00186 xsh_detmon_lg_fill_parlist_opt_default(cpl_parameterlist *,
00187 const char *,
00188 const char *);
00189
00190 cpl_error_code
00191 xsh_detmon_lg_fill_parlist(cpl_parameterlist * parlist,
00192 const char *recipe_name, const char *pipeline_name,
00193 const char *method,
00194 int order,
00195 double kappa,
00196 int niter,
00197 int llx,
00198 int lly,
00199 int urx,
00200 int ury,
00201 int ref_level,
00202 const char * intermediate,
00203 const char * autocorr,
00204 const char * collapse,
00205 const char * rescale,
00206 const char * pix2pix,
00207 const char * bpmbin,
00208 int filter,
00209 int m,
00210 int n,
00211 double tolerance,
00212 const char * pafgen,
00213 const char * pafname,
00214 int llx1,
00215 int lly1,
00216 int urx1,
00217 int ury1,
00218 int llx2,
00219 int lly2,
00220 int urx2,
00221 int ury2,
00222 int llx3,
00223 int lly3,
00224 int urx3,
00225 int ury3,
00226 int llx4,
00227 int lly4,
00228 int urx4,
00229 int ury4,
00230 int llx5,
00231 int lly5,
00232 int urx5,
00233 int ury5,
00234 int exts,
00235 cpl_boolean opt_nir);
00236
00237 cpl_image *
00238 xsh_detmon_autocorrelate(const cpl_image *,
00239 const int, const int);
00240
00241 cpl_table *
00242 xsh_detmon_gain(const cpl_imagelist *,
00243 const cpl_imagelist *,
00244 const cpl_vector *,
00245 const cpl_vector *,
00246 double ,
00247 int ,
00248 int ,
00249 int ,
00250 int ,
00251 double ,
00252 int ,
00253 int ,
00254 int ,
00255 cpl_propertylist *,
00256 unsigned ,
00257 cpl_imagelist **,
00258 cpl_imagelist **);
00259
00260 cpl_table *
00261 xsh_detmon_lin(const cpl_imagelist *,
00262 const cpl_imagelist *,
00263 const cpl_vector *,
00264 double ,
00265 int ,
00266 int ,
00267 int ,
00268 int ,
00269 int ,
00270 int ,
00271 double,
00272 cpl_boolean,
00273 cpl_propertylist *,
00274 unsigned ,
00275 cpl_imagelist **,
00276 cpl_image **);
00277
00278 #endif