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