50 #include <irplib_utils.h>
53 #include <sinfo_pro_types.h>
54 #include <sinfo_product_config.h>
55 #include <sinfo_prepare_stacked_frames_config.h>
56 #include <sinfo_objnod_config.h>
57 #include <sinfo_skycor_config.h>
58 #include <sinfo_standard_star_config.h>
59 #include <sinfo_new_prepare_stacked_frames.h>
60 #include <sinfo_new_cubes_coadd.h>
61 #include <sinfo_new_stdstar.h>
62 #include <sinfo_functions.h>
63 #include <sinfo_tpl_utils.h>
64 #include <sinfo_tpl_dfs.h>
65 #include <sinfo_hidden.h>
66 #include <sinfo_globals.h>
67 #include <sinfo_msg.h>
68 #include <sinfo_rec_utils.h>
69 #include <sinfo_error.h>
70 #include <sinfo_utils_wrappers.h>
78 static int sinfo_rec_stdstar_create(cpl_plugin *) ;
79 static int sinfo_rec_stdstar_exec(cpl_plugin *) ;
80 static int sinfo_rec_stdstar_destroy(cpl_plugin *) ;
81 static int sinfo_rec_stdstar(cpl_parameterlist *, cpl_frameset *);
87 static char sinfo_rec_stdstar_description1[] =
88 "This recipe performs science data reduction.\n"
89 "The input files are science object and sky frames \n"
90 "with tags STD_NODDING and SKY_STD_NODDING\n";
93 static char sinfo_rec_stdstar_description2[] =
94 "Master calibration frames:\n"
95 "A corresponding (band,preoptics) wavelength map image with tag WAVE_MAP\n"
96 "A corresponding (band,preoptics) master flat field with tag MASTER_FLAT_LAMP\n"
97 "A corresponding (band,preoptics) master bad pixel map with tag MASTER_BP_MAP\n"
98 "A corresponding (band,preoptics) slitlets position frame with tag SLIT_POS\n"
99 "A corresponding (band) distortion table with tag DISTORTION\n"
100 "A corresponding (band) slitlet distance table with tag SLITLETS_DISTANCE\n";
103 static char sinfo_rec_stdstar_description3[] =
104 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
105 "A reference table with the position of the first column \n"
106 "with tag FIRST_COLUMN\n"
107 "Relevant outputs are:\n"
108 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
109 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n";
112 static char sinfo_rec_stdstar_description4[] =
113 "An average along Z of the reconstructed cube \n"
114 "(PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
115 "The bad pixel map associated to the cube \n"
116 "(PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n"
117 "The std star spectrum image (PRO.CATG=STD_SPECTRUM)\n"
118 "The std start spectrum and efficiency spectrum table (PRO.CATG=STD_SPECTRA)\n"
122 static char sinfo_rec_stdstar_description[1300];
149 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
150 cpl_plugin *plugin = &recipe->interface;
152 strcpy(sinfo_rec_stdstar_description,sinfo_rec_stdstar_description1);
153 strcat(sinfo_rec_stdstar_description,sinfo_rec_stdstar_description2);
154 strcat(sinfo_rec_stdstar_description,sinfo_rec_stdstar_description3);
155 strcat(sinfo_rec_stdstar_description,sinfo_rec_stdstar_description4);
158 cpl_plugin_init(plugin,
160 SINFONI_BINARY_VERSION,
161 CPL_PLUGIN_TYPE_RECIPE,
163 "Standard star data reduction",
164 sinfo_rec_stdstar_description,
166 "Andrea.Modigliani@eso.org",
168 sinfo_rec_stdstar_create,
169 sinfo_rec_stdstar_exec,
170 sinfo_rec_stdstar_destroy);
172 cpl_pluginlist_append(list, plugin);
191 static int sinfo_rec_stdstar_create(cpl_plugin *plugin)
193 cpl_recipe * recipe ;
196 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
197 recipe = (cpl_recipe *)plugin ;
203 recipe->parameters = cpl_parameterlist_new() ;
209 sinfo_product_config_add(recipe->parameters);
210 sinfo_prepare_stacked_frames_config_add(recipe->parameters);
211 sinfo_objnod_config_add(recipe->parameters);
212 sinfo_skycor_config_add(recipe->parameters);
213 sinfo_standard_star_config_add(recipe->parameters);
226 static int sinfo_rec_stdstar_exec(cpl_plugin *plugin)
228 cpl_recipe * recipe ;
231 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
232 recipe = (cpl_recipe *)plugin ;
235 return sinfo_rec_stdstar(recipe->parameters, recipe->frames);
246 static int sinfo_rec_stdstar_destroy(cpl_plugin *plugin)
248 cpl_recipe * recipe ;
251 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
252 recipe = (cpl_recipe *)plugin ;
255 cpl_parameterlist_delete(recipe->parameters);
276 sinfo_rec_stdstar(cpl_parameterlist *config, cpl_frameset *
set)
280 const char* pro_ctg_cube;
281 sinfo_msg(
"Welcome to SINFONI Pipeline release %d.%d.%d",
282 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
284 if(sinfo_dfs_set_groups(
set)) {
293 ck0(sinfo_cub_stk_frames(config,&
set,cpl_func,&pro_ctg_cube),
294 "Cannot stack RAW frames");
300 sinfo_msg(
"------------------------------") ;
301 sinfo_msg(
"COADDING CUBES");
302 sinfo_msg(
"------------------------------") ;
304 ck0(sinfo_new_cubes_coadd(cpl_func,config,
set, pro_ctg_cube),
307 sinfo_msg(
"------------------------------") ;
308 sinfo_msg(
"COADDED CUBES");
309 sinfo_msg(
"------------------------------") ;
314 sinfo_msg(
"------------------------------") ;
315 sinfo_msg(
"STD STAR DATA REDUCTION");
316 sinfo_msg(
"------------------------------") ;
318 ck0(sinfo_new_stdstar(cpl_func,config,
set ),
"REDUCING STD STAR DATA") ;
319 sinfo_msg(
"STD STAR DATA REDUCTION SUCCESS") ;
324 if (cpl_error_get_code() != CPL_ERROR_NONE) {