GIRAFFE Pipeline Reference Manual

giccdlin.c

00001 /* $Id: giccdlin.c,v 1.6 2011/03/03 09:34:26 rpalsa Exp $
00002  *
00003  * This file is part of the GIRAFFE Pipeline
00004  * Copyright (C) 2002-2008 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  02110-1301  USA
00019  */
00020 
00021 /*
00022  * $Author: rpalsa $
00023  * $Date: 2011/03/03 09:34:26 $
00024  * $Revision: 1.6 $
00025  * $Name: giraffe-2_8_8 $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #  include <config.h>
00030 #endif
00031 
00032 #include <cxmessages.h>
00033 #include <cxmemory.h>
00034 
00035 #include <cpl_recipe.h>
00036 #include <cpl_plugininfo.h>
00037 #include <cpl_parameterlist.h>
00038 #include <cpl_frameset.h>
00039 #include <cpl_msg.h>
00040 
00041 #include "giframe.h"
00042 #include "gierror.h"
00043 #include "giutils.h"
00044 
00045 #include "irplib_detmon.h"
00046 #include "irplib_detmon_lg.h"
00047 
00048 
00049 static cxint giccdlin(cpl_parameterlist* config, cpl_frameset* set);
00050 
00051 
00052 /*
00053  * Create the recipe instance, i.e. setup the parameter list for this
00054  * recipe and make it available to the application using the interface.
00055  */
00056 
00057 static cxint
00058 giccdlin_create(cpl_plugin* plugin)
00059 {
00060 
00061     cpl_recipe* recipe = (cpl_recipe*)plugin;
00062 
00063 
00064     giraffe_error_init();
00065 
00066 
00067     /*
00068      * We have to provide the option we accept to the application. We
00069      * need to setup our parameter list and hook it into the recipe
00070      * interface.
00071      */
00072 
00073     recipe->parameters = cpl_parameterlist_new();
00074     cx_assert(recipe->parameters != NULL);
00075 
00076 
00077     /*
00078      * Fill the parameter list. All parameters are kept at the default values
00079      * with the expection of the tolerance and the pafname.
00080      */
00081 
00082     irplib_detmon_lg_fill_parlist(recipe->parameters, "giccdlin", "giraffe",
00083             "PTC",           /* --method */
00084             3,               /* --order */
00085             3,               /* --kappa */
00086             25,              /* --niter */
00087             -1,              /* --llx */
00088             -1,              /* --lly */
00089             -1,              /* --urx */
00090             -1,              /* --ury */
00091             10000,           /* --ref_level */
00092             "CPL_FALSE",     /* --intermediate */
00093             "CPL_FALSE",     /* --autocorr */
00094             "CPL_TRUE",      /* --collapse */
00095             "CPL_TRUE",      /* --rescale */
00096             "CPL_FALSE",     /* --pix2pix */
00097             "CPL_FALSE",     /* --bpmbin */
00098             -1,              /* --filter */
00099             26,              /* --m */
00100             26,              /* --n */
00101             0.1,             /* --tolerance */
00102             "CPL_FALSE",     /* --pafgen */
00103             "giccdlin",      /* --pafname */
00104             -1,              /* --llx1 */
00105             -1,              /* --lly1 */
00106             -1,              /* --urx1 */
00107             -1,              /* --ury1 */
00108             -1,              /* --llx2 */
00109             -1,              /* --lly2 */
00110             -1,              /* --urx2 */
00111             -1,              /* --ury2 */
00112             -1,              /* --llx3 */
00113             -1,              /* --lly3 */
00114             -1,              /* --urx3 */
00115             -1,              /* --ury3 */
00116             -1,              /* --llx4 */
00117             -1,              /* --lly4 */
00118             -1,              /* --urx4 */
00119             -1,              /* --ury4 */
00120             -1,              /* --llx5 */
00121             -1,              /* --lly5 */
00122             -1,              /* --urx5 */
00123             -1,              /* --ury5 */
00124             0,               /* --exts */
00125             OPT);
00126 
00127 
00128     if (cpl_error_get_code() != CPL_ERROR_NONE) {
00129         return 1;
00130     }
00131 
00132     return 0;
00133 
00134 }
00135 
00136 
00137 /*
00138  * Execute the plugin instance given by the interface.
00139  */
00140 
00141 static cxint
00142 giccdlin_exec(cpl_plugin* plugin)
00143 {
00144 
00145     cpl_recipe* recipe = (cpl_recipe*)plugin;
00146 
00147 
00148     cx_assert(recipe->parameters != NULL);
00149     cx_assert(recipe->frames != NULL);
00150 
00151     return giccdlin(recipe->parameters, recipe->frames);
00152 
00153 }
00154 
00155 
00156 static cxint
00157 giccdlin_destroy(cpl_plugin* plugin)
00158 {
00159 
00160     cpl_recipe* recipe = (cpl_recipe*)plugin;
00161 
00162 
00163     /*
00164      * We just destroy what was created during the plugin initialization
00165      * phase, i.e. the parameter list. The frame set is managed by the
00166      * application which called us, so we must not touch it,
00167      */
00168 
00169     cpl_parameterlist_delete(recipe->parameters);
00170 
00171     giraffe_error_clear();
00172 
00173     return 0;
00174 
00175 }
00176 
00177 
00178 /*
00179  * The actual recipe starts here.
00180  */
00181 
00182 static cxint
00183 giccdlin(cpl_parameterlist* config, cpl_frameset* set)
00184 {
00185 
00186     cpl_propertylist* ltable_properties = NULL;
00187     cpl_propertylist* gtable_properties = NULL;
00188     cpl_propertylist* ccube_properties  = NULL;
00189     cpl_propertylist* bpm_properties    = NULL;
00190     cpl_propertylist* acorr_properties  = NULL;
00191     cpl_propertylist* dflat_properties  = NULL;
00192 
00193     cpl_error_code status = CPL_ERROR_NONE;
00194 
00195 
00196     ltable_properties = irplib_detmon_fill_prolist("LINEAR_INFO",
00197                                                    NULL, NULL, CPL_FALSE);
00198     gtable_properties = irplib_detmon_fill_prolist("GAIN_INFO",
00199                                                    NULL, NULL, CPL_FALSE);
00200     ccube_properties = irplib_detmon_fill_prolist("COEFFS_CUBE",
00201                                                   NULL, NULL, CPL_FALSE);
00202     bpm_properties = irplib_detmon_fill_prolist("BAD_PIXEL_MAP",
00203                                                 NULL, NULL, CPL_FALSE);
00204     acorr_properties = irplib_detmon_fill_prolist("AUTOCORR",
00205                                                   NULL, NULL, CPL_FALSE);
00206     dflat_properties = irplib_detmon_fill_prolist("DIFF_FLAT",
00207                                                   NULL, NULL, CPL_FALSE);
00208 
00209     status = irplib_detmon_lg(set,
00210                               config,
00211                               GIFRAME_LINEARITY_FLAT,
00212                               GIFRAME_LINEARITY_BIAS,
00213                               "giccdlin",
00214                               "giraffe",
00215                               REGEXP,
00216                               ltable_properties,
00217                               gtable_properties,
00218                               ccube_properties,
00219                               bpm_properties,
00220                               acorr_properties,
00221                               dflat_properties,
00222                               PACKAGE "/" PACKAGE_VERSION,
00223                               NULL, NULL, OPT);
00224 
00225     cpl_propertylist_delete(ltable_properties);
00226     cpl_propertylist_delete(gtable_properties);
00227     cpl_propertylist_delete(ccube_properties);
00228     cpl_propertylist_delete(bpm_properties);
00229     cpl_propertylist_delete(acorr_properties);
00230     cpl_propertylist_delete(dflat_properties);
00231 
00232     if (status != CPL_ERROR_NONE) {
00233         return 1;
00234     }
00235 
00236     return 0;
00237 
00238 }
00239 
00240 
00241 /*
00242  * Build table of contents, i.e. the list of available plugins, for
00243  * this module. This function is exported.
00244  */
00245 
00246 int
00247 cpl_plugin_get_info(cpl_pluginlist* list)
00248 {
00249 
00250     cpl_recipe* recipe = cx_calloc(1, sizeof *recipe);
00251     cpl_plugin* plugin = &recipe->interface;
00252 
00253 
00254     cpl_plugin_init(plugin,
00255                     CPL_PLUGIN_API,
00256                     GIRAFFE_BINARY_VERSION,
00257                     CPL_PLUGIN_TYPE_RECIPE,
00258                     "giccdlin",
00259                     "Compute linearity and gain detector characteristics.",
00260                     "For detailed information please refer to the "
00261                     "GIRAFFE pipeline user manual.\nIt is available at "
00262                     "http://www.eso.org/pipelines.",
00263                     "Giraffe Pipeline",
00264                     PACKAGE_BUGREPORT,
00265                     giraffe_get_license(),
00266                     giccdlin_create,
00267                     giccdlin_exec,
00268                     giccdlin_destroy);
00269 
00270     cpl_pluginlist_append(list, plugin);
00271 
00272     return 0;
00273 
00274 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.8.8.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Fri Mar 4 10:50:26 2011 by doxygen 1.6.3 written by Dimitri van Heesch, © 1997-2004