59#define RECIPE_ID "xsh_util_guess_xy"
60#define RECIPE_AUTHOR "A.Modigliani, P. Bristow"
61#define RECIPE_CONTACT "amodigli@eso.org"
82 "This recipe finds X-Y guesses corresponding to 'grating_order','wavelength','slit' as in input tab. \n"
83 "The sof file contains the names of the input FITS file\n"
84 "tagged with XSH_MOD_CFG_arm.\n"
85 "tagged with ARC_LINE_LIST_arm.\n"
86 "This recipe has the following products:\n"
87 "Model predictions (PRO CATG = MOD_arm)\n" ;
106 cpl_recipe * recipe = cpl_calloc(1,
sizeof(*recipe));
107 cpl_plugin * plugin = &recipe->interface;
109 cpl_plugin_init(plugin,
112 CPL_PLUGIN_TYPE_RECIPE,
123 cpl_pluginlist_append(list, plugin);
140 cpl_recipe * recipe ;
141 cpl_parameter* p=NULL;
146 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
147 recipe = (cpl_recipe *)plugin ;
151 recipe->parameters = cpl_parameterlist_new() ;
156 p = cpl_parameter_new_value(
"xsh.xsh_model.binx",
161 cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
"binx");
162 cpl_parameterlist_append(recipe->parameters,p);
165 p = cpl_parameter_new_value(
"xsh.xsh_model.biny",
170 cpl_parameter_set_alias(p,CPL_PARAMETER_MODE_CLI,
"biny");
171 cpl_parameterlist_append(recipe->parameters,p);
189 cpl_recipe * recipe ;
192 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
193 recipe = (cpl_recipe *)plugin ;
208 cpl_recipe * recipe ;
211 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
212 recipe = (cpl_recipe *)plugin ;
215 cpl_parameterlist_delete(recipe->parameters) ;
229 cpl_parameterlist * parameters,
230 cpl_frameset * frameset)
236 int recipe_tags_size = 1;
238 cpl_frameset* raws=NULL;
239 cpl_frameset* calib=NULL;
240 cpl_frame* wave_list=NULL ;
241 cpl_frame* xsh_config=NULL ;
243 cpl_parameter* p=NULL;
254 cpl_table* input_table=NULL;
255 const char* input_table_name = NULL;
262 recipe_tags, recipe_tags_size,
RECIPE_ID,
269 check(p = cpl_parameterlist_find(parameters,
"xsh.xsh_model.binx"));
272 check(p = cpl_parameterlist_find(parameters,
"xsh.xsh_model.biny"));
274 xsh_msg(
"cfg frm name=%s",cpl_frame_get_filename(xsh_config));
279 input_table_name=cpl_frame_get_filename(wave_list);
280 input_table=cpl_table_load(input_table_name,1,0);
281 check(nrow=cpl_table_get_nrow(input_table));
283 check(pwav=cpl_table_get_data_double(input_table,
"wavelength"));
284 check(pord=cpl_table_get_data_double(input_table,
"grating_order"));
285 check(pslit=cpl_table_get_data_double(input_table,
"slit"));
287 for(i=0;i<nrow;i++) {
293 xsh_msg(
"ord=%d wav=%10.8g s=%g ==>x=%16.13g y=%16.13g",ord,wave,
s,
x,
y);
static xsh_instrument * instrument
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
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.
void xsh_model_get_xy(xsh_xs_3 *p_xs_3, xsh_instrument *instr, double lambda_nm, int morder, double ent_slit_pos, double *x, double *y)
Compute the detector location (floating point pixels) of a given wavelength/entrance slit position.
void xsh_model_binxy(xsh_xs_3 *p_xs_3, int bin_X, int bin_Y)
corrects model for detector's binning
static int xsh_util_guess_xy(cpl_parameterlist *, cpl_frameset *)
The FITS file creation occurs here.
static char xsh_util_guess_xy_description[]
static int xsh_util_guess_xy_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static char xsh_util_guess_xy_description_short[]
static int xsh_util_guess_xy_create(cpl_plugin *)
Setup the recipe options
static int xsh_util_guess_xy_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
#define xsh_msg(...)
Print a message on info level.
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.
cpl_frame * xsh_find_frame_with_tag(cpl_frameset *frames, const char *tag, xsh_instrument *instr)
Find frame with a given tag.
#define XSH_ARC_LINE_LIST
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)