sinfo_lingain.c

00001 /* $Id: sinfo_lingain.c,v 1.15 2011/03/01 16:54:21 amodigli Exp $
00002  *
00003  * This file is part of the DETMON Pipeline
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: amodigli $
00023  * $Date: 2011/03/01 16:54:21 $
00024  * $Revision: 1.15 $
00025  * $Name: HEAD $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*----------------------------------------------------------------------------
00033                              Includes and Defines
00034  ----------------------------------------------------------------------------*/
00035 
00036 #include <cpl.h>
00037 
00038 #include "irplib_detmon.h"
00039 #include "irplib_detmon_lg.h"
00040 #include "irplib_plugin.h"
00041 
00042 /* Define here the DO.CATG keywords */
00043 #define SINFO_LINGAIN_ON_RAW                    "ON_RAW"
00044 #define SINFO_LINGAIN_OFF_RAW           "OFF_RAW"
00045 
00046 #define RECIPE_NAME "sinfo_lingain"
00047 
00048 /* Copy here instrument specific keywords which need to be in the PAF file */
00049 #define INSTREGEXP   "ESO INS SETUP ID"
00050 
00051 #define PAFREGEXP    "^(" REGEXP "|" INSTREGEXP ")$"
00052 
00053 #define NIR TRUE
00054 
00055 /*----------------------------------------------------------------------------
00056                  Functions prototypes
00057  ----------------------------------------------------------------------------*/
00058 
00059 cpl_error_code
00060 sinfo_lingain_fill_parlist_default(cpl_parameterlist * parlist,
00061                                   const char *recipe_name,
00062                    const char *pipeline_name);
00063 
00064 IRPLIB_RECIPE_DEFINE(sinfo_lingain, DETMON_BINARY_VERSION,
00065              /* Replace DETMON_BINARY_VERSION with
00066             corresponding pipeline macro */
00067                      sinfo_lingain_fill_parlist_default(recipe->parameters,
00068                                RECIPE_NAME, "sinfoni"),
00069              /* Replace "sinfoni" with PACKAGE_TARNAME
00070             when moved into SINFONI */
00071                      "Lander de Bilbao", PACKAGE_BUGREPORT, "2007", 
00072                      "Linearity/Gain recipe for the IR domain",
00073                      irplib_detmon_lg_get_description(RECIPE_NAME, "SINFONI",
00074                                                       SINFO_LINGAIN_ON_RAW,
00075                                                       SINFO_LINGAIN_OFF_RAW));
00076 
00077 
00078 /*---------------------------------------------------------------------------*/
00079 /*
00080   @brief    Interpret the command line options and execute the data processing
00081   @param    frameset    the frames list
00082   @param    parlist     the parameters list
00083   @return   0 if everything is ok
00084  */
00085 /*---------------------------------------------------------------------------*/
00086 
00087 static int sinfo_lingain(cpl_frameset            * frameset,
00088              const cpl_parameterlist * parlist)
00089 {
00090     cpl_propertylist * lintbl = 
00091     irplib_detmon_fill_prolist("DET_LIN_INFO", "REDUCED", "TECH", CPL_FALSE);
00092 
00093     cpl_propertylist * gaintbl = 
00094     irplib_detmon_fill_prolist("GAIN_INFO",    "REDUCED", "TECH", CPL_FALSE);
00095 
00096     cpl_propertylist * coeffscube = 
00097     irplib_detmon_fill_prolist("COEFFS_CUBE",  "REDUCED", "TECH", CPL_FALSE);
00098 
00099     cpl_propertylist * bpm = 
00100     irplib_detmon_fill_prolist("BP_MAP_NL",    "REDUCED", "TECH", CPL_FALSE);
00101 
00102     cpl_propertylist * corr = 
00103     irplib_detmon_fill_prolist("AUTOCORR",     "REDUCED", "TECH", CPL_FALSE);
00104 
00105     cpl_propertylist * diff_flat = 
00106     irplib_detmon_fill_prolist("DIFF_FLAT",    "REDUCED", "TECH", CPL_FALSE);
00107 
00108     const cpl_error_code error = irplib_detmon_lg(frameset,
00109                                                   parlist,
00110                                                   SINFO_LINGAIN_ON_RAW,
00111                                                   SINFO_LINGAIN_OFF_RAW,
00112                                                   RECIPE_NAME,
00113     /* Replace this string ("sinfoni") with */    "sinfoni",
00114     /* PACKAGE_TARNAME when moved into SINFONI */ PAFREGEXP,
00115                                                   lintbl, gaintbl, coeffscube,
00116                           bpm, corr, diff_flat,
00117                                                   PACKAGE "/" PACKAGE_VERSION,
00118                                                   NULL, NULL, NIR);
00119 
00120     cpl_propertylist_delete(lintbl);
00121     cpl_propertylist_delete(gaintbl);
00122     cpl_propertylist_delete(coeffscube);
00123     cpl_propertylist_delete(bpm);
00124     cpl_propertylist_delete(corr);
00125     cpl_propertylist_delete(diff_flat);
00126 
00127     /* Propagate the error, if any */
00128     cpl_ensure_code(!error, error);
00129 
00130     return CPL_ERROR_NONE;
00131 }
00132 
00133 cpl_error_code
00134 sinfo_lingain_fill_parlist_default(cpl_parameterlist * parlist,
00135                                   const char *recipe_name,
00136                                   const char *pipeline_name)
00137 {
00138     const cpl_error_code error = 
00139     irplib_detmon_lg_fill_parlist(parlist, recipe_name, pipeline_name,
00140                   "PTC", /* --method */
00141                   3,   /* --order         */
00142                               3,        /* --kappa         */
00143                               25,       /* --niter         */
00144                               -1,       /* --llx           */
00145                               -1,       /* --lly           */
00146                               -1,       /* --urx           */
00147                               -1,       /* --ury           */
00148                               10000,    /* --ref_level     */
00149                               "CPL_FALSE",      /* --intermediate  */
00150                               "CPL_FALSE",      /* --autocorr      */
00151                               "CPL_FALSE",      /* --collapse      */
00152                               "CPL_TRUE",       /* --rescale       */
00153                       "CPL_TRUE",/* --pix2pix */
00154                       "CPL_TRUE", /* --bpmbin */
00155                               -1,       /* --filter        */
00156                               26,       /* --m             */
00157                               26,       /* --n             */
00158                       1e-3, NULL,
00159                               -1,       /* --llx1          */
00160                               -1,       /* --lly1          */
00161                               -1,       /* --urx1          */
00162                               -1,       /* --ury1          */
00163                               -1,       /* --llx2          */
00164                               -1,       /* --lly2          */
00165                               -1,       /* --urx2          */
00166                               -1,       /* --ury2          */
00167                               -1,       /* --llx3          */
00168                               -1,       /* --lly3          */
00169                               -1,       /* --urx3          */
00170                               -1,       /* --ury3          */
00171                               -1,       /* --llx4          */
00172                               -1,       /* --lly4          */
00173                               -1,       /* --urx4          */
00174                               -1,       /* --ury4          */
00175                               -1,       /* --llx5          */
00176                               -1,       /* --lly5          */
00177                               -1,       /* --urx5          */
00178                               -1,       /* --ury5          */
00179                       0,      /* --exts */
00180                           NIR);       /* This is to specify OPT params */
00181 
00182 
00183     cpl_ensure_code(!error, error);
00184 
00185     return cpl_error_get_code();
00186 }

Generated on 1 Mar 2011 for DETMON Pipeline Reference Manual by  doxygen 1.6.1