49 #include <irplib_utils.h>
52 #include <sinfo_pro_types.h>
53 #include <sinfo_product_config.h>
54 #include <sinfo_prepare_stacked_frames_config.h>
55 #include <sinfo_objnod_config.h>
56 #include <sinfo_skycor_config.h>
57 #include <sinfo_functions.h>
58 #include <sinfo_new_prepare_stacked_frames.h>
59 #include <sinfo_new_cubes_coadd.h>
60 #include <sinfo_new_stdstar.h>
61 #include <sinfo_new_psf.h>
62 #include <sinfo_tpl_utils.h>
63 #include <sinfo_tpl_dfs.h>
64 #include <sinfo_hidden.h>
65 #include <sinfo_globals.h>
66 #include <sinfo_msg.h>
67 #include <sinfo_rec_utils.h>
68 #include <sinfo_error.h>
69 #include <sinfo_utils_wrappers.h>
75 static int sinfo_rec_psf_create(cpl_plugin *) ;
76 static int sinfo_rec_psf_exec(cpl_plugin *) ;
77 static int sinfo_rec_psf_destroy(cpl_plugin *) ;
78 static int sinfo_rec_psf(cpl_parameterlist *, cpl_frameset *);
83 static char sinfo_rec_psf_description1[] =
84 "This recipe performs psf standard data reduction.\n"
85 "The input files are science object and sky frames with tags\n"
86 "PSF_CALIBRATOR and SKY_PSF_CALIBRATOR\n"
87 "Master calibration frames:\n";
89 static char sinfo_rec_psf_description2[] =
90 "Master calibration frames:\n"
91 "A corresponding (band,preoptics) wavelength map image (tag=WAVE_MAP)\n"
92 "A corresponding (band,preoptics) master flat field (tag=MASTER_FLAT_LAMP)\n"
93 "A corresponding (band,preoptics) master bad pixel map (tag=MASTER_BP_MAP)\n"
94 "A corresponding (band,preoptics) slitlets position frame (tag=SLIT_POS)\n"
95 "A corresponding (band) distortion table (tag=DISTORTION)\n"
96 "A corresponding (band) slitlet distance table (tag=SLITLETS_DISTANCE)\n";
99 static char sinfo_rec_psf_description3[] =
100 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
101 "the chosen operation\n"
102 "A reference table with the position of the first column (tag=FIRST_COLUMN)\n"
103 "Relevant outputs are:\n"
104 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
105 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n"
106 "An average along Z of the reconstructed cube \n"
107 "(PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
108 "The bad pixel map associated to the cube \n"
109 "(PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n"
112 static char sinfo_rec_psf_description[1300];
143 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
144 cpl_plugin *plugin = &recipe->interface;
145 strcpy(sinfo_rec_psf_description,sinfo_rec_psf_description1);
146 strcat(sinfo_rec_psf_description,sinfo_rec_psf_description2);
147 strcat(sinfo_rec_psf_description,sinfo_rec_psf_description3);
149 cpl_plugin_init(plugin,
151 SINFONI_BINARY_VERSION,
152 CPL_PLUGIN_TYPE_RECIPE,
154 "PSF star data reduction",
155 sinfo_rec_psf_description,
157 "Andrea.Modigliani@eso.org",
159 sinfo_rec_psf_create,
161 sinfo_rec_psf_destroy);
163 cpl_pluginlist_append(list, plugin);
178 static int sinfo_rec_psf_create(cpl_plugin *plugin)
180 cpl_recipe * recipe ;
183 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
184 recipe = (cpl_recipe *)plugin ;
189 recipe->parameters = cpl_parameterlist_new() ;
194 sinfo_product_config_add(recipe->parameters);
195 sinfo_prepare_stacked_frames_config_add(recipe->parameters);
196 sinfo_objnod_config_add(recipe->parameters);
197 sinfo_skycor_config_add(recipe->parameters);
208 static int sinfo_rec_psf_exec(cpl_plugin *plugin)
210 cpl_recipe * recipe ;
211 cpl_errorstate initial_errorstate = cpl_errorstate_get();
214 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
215 recipe = (cpl_recipe *)plugin ;
218 if (!cpl_errorstate_is_equal(initial_errorstate)) {
221 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
223 return sinfo_rec_psf(recipe->parameters, recipe->frames);
234 static int sinfo_rec_psf_destroy(cpl_plugin *plugin)
236 cpl_recipe * recipe ;
239 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
240 recipe = (cpl_recipe *)plugin ;
243 cpl_parameterlist_delete(recipe->parameters);
264 sinfo_rec_psf(cpl_parameterlist *config, cpl_frameset *set)
268 const char* pro_ctg_cube;
269 sinfo_msg(
"Welcome to SINFONI Pipeline release %d.%d.%d",
270 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
272 if(sinfo_dfs_set_groups(set)) {
273 sinfo_msg(
"Cannot indentify RAW and CALIB frames") ;
281 ck0(sinfo_cub_stk_frames(config,&set,cpl_func,&pro_ctg_cube),
282 "Cannot stack RAW frames") ;
287 sinfo_msg(
"------------------------------") ;
288 sinfo_msg(
"COADDING CUBES");
289 sinfo_msg(
"------------------------------") ;
291 ck0(sinfo_new_cubes_coadd(cpl_func,config, set, pro_ctg_cube),
293 sinfo_msg(
"------------------------------") ;
294 sinfo_msg(
"COADDED CUBES");
295 sinfo_msg(
"------------------------------") ;
301 sinfo_msg(
"------------------------------") ;
302 sinfo_msg(
"REDUCE PSF STD STAR FRAMES");
303 sinfo_msg(
"------------------------------") ;
304 ck0(sinfo_new_psf(cpl_func,config,set),
"REDUCING PSF STD STAR FRAMES");
305 sinfo_msg(
"SUCCESS REDUCE PSF STD STAR FRAMES") ;
311 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.