si_utl_cube_test.c

00001 /* $Id: si_utl_cube_test.c,v 1.3 2005/10/08 10:34:50 amodigli Exp $
00002  *
00003  * This file is part of the IIINSTRUMENT 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: 2005/10/08 10:34:50 $
00024  * $Revision: 1.3 $
00025  * $Name:  $
00026  */
00027 
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031 
00032 /*-----------------------------------------------------------------------------
00033                                 Includes
00034  -----------------------------------------------------------------------------*/
00035 
00036 #include <cpl.h>
00037 
00038 #include "sinfoni_tpl_utils.h"
00039 #include "sinfoni_pfits.h"
00040 #include "sinfoni_tpl_dfs.h"
00041 #include <utl_cube_test.h>
00042 #include <sinfoni_memory.h>
00043 
00044 /*-----------------------------------------------------------------------------
00045                             Functions prototypes
00046  -----------------------------------------------------------------------------*/
00047 
00048 static int si_utl_cube_test_create(cpl_plugin *) ;
00049 static int si_utl_cube_test_exec(cpl_plugin *) ;
00050 static int si_utl_cube_test_destroy(cpl_plugin *) ;
00051 
00052 /*-----------------------------------------------------------------------------
00053                             Static variables
00054  -----------------------------------------------------------------------------*/
00055 
00056 static char si_utl_cube_test_description[] =
00057 "This recipe perform cubes combination.\n"
00058 "The input files are several cubeses\n"
00059 "their associated tags should be CUBE.\n"
00060 "The output is a cube PRO_CUBE resulting from the input cubes accurding to the value of \n"
00061 "where op indicates\n"
00062 "the operation to be performed specified by the parameter sinfoni.si_utl_cube_test.op\n"
00063 " having alias 'op'\n"
00064 "Information on relevant parameters can be found with\n"
00065 "esorex --params si_utl_cube_test\n"
00066 "esorex --help si_utl_cube_test\n"
00067 "\n";
00068 
00069 /*-----------------------------------------------------------------------------
00070                                 Functions code
00071  -----------------------------------------------------------------------------*/
00072 
00073 /*----------------------------------------------------------------------------*/
00081 /*----------------------------------------------------------------------------*/
00082 int cpl_plugin_get_info(cpl_pluginlist * list)
00083 {
00084     cpl_recipe  *   recipe = cpl_calloc(1, sizeof *recipe ) ;
00085     cpl_plugin  *   plugin = &recipe->interface ;
00086 
00087     cpl_plugin_init(plugin,
00088                     CPL_PLUGIN_API,
00089                     SINFONI_BINARY_VERSION,
00090                     CPL_PLUGIN_TYPE_RECIPE,
00091                     "si_utl_cube_test",
00092                     "Combines a cube list in an output cube",
00093                     si_utl_cube_test_description,
00094                     "Andrea Modigliani",
00095                     "Andrea.Modigliani@eso.org",
00096                     sinfoni_get_license(),
00097                     si_utl_cube_test_create,
00098                     si_utl_cube_test_exec,
00099                     si_utl_cube_test_destroy) ;
00100 
00101     cpl_pluginlist_append(list, plugin) ;
00102     
00103     return 0;
00104 }
00105 
00106 /*----------------------------------------------------------------------------*/
00115 /*----------------------------------------------------------------------------*/
00116 static int si_utl_cube_test_create(cpl_plugin * plugin)
00117 {
00118     cpl_recipe      * recipe ;
00119     cpl_parameter   * p ;
00120 
00121     /* Get the recipe out of the plugin */
00122     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00123         recipe = (cpl_recipe *)plugin ;
00124     else return -1 ;
00125 
00126     /* Create the parameters list in the cpl_recipe object */
00127     recipe->parameters = cpl_parameterlist_new() ; 
00128 
00129     /* Fill the parameters list */
00130     /* --stropt */
00131     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.name_i", 
00132             CPL_TYPE_STRING, "Output filename", "sinfoni.si_utl_cube_test","input.list");
00133     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "name_i") ;
00134     cpl_parameterlist_append(recipe->parameters, p) ;
00135 
00136 
00137     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.method", 
00138             CPL_TYPE_STRING, "Output filename", "sinfoni.si_utl_cube_test","clean_mean");
00139     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "method") ;
00140     cpl_parameterlist_append(recipe->parameters, p) ;
00141 
00142     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.op", 
00143             CPL_TYPE_STRING, "A possible operation", "sinfoni.si_utl_cube_test","+");
00144     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "op") ;
00145     cpl_parameterlist_append(recipe->parameters, p) ;
00146 
00147 
00148     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.name_o", 
00149             CPL_TYPE_STRING, "Output filename", "sinfoni.si_utl_cube_test","out_cube.fits");
00150     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "name_o") ;
00151     cpl_parameterlist_append(recipe->parameters, p) ;
00152 
00153     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.name_m", 
00154             CPL_TYPE_STRING, "Output filename", "sinfoni.si_utl_cube_test","out_maskcube.fits");
00155     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "name_m") ;
00156     cpl_parameterlist_append(recipe->parameters, p) ;
00157 
00158     /* --doubleopt */
00159     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.xsize", 
00160             CPL_TYPE_INT, "Ouput cube X size", "sinfoni.si_utl_cube_test", 80) ;
00161     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xsize") ;
00162     cpl_parameterlist_append(recipe->parameters, p) ;
00163 
00164 
00165     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.ysize", 
00166             CPL_TYPE_INT, "Ouput cube Y size", "sinfoni.si_utl_cube_test", 80) ;
00167     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ysize") ;
00168     cpl_parameterlist_append(recipe->parameters, p) ;
00169 
00170 
00171     p = cpl_parameter_new_value("sinfoni.si_utl_cube_test.sigma", 
00172             CPL_TYPE_DOUBLE, "Ouput cube Y size", "sinfoni.si_utl_cube_test", 5.) ;
00173     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma") ;
00174     cpl_parameterlist_append(recipe->parameters, p) ;
00175  
00176 
00177   p = cpl_parameter_new_value("sinfoni.objnod.kappa",
00178                   CPL_TYPE_DOUBLE,
00179                               "kappa value for kappa-sigma clipping "
00180                               "of coadded cube",
00181                               "sinfoni.objnod",
00182                               2.0);
00183 
00184   cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,"objnod-kappa");
00185   cpl_parameterlist_append(recipe->parameters, p);
00186 
00187 
00188     /* Return */
00189     return 0;
00190 }
00191 
00192 /*----------------------------------------------------------------------------*/
00198 /*----------------------------------------------------------------------------*/
00199 static int si_utl_cube_test_exec(cpl_plugin * plugin)
00200 {
00201     cpl_recipe  *   recipe ;
00202     
00203     /* Get the recipe out of the plugin */
00204     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00205         recipe = (cpl_recipe *)plugin ;
00206     else return -1 ;
00207 
00208     return si_utl_cube_test(recipe->parameters, recipe->frames) ;
00209 }
00210 
00211 /*----------------------------------------------------------------------------*/
00217 /*----------------------------------------------------------------------------*/
00218 static int si_utl_cube_test_destroy(cpl_plugin * plugin)
00219 {
00220     cpl_recipe  *   recipe ;
00221     
00222     /* Get the recipe out of the plugin */
00223     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00224         recipe = (cpl_recipe *)plugin ;
00225     else return -1 ;
00226 
00227     cpl_parameterlist_delete(recipe->parameters) ; 
00228     return 0 ;
00229 }
00230 

Generated on Wed Oct 26 13:08:54 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001