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 #include <irplib_utils.h>
00040
00041 #include <sinfo_tpl_utils.h>
00042 #include <sinfo_pfits.h>
00043 #include <sinfo_tpl_dfs.h>
00044 #include <sinfo_utl_cube_arith.h>
00045 #include <sinfo_msg.h>
00046
00047
00048
00049
00050
00051 static int sinfo_utl_cube_arith_create(cpl_plugin *) ;
00052 static int sinfo_utl_cube_arith_exec(cpl_plugin *) ;
00053 static int sinfo_utl_cube_arith_destroy(cpl_plugin *) ;
00054
00055
00056
00057
00058
00059 static char sinfo_utl_cube_arith_description1[] =
00060 "This recipe perform cube arithmetics.\n"
00061 "If parameter value is specified the input frame is a cube \n"
00062 "in a sof file with tag CUBE\n"
00063 "Else the input files are a cube and an images or a spectrum\n"
00064 "their associated tags should be respectively CUBE, IMA or SPECTRUM.\n"
00065 "The output is a cube with tag PRO_CUBE resulting from the operation \n"
00066 "CUBE op IMA or \n"
00067 "CUBE op SPECTRUM or\n"
00068 "CUBE op value where op indicates\n"
00069 "the operation to be performed\n";
00070
00071
00072 static char sinfo_utl_cube_arith_description2[] =
00073 "Information on relevant parameters can be found with\n"
00074 "esorex --params sinfo_utl_cube_arith\n"
00075 "esorex --help sinfo_utl_cube_arith\n"
00076 "\n";
00077
00078 static char sinfo_utl_cube_arith_description[600];
00079
00080
00081
00082
00083
00084
00085
00089
00091
00099
00100 int cpl_plugin_get_info(cpl_pluginlist * list)
00101 {
00102 cpl_recipe * recipe = cpl_calloc(1, sizeof *recipe ) ;
00103 cpl_plugin * plugin = &recipe->interface ;
00104
00105 strcpy(sinfo_utl_cube_arith_description,sinfo_utl_cube_arith_description1);
00106 strcat(sinfo_utl_cube_arith_description,sinfo_utl_cube_arith_description2);
00107
00108 cpl_plugin_init(plugin,
00109 CPL_PLUGIN_API,
00110 SINFONI_BINARY_VERSION,
00111 CPL_PLUGIN_TYPE_RECIPE,
00112 "sinfo_utl_cube_arith",
00113 "Cube arithmetics",
00114 sinfo_utl_cube_arith_description,
00115 "Andrea Modigliani",
00116 "Andrea.Modigliani@eso.org",
00117 sinfo_get_license(),
00118 sinfo_utl_cube_arith_create,
00119 sinfo_utl_cube_arith_exec,
00120 sinfo_utl_cube_arith_destroy) ;
00121
00122 cpl_pluginlist_append(list, plugin) ;
00123
00124 return 0;
00125 }
00126
00127
00136
00137 static int sinfo_utl_cube_arith_create(cpl_plugin * plugin)
00138 {
00139 cpl_recipe * recipe ;
00140 cpl_parameter * p ;
00141
00142
00143 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00144 recipe = (cpl_recipe *)plugin ;
00145 else return -1 ;
00146 cpl_error_reset();
00147 irplib_reset();
00148
00149 recipe->parameters = cpl_parameterlist_new() ;
00150
00151
00152
00153 p = cpl_parameter_new_value("sinfoni.sinfo_utl_cube_arith.op",
00154 CPL_TYPE_STRING,
00155 "A possible operation: "
00156 "`/','*','+' or `-'",
00157 "sinfoni.sinfo_utl_cube_arith","/");
00158 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "op") ;
00159 cpl_parameterlist_append(recipe->parameters, p) ;
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 p = cpl_parameter_new_value("sinfoni.sinfo_utl_cube_arith.value",
00172 CPL_TYPE_DOUBLE, "A constant to add",
00173 "sinfoni.sinfo_utl_cube_arith", 99999.0) ;
00174 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "value") ;
00175 cpl_parameterlist_append(recipe->parameters, p) ;
00176
00177
00178 return 0;
00179 }
00180
00181
00187
00188 static int sinfo_utl_cube_arith_exec(cpl_plugin * plugin)
00189 {
00190 cpl_recipe * recipe ;
00191 int code=0;
00192
00193 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00194 recipe = (cpl_recipe *)plugin ;
00195 else return -1 ;
00196 sinfo_msg("Welcome to SINFONI Pipeline release %d.%d.%d",
00197 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
00198
00199 code = sinfo_utl_cube_arith(recipe->parameters, recipe->frames) ;
00200
00201 return code;
00202 }
00203
00204
00210
00211 static int sinfo_utl_cube_arith_destroy(cpl_plugin * plugin)
00212 {
00213 cpl_recipe * recipe ;
00214
00215
00216 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00217 recipe = (cpl_recipe *)plugin ;
00218 else return -1 ;
00219
00220 cpl_parameterlist_delete(recipe->parameters) ;
00221 return 0 ;
00222 }