50 #include <irplib_utils.h>
55 #include <sinfo_pro_types.h>
56 #include <sinfo_product_config.h>
57 #include <sinfo_prepare_stacked_frames_config.h>
58 #include <sinfo_objnod_config.h>
59 #include <sinfo_new_cubes_coadd.h>
60 #include <sinfo_new_prepare_stacked_frames.h>
61 #include <sinfo_skycor_config.h>
62 #include <sinfo_key_names.h>
63 #include <sinfo_raw_types.h>
64 #include <sinfo_functions.h>
65 #include <sinfo_tpl_utils.h>
66 #include <sinfo_tpl_dfs.h>
67 #include <sinfo_hidden.h>
68 #include <sinfo_globals.h>
69 #include <sinfo_msg.h>
70 #include <sinfo_rec_utils.h>
71 #include <sinfo_error.h>
72 #include <sinfo_utils_wrappers.h>
79 static int sinfo_rec_objnod_create(cpl_plugin *) ;
80 static int sinfo_rec_objnod_exec(cpl_plugin *) ;
81 static int sinfo_rec_objnod_destroy(cpl_plugin *) ;
82 static int sinfo_rec_objnod(cpl_parameterlist *, cpl_frameset *);
88 static char sinfo_rec_objnod_description1[] =
89 "This recipe performs science data reduction.\n"
90 "The input files are science object and sky frames with tags \n"
91 "OBJECT_NODDING and SKY_NODDING\n"
92 "Master calibration frames:\n";
95 static char sinfo_rec_objnod_description2[] =
96 "A corresponding (band,preoptics) wavelength map image with tag WAVE_MAP\n"
97 "A corresponding (band,preoptics) master flat field with tag MASTER_FLAT_LAMP\n"
98 "A corresponding (band,preoptics) master bad pixel map with tag MASTER_BP_MAP\n"
99 "A corresponding (band,preoptics) slitlets position frame with tag SLIT_POS\n"
100 "A corresponding (band) distortion table with tag DISTORTION\n"
101 "A corresponding (band) slitlet distance table with tag SLITLETS_DISTANCE\n";
104 static char sinfo_rec_objnod_description3[] =
105 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
106 "A reference table with the position of the first "
107 "column with tag FIRST_COLUMN\n"
108 "Relevant outputs are:\n"
109 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
110 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n"
111 "An average along Z of the reconstructed cube \n"
112 "(PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
113 "The bad pixel map associated to the cube \n"
114 "(PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n"
117 static char sinfo_rec_objnod_description[1300];
144 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
145 cpl_plugin *plugin = &recipe->interface;
147 strcpy(sinfo_rec_objnod_description,sinfo_rec_objnod_description1);
148 strcat(sinfo_rec_objnod_description,sinfo_rec_objnod_description2);
149 strcat(sinfo_rec_objnod_description,sinfo_rec_objnod_description3);
151 cpl_plugin_init(plugin,
153 SINFONI_BINARY_VERSION,
154 CPL_PLUGIN_TYPE_RECIPE,
156 "Object data reduction",
157 sinfo_rec_objnod_description,
159 "Andrea.Mdigliani@eso.org",
161 sinfo_rec_objnod_create,
162 sinfo_rec_objnod_exec,
163 sinfo_rec_objnod_destroy);
165 cpl_pluginlist_append(list, plugin);
180 static int sinfo_rec_objnod_create(cpl_plugin *plugin)
182 cpl_recipe * recipe ;
185 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
186 recipe = (cpl_recipe *)plugin ;
192 recipe->parameters = cpl_parameterlist_new() ;
198 sinfo_product_config_add(recipe->parameters);
199 sinfo_prepare_stacked_frames_config_add(recipe->parameters);
200 sinfo_objnod_config_add(recipe->parameters);
201 sinfo_skycor_config_add(recipe->parameters);
214 static int sinfo_rec_objnod_exec(cpl_plugin *plugin)
216 cpl_recipe * recipe ;
218 cpl_errorstate initial_errorstate = cpl_errorstate_get();
221 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
222 recipe = (cpl_recipe *)plugin ;
225 if (!cpl_errorstate_is_equal(initial_errorstate)) {
228 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
231 return sinfo_rec_objnod(recipe->parameters, recipe->frames);
241 static int sinfo_rec_objnod_destroy(cpl_plugin *plugin)
243 cpl_recipe *recipe = (cpl_recipe *) plugin;
246 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
247 recipe = (cpl_recipe *)plugin ;
250 cpl_parameterlist_delete(recipe->parameters);
269 static int sinfo_rec_objnod(cpl_parameterlist *config, cpl_frameset *set)
271 const char* pro_ctg_cube;
272 sinfo_msg(
"Welcome to SINFONI Pipeline release %d.%d.%d",
273 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
275 if(sinfo_dfs_set_groups(set)) {
284 ck0(sinfo_cub_stk_frames(config,&set,cpl_func,&pro_ctg_cube),
285 "Cannot stack RAW frames") ;
292 sinfo_msg(
"------------------------------") ;
293 sinfo_msg(
"COADDING CUBES");
294 sinfo_msg(
"------------------------------") ;
297 ck0(sinfo_new_cubes_coadd(cpl_func,config, set, pro_ctg_cube),
300 sinfo_msg(
"------------------------------") ;
301 sinfo_msg(
"COADDED CUBES");
302 sinfo_msg(
"------------------------------") ;
305 if (cpl_error_get_code() != CPL_ERROR_NONE) {
void irplib_reset(void)
Reset IRPLIB state.
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
#define sinfo_msg_error(...)
Print an error message.