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
00033
00034
00035
00036 #ifdef HAVE_CONFIG_H
00037 #include <config.h>
00038 #endif
00039
00040
00041 #include <strings.h>
00042 #include <string.h>
00043 #include <stdio.h>
00044
00045
00046
00047 #include <cpl.h>
00048
00049
00050 #include <irplib_utils.h>
00051
00052
00053
00054 #include <sinfo_pro_types.h>
00055 #include <sinfo_product_config.h>
00056 #include <sinfo_prepare_stacked_frames_config.h>
00057 #include <sinfo_objnod_config.h>
00058 #include <sinfo_raw_types.h>
00059 #include <sinfo_tpl_utils.h>
00060 #include <sinfo_tpl_dfs.h>
00061 #include <sinfo_hidden.h>
00062 #include <sinfo_globals.h>
00063 #include <sinfo_functions.h>
00064 #include <sinfo_msg.h>
00065 #include <sinfo_new_prepare_stacked_frames.h>
00066 #include <sinfo_new_objnod.h>
00067
00068
00069
00070
00071 static int sinfo_rec_pupil_create(cpl_plugin *);
00072 static int sinfo_rec_pupil_exec(cpl_plugin *);
00073 static int sinfo_rec_pupil_destroy(cpl_plugin *);
00074 static int sinfo_rec_pupil(cpl_parameterlist *, cpl_frameset *);
00075
00076
00077
00078
00079 static char sinfo_rec_pupil_description1[] =
00080 "This recipe performs science data reduction.\n"
00081 "The input files are science object and sky frames \n"
00082 "with tags OBJECT_NODDING and SKY_NODDING\n"
00083 "Master calibration frames:\n";
00084
00085
00086 static char sinfo_rec_pupil_description2[] =
00087 "A corresponding (band,preoptics) wavelength map image with tag WAVE_MAP\n"
00088 "A corresponding (band,preoptics) master flat field with tag MASTER_FLAT_LAMP\n"
00089 "A corresponding (band,preoptics) master bad pixel map with tag MASTER_BP_MAP\n"
00090 "A corresponding (band,preoptics) slitlets position frame with tag SLIT_POS\n"
00091 "A corresponding (band) distortion table with tag DISTORTION\n"
00092 "A corresponding (band) slitlet distance table with tag SLITLETS_DISTANCE\n";
00093
00094
00095 static char sinfo_rec_pupil_description3[] =
00096 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
00097 "A reference table with the position of the first column with tag FIRST_COLUMN\n"
00098 "Relevant outputs are:\n"
00099 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
00100 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n"
00101 "An average along Z of the reconstructed cube \n"
00102 "(PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
00103 "The bad pixel map associated to the cube \n"
00104 "(PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n";
00105
00106
00107 static char sinfo_rec_pupil_description4[] =
00108 "Information on relevant parameters can be found with\n"
00109 "esorex --params sinfo_rec_pupil\n"
00110 "esorex --help sinfo_rec_pupil\n"
00111 "\n";
00112
00113 static char sinfo_rec_pupil_description[1300];
00114
00115
00116
00117
00118
00122
00124
00133
00134
00135 int
00136 cpl_plugin_get_info(cpl_pluginlist *list)
00137 {
00138
00139 cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00140 cpl_plugin *plugin = &recipe->interface;
00141
00142
00143 strcpy(sinfo_rec_pupil_description,sinfo_rec_pupil_description1);
00144 strcat(sinfo_rec_pupil_description,sinfo_rec_pupil_description2);
00145 strcat(sinfo_rec_pupil_description,sinfo_rec_pupil_description3);
00146 strcat(sinfo_rec_pupil_description,sinfo_rec_pupil_description4);
00147
00148 cpl_plugin_init(plugin,
00149 CPL_PLUGIN_API,
00150 SINFONI_BINARY_VERSION,
00151 CPL_PLUGIN_TYPE_RECIPE,
00152 "sinfo_rec_pupil",
00153 "Pupil data reduction",
00154 sinfo_rec_pupil_description,
00155 "Andrea Modigliani",
00156 "Andrea.Modigliani@eso.org",
00157 sinfo_get_license(),
00158 sinfo_rec_pupil_create,
00159 sinfo_rec_pupil_exec,
00160 sinfo_rec_pupil_destroy);
00161
00162 cpl_pluginlist_append(list, plugin);
00163
00164 return 0;
00165
00166 }
00167
00168
00176
00177
00178 static int sinfo_rec_pupil_create(cpl_plugin *plugin)
00179 {
00180 cpl_recipe * recipe ;
00181
00182
00183 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00184 recipe = (cpl_recipe *)plugin ;
00185 else return -1 ;
00186 cpl_error_reset();
00187 irplib_reset();
00188
00189
00190 recipe->parameters = cpl_parameterlist_new() ;
00191
00192
00193
00194
00195
00196
00197 sinfo_product_config_add(recipe->parameters);
00198 sinfo_prepare_stacked_frames_config_add(recipe->parameters);
00199 sinfo_objnod_config_add(recipe->parameters);
00200 return 0;
00201
00202 }
00203
00204
00210
00211
00212
00213 static int sinfo_rec_pupil_exec(cpl_plugin *plugin)
00214 {
00215
00216 cpl_recipe *recipe = (cpl_recipe *) plugin;
00217
00218 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00219 recipe = (cpl_recipe *)plugin ;
00220 else return -1 ;
00221
00222 return sinfo_rec_pupil(recipe->parameters, recipe->frames);
00223
00224 }
00225
00226
00232
00233 static int sinfo_rec_pupil_destroy(cpl_plugin *plugin)
00234 {
00235 cpl_recipe * recipe ;
00236
00237 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00238 recipe = (cpl_recipe *)plugin ;
00239 else return -1 ;
00240
00241 cpl_parameterlist_delete(recipe->parameters);
00242
00243 return 0;
00244
00245 }
00246
00247
00254
00255
00256
00257
00258
00259 static int sinfo_rec_pupil(cpl_parameterlist *config, cpl_frameset *set)
00260 {
00261
00262 int ind =0;
00263 fake* fk=NULL;
00264 fk=sinfo_fake_new();
00265
00266 sinfo_msg("Welcome to SINFONI Pipeline release %d.%d.%d",
00267 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
00268
00269 if(sinfo_dfs_set_groups(set)) {
00270
00271 sinfo_msg("Cannot indentify RAW and CALIB frames") ;
00272 return -1;
00273
00274 }
00275
00276 sinfo_msg("---------------------------------------------");
00277 sinfo_msg("%s FRAME DETERMINATION", PRO_PUPIL_LAMP_STACKED);
00278 sinfo_msg("---------------------------------------------");
00279 {
00280 if ( -1 == (ind = sinfo_new_prepare_stacked_frames(cpl_func,config, set,
00281 PRO_PUPIL_LAMP_STACKED,0,fk )))
00282 {
00283 sinfo_msg_error(" no: %d\n", ind) ;
00284 sinfo_fake_delete(&fk);
00285 return -1 ;
00286 }
00287 sinfo_msg("%s FRAME DETERMINATION SUCCESS", PRO_PUPIL_LAMP_STACKED);
00288 }
00289
00290
00291 sinfo_msg("---------------------------------------------");
00292 sinfo_msg("PUPIL DATA REDUCTION");
00293 sinfo_msg("---------------------------------------------");
00294 {
00295 if ( -1 == (ind = sinfo_new_objnod(cpl_func,config, set,PRO_COADD_PUPIL)))
00296 {
00297 sinfo_msg_error("no: %d\n", ind) ;
00298 sinfo_fake_delete(&fk);
00299 return -1 ;
00300 }
00301 sinfo_msg("PUPIL DATA REDUCTION") ;
00302 }
00303
00304 sinfo_fake_delete(&fk);
00305 return 0 ;
00306
00307 }