si_utl_spectrum_divide_by_blackbody.c

00001 /* $Id: si_utl_spectrum_divide_by_blackbody.c,v 1.1 2005/10/14 16:13:18 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/14 16:13:18 $
00024  * $Revision: 1.1 $
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 
00039 #include "sinfoni_tpl_utils.h"
00040 #include "sinfoni_pfits.h"
00041 #include "sinfoni_tpl_dfs.h"
00042 #include <utl_spectrum_divide_by_blackbody.h>
00043 #include <sinfoni_memory.h>
00044 /*-----------------------------------------------------------------------------
00045                             Functions prototypes
00046  -----------------------------------------------------------------------------*/
00047 
00048 static int si_utl_spectrum_divide_by_blackbody_create(cpl_plugin *) ;
00049 static int si_utl_spectrum_divide_by_blackbody_exec(cpl_plugin *) ;
00050 static int si_utl_spectrum_divide_by_blackbody_destroy(cpl_plugin *) ;
00051 
00052 /*-----------------------------------------------------------------------------
00053                             Static variables
00054  -----------------------------------------------------------------------------*/
00055 
00056 static char si_utl_spectrum_divide_by_blackbody_description1[] =
00057 "This recipe divides a spectrum by a black body spectrum of given temperature.\n"
00058 "The input file is a spectrum. Its associated tag must be SPECTRUM.\n"
00059 "The output is a spectrum\n";
00060 
00061 
00062 static char si_utl_spectrum_divide_by_blackbody_description2[] =
00063 "Parameter is \n"
00064 "sinfoni.si_utl_spectrum_divide_by_blackbody.temperature\n"
00065 "having aliases 'temp' \n"
00066 "Information on relevant parameters can be found with\n"
00067 "esorex --params si_utl_spectrum_divide_by_blackbody\n"
00068 "esorex --help si_utl_spectrum_divide_by_blackbody\n"
00069 "\n";
00070 
00071 static char si_utl_spectrum_divide_by_blackbody_description[900];
00072 
00073 /*-----------------------------------------------------------------------------
00074                                 Functions code
00075  -----------------------------------------------------------------------------*/
00076 
00077 /*----------------------------------------------------------------------------*/
00085 /*----------------------------------------------------------------------------*/
00086 int cpl_plugin_get_info(cpl_pluginlist * list)
00087 {
00088     cpl_recipe  *   recipe = cpl_calloc(1, sizeof *recipe ) ;
00089     cpl_plugin  *   plugin = &recipe->interface ;
00090 
00091     strcpy(si_utl_spectrum_divide_by_blackbody_description,si_utl_spectrum_divide_by_blackbody_description1);
00092     strcat(si_utl_spectrum_divide_by_blackbody_description,si_utl_spectrum_divide_by_blackbody_description2);
00093 
00094     cpl_plugin_init(plugin,
00095                     CPL_PLUGIN_API,
00096                     SINFONI_BINARY_VERSION,
00097                     CPL_PLUGIN_TYPE_RECIPE,
00098                     "si_utl_spectrum_divide_by_blackbody",
00099                     "Spectrum normalization by a blackbody",
00100                     si_utl_spectrum_divide_by_blackbody_description,
00101                     "Andrea Modigliani",
00102                     "Andrea.Modigliani@eso.org",
00103                     sinfoni_get_license(),
00104                     si_utl_spectrum_divide_by_blackbody_create,
00105                     si_utl_spectrum_divide_by_blackbody_exec,
00106                     si_utl_spectrum_divide_by_blackbody_destroy) ;
00107 
00108     cpl_pluginlist_append(list, plugin) ;
00109     
00110     return 0;
00111 }
00112 
00113 /*----------------------------------------------------------------------------*/
00122 /*----------------------------------------------------------------------------*/
00123 static int si_utl_spectrum_divide_by_blackbody_create(cpl_plugin * plugin)
00124 {
00125     cpl_recipe      * recipe ;
00126     cpl_parameter   * p ;
00127 
00128     /* Get the recipe out of the plugin */
00129     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00130         recipe = (cpl_recipe *)plugin ;
00131     else return -1 ;
00132 
00133     /* Create the parameters list in the cpl_recipe object */
00134     recipe->parameters = cpl_parameterlist_new() ; 
00135 
00136     /* Fill the parameters list */
00137     /* --stropt */
00138     /* --doubleopt */
00139     p = cpl_parameter_new_value("sinfoni.si_utl_spectrum_divide_by_blackbody.temperature", 
00140             CPL_TYPE_DOUBLE, "Black Body Temperature", "sinfoni.si_utl_spectrum_divide_by_blackbody", 100000.) ;
00141     cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "temp") ;
00142     cpl_parameterlist_append(recipe->parameters, p) ;
00143 
00144 
00145     /* Return */
00146     return 0;
00147 }
00148 
00149 /*----------------------------------------------------------------------------*/
00155 /*----------------------------------------------------------------------------*/
00156 static int si_utl_spectrum_divide_by_blackbody_exec(cpl_plugin * plugin)
00157 {
00158     cpl_recipe  *   recipe ;
00159     
00160     /* Get the recipe out of the plugin */
00161     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00162         recipe = (cpl_recipe *)plugin ;
00163     else return -1 ;
00164 
00165     return si_utl_spectrum_divide_by_blackbody(recipe->parameters, recipe->frames) ;
00166 }
00167 
00168 /*----------------------------------------------------------------------------*/
00174 /*----------------------------------------------------------------------------*/
00175 static int si_utl_spectrum_divide_by_blackbody_destroy(cpl_plugin * plugin)
00176 {
00177     cpl_recipe  *   recipe ;
00178     
00179     /* Get the recipe out of the plugin */
00180     if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE) 
00181         recipe = (cpl_recipe *)plugin ;
00182     else return -1 ;
00183 
00184     cpl_parameterlist_delete(recipe->parameters) ; 
00185     return 0 ;
00186 }
00187 

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