50 #include <irplib_utils.h>
54 #include <sinfo_pro_types.h>
55 #include <sinfo_product_config.h>
56 #include <sinfo_prepare_stacked_frames_config.h>
57 #include <sinfo_objnod_config.h>
58 #include <sinfo_raw_types.h>
59 #include <sinfo_tpl_utils.h>
60 #include <sinfo_tpl_dfs.h>
61 #include <sinfo_hidden.h>
62 #include <sinfo_globals.h>
63 #include <sinfo_functions.h>
64 #include <sinfo_msg.h>
65 #include <sinfo_new_prepare_stacked_frames.h>
66 #include <sinfo_new_objnod.h>
67 #include <sinfo_error.h>
68 #include <sinfo_utils_wrappers.h>
72 static int sinfo_rec_pupil_create(cpl_plugin *);
73 static int sinfo_rec_pupil_exec(cpl_plugin *);
74 static int sinfo_rec_pupil_destroy(cpl_plugin *);
75 static int sinfo_rec_pupil(cpl_parameterlist *, cpl_frameset *);
80 static char sinfo_rec_pupil_description1[] =
81 "This recipe performs science data reduction.\n"
82 "The input files are science object and sky frames \n"
83 "with tags OBJECT_NODDING and SKY_NODDING\n"
84 "Master calibration frames:\n";
87 static char sinfo_rec_pupil_description2[] =
88 "A corresponding (band,preoptics) wavelength map image with tag WAVE_MAP\n"
89 "A corresponding (band,preoptics) master flat field with tag MASTER_FLAT_LAMP\n"
90 "A corresponding (band,preoptics) master bad pixel map with tag MASTER_BP_MAP\n"
91 "A corresponding (band,preoptics) slitlets position frame with tag SLIT_POS\n"
92 "A corresponding (band) distortion table with tag DISTORTION\n"
93 "A corresponding (band) slitlet distance table with tag SLITLETS_DISTANCE\n";
96 static char sinfo_rec_pupil_description3[] =
97 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
98 "A reference table with the position of the 1st column with tag FIRST_COLUMN\n"
99 "Relevant outputs are:\n"
100 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
101 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n"
102 "An average along Z of the reconstructed cube \n"
103 "(PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
104 "The bad pixel map associated to the cube \n"
105 "(PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n"
109 static char sinfo_rec_pupil_description[1300];
135 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
136 cpl_plugin *plugin = &recipe->interface;
139 strcpy(sinfo_rec_pupil_description,sinfo_rec_pupil_description1);
140 strcat(sinfo_rec_pupil_description,sinfo_rec_pupil_description2);
141 strcat(sinfo_rec_pupil_description,sinfo_rec_pupil_description3);
143 cpl_plugin_init(plugin,
145 SINFONI_BINARY_VERSION,
146 CPL_PLUGIN_TYPE_RECIPE,
148 "Pupil data reduction",
149 sinfo_rec_pupil_description,
151 "Andrea.Modigliani@eso.org",
153 sinfo_rec_pupil_create,
154 sinfo_rec_pupil_exec,
155 sinfo_rec_pupil_destroy);
157 cpl_pluginlist_append(list, plugin);
173 static int sinfo_rec_pupil_create(cpl_plugin *plugin)
175 cpl_recipe * recipe ;
178 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
179 recipe = (cpl_recipe *)plugin ;
185 recipe->parameters = cpl_parameterlist_new() ;
192 sinfo_product_config_add(recipe->parameters);
193 sinfo_prepare_stacked_frames_config_add(recipe->parameters);
194 sinfo_objnod_config_add(recipe->parameters);
208 static int sinfo_rec_pupil_exec(cpl_plugin *plugin)
211 cpl_recipe *recipe = (cpl_recipe *) plugin;
213 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
214 recipe = (cpl_recipe *)plugin ;
217 return sinfo_rec_pupil(recipe->parameters, recipe->frames);
228 static int sinfo_rec_pupil_destroy(cpl_plugin *plugin)
230 cpl_recipe * recipe ;
232 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
233 recipe = (cpl_recipe *)plugin ;
236 cpl_parameterlist_delete(recipe->parameters);
254 static int sinfo_rec_pupil(cpl_parameterlist *config, cpl_frameset *
set)
260 sinfo_msg(
"Welcome to SINFONI Pipeline release %d.%d.%d",
261 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
263 ck0(sinfo_dfs_set_groups(
set),
"Cannot indentify RAW and CALIB frames") ;
266 sinfo_msg(
"---------------------------------------------");
267 sinfo_msg(
"%s FRAME DETERMINATION", PRO_PUPIL_LAMP_STACKED);
268 sinfo_msg(
"---------------------------------------------");
270 ck0(sinfo_new_prepare_stacked_frames(cpl_func,config,
set, NULL,
271 PRO_PUPIL_LAMP_STACKED,0,fk ),
272 "Failed %s FRAME DETERMINATION", PRO_PUPIL_LAMP_STACKED);
273 sinfo_msg(
"%s FRAME DETERMINATION SUCCESS", PRO_PUPIL_LAMP_STACKED);
275 sinfo_msg(
"---------------------------------------------");
276 sinfo_msg(
"PUPIL DATA REDUCTION");
277 sinfo_msg(
"---------------------------------------------");
279 ck0(sinfo_new_objnod(cpl_func,config,
set,PRO_COADD_PUPIL),
280 "Failed PUPIL DATA REDUCTION") ;
281 sinfo_msg(
"PUPIL DATA REDUCTION SUCCESS");
284 sinfo_fake_delete(&fk);
286 if (cpl_error_get_code() != CPL_ERROR_NONE) {