si_utl_cube_combine.c

00001 /* $Id: si_utl_cube_combine.c,v 1.6 2005/10/15 10:18:56 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/15 10:18:56 $
00024  * $Revision: 1.6 $
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_combine.h>
00042 #include <sinfoni_memory.h>
00043 
00044 /*-----------------------------------------------------------------------------
00045                             Functions prototypes
00046  -----------------------------------------------------------------------------*/
00047 
00048 static int si_utl_cube_combine_create(cpl_plugin *) ;
00049 static int si_utl_cube_combine_exec(cpl_plugin *) ;
00050 static int si_utl_cube_combine_destroy(cpl_plugin *) ;
00051 
00052 /*-----------------------------------------------------------------------------
00053                             Static variables
00054  -----------------------------------------------------------------------------*/
00055 
00056 static char si_utl_cube_combine_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_combine.op\n"
00063 " having alias 'op'\n"
00064 "Information on relevant parameters can be found with\n"
00065 "esorex --params si_utl_cube_combine\n"
00066 "esorex --help si_utl_cube_combine\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_combine",
00092                     "Combines a cube list in an output cube",
00093                     si_utl_cube_combine_description,
00094                     "Andrea Modigliani",
00095                     "Andrea.Modigliani@eso.org",
00096                     sinfoni_get_license(),
00097                     si_utl_cube_combine_create,
00098                     si_utl_cube_combine_exec,
00099                     si_utl_cube_combine_destroy) ;
00100 
00101     cpl_pluginlist_append(list, plugin) ;
00102     
00103     return 0;
00104 }
00105 
00106 /*----------------------------------------------------------------------------*/
00115 /*----------------------------------------------------------------------------*/
00116 static int si_utl_cube_combine_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_combine.name_i", 
00132             CPL_TYPE_STRING, "Input filename", "sinfoni.si_utl_cube_combine","offset.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_combine.method", 
00138             CPL_TYPE_STRING, "Output filename", "sinfoni.si_utl_cube_combine","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_combine.op", 
00143             CPL_TYPE_STRING, "A possible operation", "sinfoni.si_utl_cube_combine","+");
00144     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "op") ;
00145     cpl_parameterlist_append(recipe->parameters, p) ;
00146 
00147 
00148     /* --doubleopt */
00149     p = cpl_parameter_new_value("sinfoni.si_utl_cube_combine.xsize", 
00150             CPL_TYPE_INT, "Ouput cube X size", "sinfoni.si_utl_cube_combine", 80) ;
00151     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "xsize") ;
00152     cpl_parameterlist_append(recipe->parameters, p) ;
00153 
00154 
00155     p = cpl_parameter_new_value("sinfoni.si_utl_cube_combine.ysize", 
00156             CPL_TYPE_INT, "Ouput cube Y size", "sinfoni.si_utl_cube_combine", 80) ;
00157     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ysize") ;
00158     cpl_parameterlist_append(recipe->parameters, p) ;
00159 
00160 
00161     p = cpl_parameter_new_value("sinfoni.si_utl_cube_combine.sigma", 
00162             CPL_TYPE_DOUBLE, "Ouput cube Y size", "sinfoni.si_utl_cube_combine", 5.) ;
00163     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "sigma") ;
00164     cpl_parameterlist_append(recipe->parameters, p) ;
00165  
00166     /* Return */
00167     return 0;
00168 }
00169 
00170 /*----------------------------------------------------------------------------*/
00176 /*----------------------------------------------------------------------------*/
00177 static int si_utl_cube_combine_exec(cpl_plugin * plugin)
00178 {
00179     cpl_recipe  *   recipe ;
00180     int result=0;    
00181     /* Get the recipe out of the plugin */
00182     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00183         recipe = (cpl_recipe *)plugin ;
00184     else return -1 ;
00185     result=si_utl_cube_combine(recipe->parameters, recipe->frames) ;
00186     sinfoni_memory_status();
00187     return result;
00188 }
00189 
00190 /*----------------------------------------------------------------------------*/
00196 /*----------------------------------------------------------------------------*/
00197 static int si_utl_cube_combine_destroy(cpl_plugin * plugin)
00198 {
00199     cpl_recipe  *   recipe ;
00200     
00201     /* Get the recipe out of the plugin */
00202     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00203         recipe = (cpl_recipe *)plugin ;
00204     else return -1 ;
00205 
00206     cpl_parameterlist_delete(recipe->parameters) ; 
00207     return 0 ;
00208 }
00209 

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