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 #include <sinfo_pro_types.h>
00054 #include <sinfo_prepare_stacked_frames_config.h>
00055 #include <sinfo_objnod_config.h>
00056 #include <sinfo_standard_star_config.h>
00057 #include <sinfo_skycor_config.h>
00058 #include <sinfo_new_prepare_stacked_frames.h>
00059 #include <sinfo_new_cubes_coadd.h>
00060 #include <sinfo_new_stdstar.h>
00061 #include <sinfo_functions.h>
00062 #include <sinfo_tpl_utils.h>
00063 #include <sinfo_tpl_dfs.h>
00064 #include <sinfo_hidden.h>
00065 #include <sinfo_globals.h>
00066 #include <sinfo_msg.h>
00067 #include <sinfo_rec_utils.h>
00068 #include <sinfo_error.h>
00069 #include <sinfo_utils_wrappers.h>
00070
00071
00072
00073
00074
00075
00076 static int sinfo_step_stdstar_create(cpl_plugin *) ;
00077 static int sinfo_step_stdstar_exec(cpl_plugin *) ;
00078 static int sinfo_step_stdstar_destroy(cpl_plugin *) ;
00079 static int sinfo_step_stdstar(cpl_parameterlist *, cpl_frameset *);
00080
00081
00082
00083
00084
00085 static char sinfo_step_stdstar_description1[] =
00086 "This recipe performs science data reduction.\n"
00087 "The input files are science object and sky frames with tags\n"
00088 "STD_NODDING and SKY_STD_NODDING\n";
00089
00090
00091 static char sinfo_step_stdstar_description2[] =
00092 "Master calibration frames:\n"
00093 "A corresponding (band,preoptics) wavelength map image with tag WAVE_MAP\n"
00094 "A corresponding (band,preoptics) master flat field with tag MASTER_FLAT_LAMP\n"
00095 "A corresponding (band,preoptics) master bad pixel map with tag MASTER_BP_MAP\n"
00096 "A corresponding (band,preoptics) slitlets position frame with tag SLIT_POS\n"
00097 "A corresponding (band) distortion table with tag DISTORTION\n"
00098 "A corresponding (band) slitlet distance table with tag SLITLETS_DISTANCE\n";
00099
00100
00101 static char sinfo_step_stdstar_description3[] =
00102 "The output is an image resulting from the IMA1 op IMA2 where op indicates\n"
00103 "A reference table with the position of the first column\n"
00104 " with tag FIRST_COLUMN\n"
00105 "Relevant outputs are:\n"
00106 "combined cubes (PRO.CATG=x_OBS x=STD,OBJ,PSF)\n"
00107 "reconstructed cube (PRO.CATG=COADD_x_OBS x=STD,OBJ,PSF)\n";
00108
00109
00110 static char sinfo_step_stdstar_description4[] =
00111 "An average along Z of the reconstructed cube \n"
00112 "(PRO.CATG=MED_x_OBS x=STD,OBJ,PSF)\n"
00113 "The bad pixel map associated to the cube \n"
00114 "(PRO.CATG=BP_MAP_COADD_x_OBS x=STD,OBJ,PSF)\n"
00115 "The std star spectrum image (PRO.CATG=STD_SPECTRUM)\n"
00116 "The std start spectrum and efficiency spectrum table (PRO.CATG=STD_SPECTRA)\n"
00117 "Information on relevant parameters can be found with\n"
00118 "esorex --params sinfo_step_stdstar\n"
00119 "esorex --help sinfo_step_stdstar\n"
00120 "\n";
00121
00122
00123 static char sinfo_step_stdstar_description[1300];
00124
00125
00126
00127
00128
00132
00133
00134
00143
00144
00145
00146 int
00147 cpl_plugin_get_info(cpl_pluginlist *list)
00148 {
00149
00150 cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00151 cpl_plugin *plugin = &recipe->interface;
00152
00153 strcpy(sinfo_step_stdstar_description,sinfo_step_stdstar_description1);
00154 strcat(sinfo_step_stdstar_description,sinfo_step_stdstar_description2);
00155 strcat(sinfo_step_stdstar_description,sinfo_step_stdstar_description3);
00156 strcat(sinfo_step_stdstar_description,sinfo_step_stdstar_description4);
00157
00158
00159 cpl_plugin_init(plugin,
00160 CPL_PLUGIN_API,
00161 SINFONI_BINARY_VERSION,
00162 CPL_PLUGIN_TYPE_RECIPE,
00163 "sinfo_step_stdstar",
00164 "Standard star data reduction",
00165 sinfo_step_stdstar_description,
00166 "Andrea Modigliani",
00167 "Andrea.Modigliani@eso.org",
00168 sinfo_get_license(),
00169 sinfo_step_stdstar_create,
00170 sinfo_step_stdstar_exec,
00171 sinfo_step_stdstar_destroy);
00172
00173 cpl_pluginlist_append(list, plugin);
00174
00175 return 0;
00176
00177 }
00178
00179
00180
00181
00189
00190
00191
00192 static int sinfo_step_stdstar_create(cpl_plugin *plugin)
00193 {
00194 cpl_recipe * recipe ;
00195
00196
00197 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00198 recipe = (cpl_recipe *)plugin ;
00199 else return -1 ;
00200 cpl_error_reset();
00201 irplib_reset();
00202
00203
00204 recipe->parameters = cpl_parameterlist_new() ;
00205
00206
00207
00208
00209
00210 sinfo_prepare_stacked_frames_config_add(recipe->parameters);
00211 sinfo_objnod_config_add(recipe->parameters);
00212 sinfo_skycor_config_add(recipe->parameters);
00213 sinfo_standard_star_config_add(recipe->parameters);
00214
00215 return 0;
00216
00217 }
00218
00219
00225
00226 static int sinfo_step_stdstar_exec(cpl_plugin *plugin)
00227 {
00228 cpl_recipe * recipe ;
00229
00230
00231 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00232 recipe = (cpl_recipe *)plugin ;
00233 else return -1 ;
00234
00235 return sinfo_step_stdstar(recipe->parameters, recipe->frames);
00236
00237 }
00238
00239
00245
00246 static int sinfo_step_stdstar_destroy(cpl_plugin *plugin)
00247 {
00248 cpl_recipe * recipe ;
00249
00250
00251 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
00252 recipe = (cpl_recipe *)plugin ;
00253 else return -1 ;
00254
00255 cpl_parameterlist_delete(recipe->parameters);
00256 return 0;
00257
00258 }
00259
00260
00261
00268
00269
00270
00271
00272
00273
00274
00275 static int
00276 sinfo_step_stdstar(cpl_parameterlist *config, cpl_frameset *set)
00277 {
00278
00279
00280 if(sinfo_dfs_set_groups(set)) {
00281 sinfo_msg_error("Cannot indentify RAW and CALIB frames") ;
00282 return -1;
00283 }
00284
00285
00286
00287
00288 sinfo_msg("------------------------------") ;
00289 sinfo_msg("STD STAR DATA REDUCTION");
00290 sinfo_msg("------------------------------") ;
00291
00292 ck0(sinfo_new_stdstar(cpl_func,config, set, set ),"REDUCING STD STAR DATA") ;
00293 sinfo_msg("STD STAR DATA REDUCTION SUCCESS") ;
00294
00295 return 0 ;
00296 cleanup:
00297 return -1;
00298
00299 }
00300