00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033
00034
00035
00036
00037 #include <cpl.h>
00038
00039
00040 #include <irplib_utils.h>
00041 #include <string.h>
00042 #include <sinfo_tpl_utils.h>
00043 #include <sinfo_pfits.h>
00044 #include <sinfo_tpl_dfs.h>
00045 #include <sinfo_msg.h>
00046 #include <sinfo_utl_spectrum_divide_by_blackbody.h>
00047
00048
00049
00050
00051 static int sinfo_utl_spectrum_divide_by_blackbody_create(cpl_plugin *) ;
00052 static int sinfo_utl_spectrum_divide_by_blackbody_exec(cpl_plugin *) ;
00053 static int sinfo_utl_spectrum_divide_by_blackbody_destroy(cpl_plugin *) ;
00054
00055
00056
00057
00058
00059 static char sinfo_utl_spectrum_divide_by_blackbody_description1[] =
00060 "This recipe divides a spectrum by a black body "
00061 "spectrum of given temperature.\n"
00062 "The input file is a spectrum. Its associated tag must be SPECTRUM.\n"
00063 "The output is a spectrum\n";
00064
00065
00066 static char sinfo_utl_spectrum_divide_by_blackbody_description2[] =
00067 "Parameter is \n"
00068 "sinfoni.sinfo_utl_spectrum_divide_by_blackbody.temperature\n"
00069 "having aliases 'temp' \n"
00070 "Information on relevant parameters can be found with\n"
00071 "esorex --params sinfo_utl_spectrum_divide_by_blackbody\n"
00072 "esorex --help sinfo_utl_spectrum_divide_by_blackbody\n"
00073 "\n";
00074
00075 static char sinfo_utl_spectrum_divide_by_blackbody_description[900];
00076
00077
00078
00079
00080
00085
00088
00096
00097 int cpl_plugin_get_info(cpl_pluginlist * list)
00098 {
00099 cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe ) ;
00100 cpl_plugin * plugin = &recipe->interface ;
00101
00102 strcpy(sinfo_utl_spectrum_divide_by_blackbody_description,
00103 sinfo_utl_spectrum_divide_by_blackbody_description1);
00104 strcat(sinfo_utl_spectrum_divide_by_blackbody_description,
00105 sinfo_utl_spectrum_divide_by_blackbody_description2);
00106
00107 cpl_plugin_init(plugin,
00108 CPL_PLUGIN_API,
00109 SINFONI_BINARY_VERSION,
00110 CPL_PLUGIN_TYPE_RECIPE,
00111 "sinfo_utl_spectrum_divide_by_blackbody",
00112 "Spectrum normalization by a blackbody",
00113 sinfo_utl_spectrum_divide_by_blackbody_description,
00114 "Andrea Modigliani",
00115 "Andrea.Modigliani@eso.org",
00116 sinfo_get_license(),
00117 sinfo_utl_spectrum_divide_by_blackbody_create,
00118 sinfo_utl_spectrum_divide_by_blackbody_exec,
00119 sinfo_utl_spectrum_divide_by_blackbody_destroy) ;
00120
00121 cpl_pluginlist_append(list, plugin) ;
00122
00123 return 0;
00124 }
00125
00126
00135
00136 static int sinfo_utl_spectrum_divide_by_blackbody_create(cpl_plugin * plugin)
00137 {
00138 cpl_recipe * recipe ;
00139 cpl_parameter * p ;
00140
00141
00142 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00143 recipe = (cpl_recipe *)plugin ;
00144 else return -1 ;
00145
00146 cpl_error_reset();
00147 irplib_reset();
00148
00149 recipe->parameters = cpl_parameterlist_new() ;
00150
00151
00152
00153
00154 p = cpl_parameter_new_value("sinfoni.sinfo_utl_spectrum_divide_by_blackbody.temperature",
00155 CPL_TYPE_DOUBLE, "Black Body Temperature",
00156 "sinfoni.sinfo_utl_spectrum_divide_by_blackbody", 100000.) ;
00157 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "temp") ;
00158 cpl_parameterlist_append(recipe->parameters, p) ;
00159
00160
00161 return 0;
00162 }
00163
00164
00170
00171 static int sinfo_utl_spectrum_divide_by_blackbody_exec(cpl_plugin * plugin)
00172 {
00173 cpl_recipe * recipe ;
00174 int code=0;
00175
00176
00177 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00178 recipe = (cpl_recipe *)plugin ;
00179 else return -1 ;
00180
00181 sinfo_msg("Welcome to SINFONI Pipeline release %d.%d.%d",
00182 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
00183 code=sinfo_utl_spectrum_divide_by_blackbody(recipe->parameters,
00184 recipe->frames) ;
00185 return code;
00186 }
00187
00188
00194
00195 static int sinfo_utl_spectrum_divide_by_blackbody_destroy(cpl_plugin * plugin)
00196 {
00197 cpl_recipe * recipe ;
00198
00199
00200 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00201 recipe = (cpl_recipe *)plugin ;
00202 else return -1 ;
00203
00204 cpl_parameterlist_delete(recipe->parameters) ;
00205 return 0 ;
00206 }
00207