58#define RECIPE_ID "xsh_util_physmod"
59#define RECIPE_AUTHOR "A.Modigliani, P. Bristow"
60#define RECIPE_CONTACT "amodigli@eso.org"
80 "This recipe generates the theoretical and the spectral format tables. \n"
81 "and possibly the model based wave map.\n"
82 "The sof file contains the names of the input FITS file\n"
83 "tagged with XSH_MOD_CFG_TAB_arm.\n"
84 "tagged with ARC_LINE_LIST_arm.\n"
85 "This recipe has the following products:\n"
86 "Model order traces for nine pinholes (PRO CATG = THEO_TAB_MULT_arm)\n"
87 "Model order traces for nine pinholes (PRO CATG = THEO_TAB_IFU_arm)\n"
88 "Model order traces for central pinhole (PRO CATG = THEO_TAB_SING_arm)\n"
89 "Spectral format table (PRO CATG = SPECTRAL_FORMAT_TAB_arm)\n"
90 "Wave map image (PRO CATG = WAVE_MAP_arm)\n"
91 "Slit map image (PRO CATG = SLIT_MAP_arm)\n" ;
110 cpl_recipe * recipe = cpl_calloc(1,
sizeof(*recipe));
111 cpl_plugin * plugin = &recipe->interface;
113 cpl_plugin_init(plugin,
116 CPL_PLUGIN_TYPE_RECIPE,
127 cpl_pluginlist_append(list, plugin);
144 cpl_recipe * recipe ;
145 cpl_parameter* p=NULL;
150 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
151 recipe = (cpl_recipe *)plugin ;
155 recipe->parameters = cpl_parameterlist_new() ;
160 p = cpl_parameter_new_value(
"xsh.xsh_model.binx",
165 cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
"binx");
166 cpl_parameterlist_append(recipe->parameters,p);
169 p = cpl_parameter_new_value(
"xsh.xsh_model.biny",
174 cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
"biny");
175 cpl_parameterlist_append(recipe->parameters,p);
178 p = cpl_parameter_new_value(
"xsh.xsh_model.spectral_format_tab",
180 "Generate spectral format table ",
181 "xsh.xsh_model", FALSE);
183 cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
"spectral-format-tab");
184 cpl_parameterlist_append(recipe->parameters,p);
186 p = cpl_parameter_new_value(
"xsh.xsh_model.wavemap",
188 "Generate slit and wave maps (time consuming) ",
189 "xsh.xsh_model", FALSE);
191 cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
"wavemap");
192 cpl_parameterlist_append(recipe->parameters,p);
209 cpl_recipe * recipe ;
212 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
213 recipe = (cpl_recipe *)plugin ;
228 cpl_recipe * recipe ;
231 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
232 recipe = (cpl_recipe *)plugin ;
235 cpl_parameterlist_delete(recipe->parameters) ;
249 cpl_parameterlist * parameters,
250 cpl_frameset * frameset)
255 char wave_map_tag[256];
256 char slit_map_tag[256];
258 int recipe_tags_size = 1;
260 cpl_frameset* raws=NULL;
261 cpl_frameset* calib=NULL;
262 cpl_frame* wave_list=NULL ;
263 cpl_frame* xsh_config=NULL ;
264 cpl_frame* model_THE1_frm=NULL ;
265 cpl_frame* model_THE9_frm=NULL ;
266 cpl_frame* model_THE_IFU_frm=NULL ;
268 cpl_frame* spf_frm=NULL ;
269 cpl_frame* wavemap_frame=NULL ;
270 cpl_frame* slitmap_frame=NULL ;
274 cpl_parameter* p=NULL;
277 char *prefix = NULL ;
282 recipe_tags, recipe_tags_size,
RECIPE_ID,
290 check(p = cpl_parameterlist_find(parameters,
"xsh.xsh_model.binx"));
293 check(p = cpl_parameterlist_find(parameters,
"xsh.xsh_model.biny"));
308 check(model_THE_IFU_frm=cpl_frame_duplicate(model_THE9_frm));
311 cpl_frame_set_tag(model_THE_IFU_frm,
328 check(p = cpl_parameterlist_find(parameters,
"xsh.xsh_model.spectral_format_tab"));
329 check(gen_spf = cpl_parameter_get_bool(p));
339 check(p = cpl_parameterlist_find(parameters,
"xsh.xsh_model.wavemap"));
340 check(gen_map = cpl_parameter_get_bool(p));
344 check(sprintf(wave_map_tag,
"%s",
347 check(sprintf(slit_map_tag,
"%s",
352 wave_map_tag, slit_map_tag,
353 &wavemap_frame, &slitmap_frame,1));
399 struct xs_3* p_xs_3_config=NULL;
400 struct xs_3 xs_3_config;
401 cpl_frame* spf_frame=NULL;
403 const char* pro_catg=NULL;
405 p_xs_3_config=&xs_3_config;
409 cpl_frame_get_filename(config_frame)) ;
416 sprintf(SPF_name,
"%s%s",pro_catg,
".fits");
424 CPL_FRAME_TYPE_TABLE,
425 CPL_FRAME_GROUP_PRODUCT,
426 CPL_FRAME_LEVEL_FINAL));
432 if(cpl_error_get_code() == CPL_ERROR_NONE) {
static xsh_instrument * instrument
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
void xsh_instrument_set_biny(xsh_instrument *instrument, const int biny)
void xsh_instrument_set_binx(xsh_instrument *instrument, const int binx)
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
cpl_error_code xsh_model_config_load_best(cpl_frame *config_frame, xsh_xs_3 *p_xs_3)
Load the config model table and fill the struct.
cpl_frame * xsh_model_spectralformat_create(xsh_xs_3 *p_xs_3, const char *tab_filename)
creates the model spectral format table
static int xsh_util_physmod_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
static int xsh_util_physmod(cpl_parameterlist *, cpl_frameset *)
The FITS file creation occurs here.
static int xsh_util_physmod_create(cpl_plugin *)
Setup the recipe options
static char xsh_util_physmod_description[]
static cpl_frame * xsh_util_model_SPF_create(cpl_frame *config_frame, xsh_instrument *instrument)
static char xsh_util_physmod_description_short[]
static int xsh_util_physmod_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
#define xsh_msg_error(...)
Print an error message.
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
const char * xsh_get_license(void)
Get the pipeline copyright and license.
void xsh_init(void)
Reset library state.
cpl_error_code xsh_begin(cpl_frameset *frames, const cpl_parameterlist *parameters, xsh_instrument **instrument, cpl_frameset **raws, cpl_frameset **calib, const char *tag_list[], int tag_list_size, const char *recipe_id, unsigned int binary_version, const char *short_descr)
Recipe initialization.
void xsh_create_model_map(cpl_frame *model_frame, xsh_instrument *instrument, const char *wtag, const char *stag, cpl_frame **wavemap_frame, cpl_frame **slitmap_frame, const int save_tmp)
int xsh_print_rec_status(const int val)
Check if an error has happened and returns error kind and location.
void xsh_add_product_image(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
void xsh_add_product_table(cpl_frame *frame, cpl_frameset *frameset, const cpl_parameterlist *parameters, const char *recipe_id, xsh_instrument *instrument, const char *final_prefix)
Save Table product (input frame has several extensions, 1 table per extension)
cpl_frame * xsh_frame_product(const char *fname, const char *tag, cpl_frame_type type, cpl_frame_group group, cpl_frame_level level)
Creates a frame with given characteristics.
cpl_frame * xsh_find_frame_with_tag(cpl_frameset *frames, const char *tag, xsh_instrument *instr)
Find frame with a given tag.
#define XSH_GET_TAG_FROM_ARM(TAG, instr)
#define XSH_SPECTRAL_FORMAT
#define XSH_ARC_LINE_LIST
cpl_frame * xsh_util_physmod_model_THE_create(cpl_frame *config_frame, xsh_instrument *instrument, cpl_frame *wave_list, const int binx, const int biny, const int num_ph, const int sky)
cpl_error_code xsh_parameters_decode_bp(const char *recipe_id, cpl_parameterlist *plist, const int ival)
void xsh_parameters_generic(const char *recipe_id, cpl_parameterlist *plist)
#define XSH_FREE(POINTER)
#define XSH_PREFIX(prefix, name, instr)