irplib_detmon.h

00001 /* $Id: irplib_detmon.h,v 1.53 2009/02/27 11:49:15 lbilbao Exp $
00002  *
00003  * This file is part of the irplib package
00004  * Copyright (C) 2002, 2003 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
00019  */
00020 
00021 /*
00022  * $Author: lbilbao $
00023  * $Date: 2009/02/27 11:49:15 $
00024  * $Revision: 1.53 $
00025  * $Name: visir-3_2_2 $
00026  */
00027 
00028 #ifndef IRPLIB_DETMON_H
00029 #define IRPLIB_DETMON_H
00030 
00031 /*----------------------------------------------------------------------------
00032                                    Includes
00033  ----------------------------------------------------------------------------*/
00034 
00035 #include <cpl.h>
00036 
00037 /*----------------------------------------------------------------------------
00038                                    Prototypes
00039  ----------------------------------------------------------------------------*/
00040 
00041 
00042 #define NIR TRUE
00043 #define OPT FALSE
00044 
00045 #define DETMON_QC_FREQ       "ESO QC FREQ"
00046 #define DETMON_QC_FREQ_C     "Spectrum frequency"
00047 
00048 #define DETMON_QC_POW       "ESO QC POW"
00049 #define DETMON_QC_POW_C     "Spectrum power"
00050 
00051 #define DETMON_QC_DUTYCYCL       "ESO QC DUTYCYCL"
00052 #define DETMON_QC_DUTYCYCL_C     "DUTYCYCL value (time to store a frame)"
00053 
00054 #define DETMON_QC_MASTER_MEAN    "ESO QC MASTER MEAN"
00055 #define DETMON_QC_MASTER_MEAN_C  "Master Mean value"
00056 
00057 #define DETMON_QC_MASTER_RMS    "ESO QC MASTER RMS"
00058 #define DETMON_QC_MASTER_RMS_C  "Master RMS value"
00059 
00060 #define DETMON_QC_NBCOLDPIX    "ESO QC NBCOLPIX"
00061 #define DETMON_QC_NBCOLDPIX_C  "Number of cold pixels"
00062 
00063 #define DETMON_QC_NBHOTPIX    "ESO QC NBHOTPIX"
00064 #define DETMON_QC_NBHOTPIX_C  "Number of hot pixels"
00065 
00066 #define DETMON_QC_NBDEVPIX    "ESO QC NBDEVPIX"
00067 #define DETMON_QC_NBDEVPIX_C  "Number of deviating pixels"
00068 
00069 #define DETMON_QC_BIAS_RANDOM_VAL    "ESO QC BIAS RANDOM VAL"
00070 #define DETMON_QC_BIAS_RANDOM_VAL_C  "Bias level (random sampling method) [ADU]"
00071 
00072 #define DETMON_QC_BIAS_RANDOM_RON    "ESO QC BIAS RANDOM RON"
00073 #define DETMON_QC_BIAS_RANDOM_RON_C  "Bias Read Out Noise (random sampling method) [ADU]"
00074 
00075 #define DETMON_QC_BIAS_HISTO_VAL    "ESO QC BIAS HISTO VAL"
00076 #define DETMON_QC_BIAS_HISTO_VAL_C  "Bias level (histogram method) [ADU]"
00077 
00078 #define DETMON_QC_BIAS_HISTO_RON    "ESO QC BIAS HISTO RON"
00079 #define DETMON_QC_BIAS_HISTO_RON_C  "Bias Read Out Noise (histogram method) [e- rms]"
00080 
00081 #define DETMON_QC_BIAS_PRESCAN_MEAN    "ESO QC BIAS PRESCAN MEAN"
00082 #define DETMON_QC_BIAS_PRESCAN_MEAN_C  "Bias mean level (on prescan region) [ADU]"
00083 
00084 #define DETMON_QC_BIAS_PRESCAN_MED    "ESO QC BIAS PRESCAN MED"
00085 #define DETMON_QC_BIAS_PRESCAN_MED_C  "Bias median level (on prescan region) [ADU]"
00086 
00087 #define DETMON_QC_BIAS_PRESCAN_RON    "ESO QC BIAS PRESCAN RON"
00088 #define DETMON_QC_BIAS_PRESCAN_RON_C  "Bias Read Out Noise (on prescan region) [e- rms]"
00089 
00090 
00091 #define DETMON_QC_BIAS_OVERSCAN_MEAN    "ESO QC BIAS OVERSCAN MEAN"
00092 #define DETMON_QC_BIAS_OVERSCAN_MEAN_C  "Bias mean level (on overscan region) [ADU]"
00093 
00094 #define DETMON_QC_BIAS_OVERSCAN_MED    "ESO QC BIAS OVERSCAN MED"
00095 #define DETMON_QC_BIAS_OVERSCAN_MED_C  "Bias median level (on overscan region) [ADU]"
00096 
00097 #define DETMON_QC_BIAS_OVERSCAN_RON    "ESO QC BIAS OVERSCAN RON"
00098 #define DETMON_QC_BIAS_OVERSCAN_RON_C  "Bias Read Out Noise (on overscan region) [e- rms]"
00099 
00100 #define DETMON_QC_BIAS_REGION_VAL    "ESO QC BIAS REGION VAL"
00101 #define DETMON_QC_BIAS_REGION_VAL_C  "Bias level (on user defined region) [ADU]"
00102 
00103 #define DETMON_QC_BIAS_REGION_MED    "ESO QC BIAS REGION MED"
00104 #define DETMON_QC_BIAS_REGION_MED_C  "Bias median level (on user defined region) [ADU]"
00105 
00106 #define DETMON_QC_BIAS_REGION_RON    "ESO QC BIAS REGION RON"
00107 #define DETMON_QC_BIAS_REGION_RON_C  "Bias Read Out Noise (on user defined region) [e- rms]"
00108 
00109 
00110 #define DETMON_QC_DARK    "ESO QC DARK"
00111 #define DETMON_QC_DARK_C  "Dark level [ADU]"
00112 
00113 #define DETMON_QC_DARK_STDEV    "ESO QC DARK STDEV"
00114 #define DETMON_QC_DARK_STDEV_C  "Dark stdev level [ADU]"
00115 
00116 
00117 
00118 /* Macros to generate the recipe(s) description(s) */
00119 #define irplib_detmon_ronbias_get_description(RECIPE_NAME, PIPE_NAME,          \
00120                                               DETMON_RONBIAS_RAW)              \
00121     RECIPE_NAME " -- " PIPE_NAME " linearity/gain recipe for IR.\n"            \
00122     "The files listed in the Set Of Frames must be tagged:\n"                  \
00123     "raw-file.fits  "DETMON_RONBIAS_RAW"\n"
00124 
00125 #define irplib_detmon_pernoise_get_description(RECIPE_NAME, PIPE_NAME,         \
00126                                               DETMON_PERNOISE_RAW)             \
00127     RECIPE_NAME " -- " PIPE_NAME " Recipe for Periodic Noise Characterisation.\n"            \
00128     "The files listed in the Set Of Frames must be tagged:\n"                  \
00129     "raw-file.fits  "DETMON_PERNOISE_RAW"\n"
00130 
00131 #define irplib_detmon_dark_get_description(RECIPE_NAME, PIPE_NAME,         \
00132                                               DETMON_DARK_RAW)             \
00133     RECIPE_NAME " -- " PIPE_NAME " Dark Recipe.\n"            \
00134     "The files listed in the Set Of Frames must be tagged:\n"                  \
00135     "raw-file.fits  "DETMON_DARK_RAW"\n"
00136 
00137 #define RANDOM       ((ronbias_method) 1 << 1)
00138 #define HISTO        ((ronbias_method) 1 << 2)
00139 #define PREOVERSCAN  ((ronbias_method) 1 << 3)
00140 #define REGION       ((ronbias_method) 1 << 4)
00141 
00142 typedef unsigned long ronbias_method;
00143 
00144 #undef REGEXP
00145 #define REGEXP "ARCFILE|MJD-OBS|ESO TPL ID|DATE-OBS|ESO DET DIT|ESO DET NDIT"
00146 
00147 #if defined CPL_VERSION_CODE && CPL_VERSION_CODE < CPL_VERSION(4, 2, 0) 
00148 
00149 #define CPL_DFS_PRO_CATG     "ESO PRO CATG"
00150 #define CPL_DFS_PRO_TYPE     "ESO PRO TYPE"
00151 #define CPL_DFS_PRO_SCIENCE  "ESO PRO SCIENCE"
00152 #define CPL_DFS_PRO_TECH     "ESO PRO TECH"
00153 
00154 #endif
00155 
00156 cpl_image * 
00157 irplib_imagelist_collapse_stdev_create(const cpl_imagelist * imlist);
00158 
00159 cpl_error_code
00160 irplib_detmon_ronbias(cpl_frameset      *,
00161                       const cpl_parameterlist *,
00162                       const char        *,
00163                       const char        *,
00164                       const char        *,
00165                       const char        *,
00166               const cpl_propertylist *,
00167               const cpl_propertylist *,
00168               const cpl_propertylist *,
00169               const cpl_propertylist *,
00170               const cpl_propertylist *,
00171               const cpl_propertylist *,
00172               const cpl_propertylist *,
00173                       const char        *,
00174                       int              (*)(const cpl_frame *,
00175                                            const cpl_frame *),
00176                       cpl_boolean);
00177 
00178 cpl_propertylist *
00179 irplib_detmon_fill_prolist(const char *,
00180                const char *,
00181                const char *,
00182                cpl_boolean);
00183 
00184 cpl_error_code
00185 irplib_detmon_ronbias_fill_parlist_default(cpl_parameterlist *,
00186                        const char        *,
00187                        const char        *);
00188 
00189 cpl_error_code
00190 irplib_detmon_darkron_fill_parlist_default(cpl_parameterlist *,
00191                        const char        *,
00192                        const char        *);
00193 
00194 cpl_error_code
00195 irplib_detmon_ronbias_fill_parlist(cpl_parameterlist *,
00196                    const char *,
00197                    const char *,
00198                    const char *,
00199                    const char *,
00200                    const int,
00201                    const int,
00202                    const int,
00203                    const int,
00204                    const int,
00205                    const int,
00206                    const int,
00207                    const int,
00208                    const int,
00209                    const char *,
00210                    const int,
00211                    const int,
00212                    const int,
00213                    const int,
00214                    const int,
00215                    const int,
00216                    const int,
00217                    const int,
00218                    const int,
00219                    const int,
00220                                    cpl_boolean);
00221 
00222 
00223 cpl_error_code
00224 irplib_detmon_fill_pernoise_params(cpl_parameterlist *,
00225                                    const char *,
00226                                    const char *,
00227                                    int mode,
00228                                    const char *direction,
00229                                    double speed,
00230                                    int llx,
00231                                    int lly,
00232                                    int urx,
00233                                    int ury,
00234                                    double kappa,
00235                                    int exts);
00236 
00237 int irplib_detmon_fill_pernoise_params_default(cpl_parameterlist        *,
00238                               const char        *,
00239                               const char        *);
00240 
00241 cpl_error_code
00242 irplib_detmon_pernoise(cpl_frameset      *,
00243                       const cpl_parameterlist *,
00244                       const char        *,
00245                       const char        *,
00246                       const char        *,
00247                       const char        *,
00248                       const char        *,
00249                       int              (*)(const cpl_frame *,
00250                                            const cpl_frame *));
00251 
00252 cpl_table *
00253 irplib_detmon_pernoise_reduce(cpl_image       *);
00254 
00255 cpl_error_code
00256 irplib_detmon_dark(cpl_frameset      *,
00257                    const cpl_parameterlist *,
00258                    const char        *,
00259                    const char        *,
00260                    const char        *,
00261                    const char        *,
00262                    const char        *,
00263                    const char        *,
00264                    const char        *,
00265                    int              (*)(const cpl_frame *,
00266                                         const cpl_frame *));
00267 
00268 cpl_error_code
00269 irplib_detmon_fill_dark_params(cpl_parameterlist * parlist,
00270                                const char *recipe_name,
00271                                const char *pipeline_name,
00272                                const char * ron_method,
00273                                const char * dsnu_method,
00274                                const char * optnir,
00275                                int exts);
00276 
00277 int
00278 irplib_detmon_fill_dark_params_default(cpl_parameterlist * parlist,
00279                                        const char *recipe_name,
00280                                        const char *pipeline_name);
00281 
00282 int
00283 irplib_detmon_compare_dits(const cpl_frame *, const cpl_frame *);
00284 
00285 double                  irplib_pfits_get_exptime(const cpl_propertylist *);
00286 
00287 cpl_error_code
00288 irplib_detmon_fill_parlist(cpl_parameterlist *,
00289                            const char *, const char *, int, ...);
00290 
00291 cpl_error_code
00292 irplib_ksigma_clip(const cpl_image *,
00293            const int,
00294            const int,
00295            const int,
00296            const int,
00297            const double,
00298            const int,
00299            const double,
00300            double *,
00301            double *);
00302 int
00303 irplib_detmon_retrieve_par_int(const char *,
00304                             const char *,
00305                             const char *, const cpl_parameterlist *);
00306 
00307 double
00308 irplib_detmon_retrieve_par_double(const char *,
00309                             const char *,
00310                             const char *, const cpl_parameterlist *);
00311 
00312 
00313 #endif

Generated on Fri Jul 3 11:15:22 2009 for VISIR Pipeline Reference Manual by  doxygen 1.5.8