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
00029
00030
00031
00032 #ifdef HAVE_CONFIG_H
00033 #include <config.h>
00034 #endif
00035
00036
00037
00038
00039
00040 #include <strings.h>
00041 #include <string.h>
00042 #include <stdio.h>
00043
00044
00045 #include <cxmacros.h>
00046 #include <cxtypes.h>
00047 #include <cxmessages.h>
00048
00049
00050 #include <xmemory.h>
00051
00052
00053 #include <cpl_memory.h>
00054
00055
00056 #include <sinfoni_general_config.h>
00057 #include <sinfoni_fake_config.h>
00058 #include <sinfoni_prepare_stacked_frames_config.h>
00059 #include <sinfoni_objspider_config.h>
00060 #include <prepare_stacked_frames.h>
00061 #include <objspider.h>
00062 #include <sinfoni_pro_types.h>
00063 #include <sinfoni_tpl_utils.h>
00064 #include <sinfoni_tpl_dfs.h>
00065 #include <sinfoni_memory.h>
00066
00067
00068
00069
00070
00071
00072
00073 static cxint si_rec_objspider(cpl_parameterlist *, cpl_frameset *);
00074
00075
00076
00077
00078
00079 static char si_rec_objspider_description[] =
00080 "This recipe performs science skyspider data reduction.\n"
00081 "The input files are science object and sky frames with tags OBJECT_NODDING and SKY_NODDING\n"
00082 "Master calibration frames:\n"
00083 "A corresponding (band,preoptics) wavelength map image with tag WAVE_MAP\n"
00084 "A corresponding (band,preoptics) master flat field with tag MASTER_FLAT_LAMP\n"
00085 "A corresponding (band,preoptics) master bad pixel map with tag MASTER_BP_MAP\n"
00086 "A corresponding (band,preoptics) slitlets position frame with tag SLIT_POS\n"
00087 "A corresponding (band) distortion table with tag DISTORTION\n"
00088 "A corresponding (band) slitlet distance table with tag SLITLETS_DISTANCE\n"
00089 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
00090 "A reference table with the position of the first column with tag FIRST_COLUMN\n"
00091 "Relevant outputs are:\n"
00092 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
00093 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n"
00094 "An average along Z of the reconstructed cube (PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
00095 "The bad pixel map associated to the cube (PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n"
00096 "Information on relevant parameters can be found with"
00097 "esorex --params si_rec_objspider"
00098 "esorex --help si_rec_objspider"
00099 "\n";
00100
00101
00102
00103
00104
00105
00106 cxint
00107 si_rec_objspider_create(cpl_plugin *plugin)
00108 {
00109
00110
00111
00112
00113
00114
00115 cpl_recipe *recipe = (cpl_recipe *)plugin;
00116 recipe->parameters = cpl_parameterlist_new();
00117 if(recipe->parameters == NULL) {
00118 return 1;
00119 }
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 sinfoni_general_config_add(recipe->parameters);
00130 sinfoni_prepare_stacked_frames_config_add(recipe->parameters);
00131 sinfoni_objspider_config_add(recipe->parameters);
00132 sinfoni_fake_config_add(config);
00133
00134 return 0;
00135
00136 }
00137
00138 cxint
00139 si_rec_objspider_exec(cpl_plugin *plugin)
00140 {
00141
00142 cpl_recipe *recipe = (cpl_recipe *) plugin;
00143 if(recipe->parameters == NULL) {
00144 return 1;
00145 }
00146 if(recipe->frames == NULL) {
00147 return 1;
00148 }
00149
00150 cpl_error_reset();
00151 return si_rec_objspider(recipe->parameters, recipe->frames);
00152
00153 }
00154
00155 cxint
00156 si_rec_objspider_destroy(cpl_plugin *plugin)
00157 {
00158
00159 cpl_recipe *recipe = (cpl_recipe *) plugin;
00160
00161
00162
00163
00164
00165
00166 cpl_parameterlist_delete(recipe->parameters);
00167
00168 return 0;
00169
00170 }
00171
00172 int
00173 cpl_plugin_get_info(cpl_pluginlist *list)
00174 {
00175
00176 cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00177 cpl_plugin *plugin = &recipe->interface;
00178
00179
00180 cpl_plugin_init(plugin,
00181 CPL_PLUGIN_API,
00182 SINFONI_BINARY_VERSION,
00183 CPL_PLUGIN_TYPE_RECIPE,
00184 "si_rec_objspider",
00185 "Object data reduction",
00186 si_rec_objspider_description,
00187 "Andrea Modigliani",
00188 "Andrea.Modigliani@eso.org",
00189 sinfoni_get_licence(),
00190 si_rec_objspider_create,
00191 si_rec_objspider_exec,
00192 si_rec_objspider_destroy);
00193
00194 cpl_pluginlist_append(list, plugin);
00195
00196 return 0;
00197
00198 }
00199
00200
00201
00202
00203
00204
00205 static cxint
00206 si_rec_objspider(cpl_parameterlist *config, cpl_frameset *set)
00207 {
00208 int ind=0;
00209
00210 const char *_id = "si_rec_objspider";
00211
00212
00213
00214 if(sinfoni_dfs_set_groups(set)) {
00215 cpl_msg_error(_id, "Cannot indentify RAW and CALIB frames") ;
00216 return -1;
00217 }
00218
00219
00220
00221
00222 {
00223 cpl_msg_info (_id,"running RECIPE prepare_stacked_frames...") ;
00224 if ( -1 == (ind = prepare_stacked_frames(config, set, PRO_OBJECT_SKYSPIDER_STACKED ) ) )
00225 {
00226 cpl_msg_error(_id," no: %d\n", ind) ;
00227 return -1 ;
00228 }
00229 cpl_msg_info (_id,"success RECIPE prepare_stacked_frames ended") ;
00230 }
00231
00232
00233
00234
00235
00236
00237
00238 {
00239 cpl_msg_info(_id,"Running") ;
00240 if ( -1 == (ind = objspider(config, set ) ) )
00241 {
00242 cpl_msg_info(_id,"no: %d\n", ind) ;
00243 return -1 ;
00244 }
00245 cpl_msg_info(_id,"Success") ;
00246 }
00247 return 0 ;
00248
00249 }
00250
00251
00252