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
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"
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_COEF "ESO QC LIN COEF"
00088 #define DETMON_QC_LIN_COEF_C "Linearity coefficient value"
00089
00090
00091 #define DETMON_QC_LIN_COEF_ERR "ESO QC LIN EFF ERR"
00092 #define DETMON_QC_LIN_COEF_ERR_C "Linearity coefficient error value"
00093 #define DETMON_QC_LIN_COEF_MSE_ERR_C "Linearity coefficient measured square error value"
00094
00095
00096 #define DETMON_QC_ERRFIT "ESO QC ERRFIT"
00097 #define DETMON_QC_ERRFIT_C "Error of fit"
00098 #define DETMON_QC_ERRFIT_MSE_C "Measured square error of fit"
00099
00100
00101 #define DETMON_QC_CONTAM "ESO QC CONTAM"
00102 #define DETMON_QC_CONTAM_C "Detector contamination in a region"
00103
00104
00105 #define irplib_detmon_lg_get_description(RECIPE_NAME, PIPE_NAME, \
00106 DETMON_IR_LG_ON_RAW, \
00107 DETMON_IR_LG_OFF_RAW) \
00108 RECIPE_NAME " -- " PIPE_NAME " linearity/gain recipe for IR.\n" \
00109 "The files listed in the Set Of Frames must be tagged:\n" \
00110 "the raw-on-file.fits "DETMON_IR_LG_ON_RAW" and\n" \
00111 "the raw-off-file.fits "DETMON_IR_LG_OFF_RAW"\n" \
00112 "The recipe requires at least order+1 valid pairs of ON frames\n" \
00113 "and order+1 valid pairs of OFF frames, \n" \
00114 "where order is the value of the 'order' parameter.\n" \
00115 "There is no requirement for pairs of OFF frames if collapse parameter" \
00116 "is set to true.\n" \
00117 "Frames with median flux over --filter will be excluded from the" \
00118 "computation.\n" \
00119 "To perform a stability check you need frames with at least 2 DIT" \
00120 "values\n" \
00121 "NOTE for multiextension cases: it is mandatory to modify the --exts" \
00122 "parameter, either to -1 (all extensions) or to any valid extension nb.\n"
00123
00124 #define REGEXP "ARCFILE|MJD-OBS|ESO TPL ID|DATE-OBS|ESO DET DIT|ESO DET NDIT"
00125
00126 typedef unsigned long gain_flag;
00127
00128 #define IRPLIB_GAIN_PTC ((gain_flag) 1 << 1)
00129 #define IRPLIB_GAIN_MEDIAN ((gain_flag) 1 << 2)
00130 #define IRPLIB_GAIN_NO_COLLAPSE ((gain_flag) 1 << 3)
00131 #define IRPLIB_GAIN_COLLAPSE ((gain_flag) 1 << 4)
00132 #define IRPLIB_GAIN_WITH_AUTOCORR ((gain_flag) 1 << 5)
00133 #define IRPLIB_GAIN_WITH_RESCALE ((gain_flag) 1 << 6)
00134 #define IRPLIB_GAIN_OPT ((gain_flag) 1 << 7)
00135 #define IRPLIB_GAIN_NIR ((gain_flag) 1 << 8)
00136
00137 typedef unsigned long lin_flag;
00138
00139 #define IRPLIB_LIN_NO_COLLAPSE ((lin_flag) 1 << 10)
00140 #define IRPLIB_LIN_COLLAPSE ((lin_flag) 1 << 11)
00141 #define IRPLIB_LIN_PIX2PIX ((lin_flag) 1 << 12)
00142 #define IRPLIB_LIN_WITH_RESCALE ((lin_flag) 1 << 13)
00143 #define IRPLIB_LIN_OPT ((lin_flag) 1 << 14)
00144 #define IRPLIB_LIN_NIR ((lin_flag) 1 << 15)
00145
00146 cpl_error_code
00147 irplib_detmon_lg(cpl_frameset *,
00148 const cpl_parameterlist *,
00149 const char *,
00150 const char *,
00151 const char *,
00152 const char *,
00153 const char *,
00154 const cpl_propertylist *,
00155 const cpl_propertylist *,
00156 const cpl_propertylist *,
00157 const cpl_propertylist *,
00158 const cpl_propertylist *,
00159 const cpl_propertylist *,
00160 const char *,
00161 int (*)(const cpl_frame *,
00162 const cpl_frame *),
00163 int (* load_fset) (const cpl_frameset *,
00164 cpl_type,
00165 cpl_imagelist *),
00166 const cpl_boolean );
00167
00168
00169 cpl_image * irplib_detmon_image_correlate(const cpl_image *,
00170 const cpl_image *,
00171 const int ,
00172 const int );
00173
00174 cpl_error_code
00175 irplib_detmon_lg_fill_parlist_nir_default(cpl_parameterlist *,
00176 const char *,
00177 const char *);
00178
00179 cpl_error_code
00180 irplib_detmon_lg_fill_parlist_opt_default(cpl_parameterlist *,
00181 const char *,
00182 const char *);
00183
00184 cpl_error_code
00185 irplib_detmon_lg_fill_parlist(cpl_parameterlist * parlist,
00186 const char *recipe_name, const char *pipeline_name,
00187 const char *method,
00188 int order,
00189 double kappa,
00190 int niter,
00191 int llx,
00192 int lly,
00193 int urx,
00194 int ury,
00195 int ref_level,
00196 const char * intermediate,
00197 const char * autocorr,
00198 const char * collapse,
00199 const char * rescale,
00200 const char * pix2pix,
00201 const char * bpmbin,
00202 int filter,
00203 int m,
00204 int n,
00205 double tolerance,
00206 const char * pafname,
00207 int llx1,
00208 int lly1,
00209 int urx1,
00210 int ury1,
00211 int llx2,
00212 int lly2,
00213 int urx2,
00214 int ury2,
00215 int llx3,
00216 int lly3,
00217 int urx3,
00218 int ury3,
00219 int llx4,
00220 int lly4,
00221 int urx4,
00222 int ury4,
00223 int llx5,
00224 int lly5,
00225 int urx5,
00226 int ury5,
00227 int exts,
00228 cpl_boolean opt_nir);
00229
00230 cpl_image *
00231 irplib_detmon_autocorrelate(const cpl_image *,
00232 const int, const int);
00233
00234 cpl_table *
00235 irplib_detmon_gain(const cpl_imagelist *,
00236 const cpl_imagelist *,
00237 const cpl_vector *,
00238 double ,
00239 int ,
00240 int ,
00241 int ,
00242 int ,
00243 double ,
00244 int ,
00245 int ,
00246 int ,
00247 cpl_propertylist *,
00248 unsigned ,
00249 cpl_imagelist **,
00250 cpl_imagelist **);
00251
00252 cpl_table *
00253 irplib_detmon_lin(const cpl_imagelist *,
00254 const cpl_imagelist *,
00255 const cpl_vector *,
00256 double ,
00257 int ,
00258 int ,
00259 int ,
00260 int ,
00261 int ,
00262 int ,
00263 double,
00264 cpl_boolean,
00265 cpl_propertylist *,
00266 unsigned ,
00267 cpl_imagelist **,
00268 cpl_image **);
00269
00270 #endif