56#define XSH_UTL_RONBIAS_RECIPE_ID "xsh_util_ronbias"
57#define XSH_UTL_RONBIAS_RECIPE_AUTHOR "A.Modigliani"
58#define XSH_UTL_RONBIAS_RECIPE_CONTACT "Andrea.Modigliani@eso.org"
59#define PRO_IMA "PRO_IMA_UVB"
60#define KEY_VALUE_HPRO_DID "PRO-1.15"
77"This recipe performs ron computation on a bias pair.\n"
78"The input files should be tagged as BIAS_arm)\n"
79"The output is a bias frame difference with RON computed as follows:\n"
80"The input biase difference is computed. Then a median on nsampl (100) \n"
81"random boxes of size xsize*ysize (20x20) is computed \n"
82"then the rms of the obtained values is determined and divided by sqrt(2)\n"
83"This gives the RON in [ADU]\n"
84"Information on relevant parameters can be found with\n"
85"esorex --params xsh_util_ronbias\n"
86"esorex --help xsh_util_ronbias\n"
111 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe ) ;
112 cpl_plugin * plugin = &recipe->interface ;
114 cpl_plugin_init(plugin,
117 CPL_PLUGIN_TYPE_RECIPE,
128 cpl_pluginlist_append(list, plugin) ;
145 cpl_recipe * recipe ;
152 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
153 recipe = (cpl_recipe *)plugin ;
159 recipe->parameters = cpl_parameterlist_new() ;
164 recipe->parameters ) ) ;
167 p = cpl_parameter_new_value(
"xsh.xsh_util_ronbias.nsampl",
169 "Number of sampling values",
170 "xsh.xsh_util_ronbias",100);
171 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"nsampl") ;
172 cpl_parameterlist_append(recipe->parameters, p) ;
176 p = cpl_parameter_new_value(
"xsh.xsh_util_ronbias.hsize",
178 "Random square boxes size",
179 "xsh.xsh_util_ronbias",10);
180 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"hsize") ;
181 cpl_parameterlist_append(recipe->parameters, p) ;
184 p = cpl_parameter_new_value(
"xsh.xsh_util_ronbias.llx",
186 "Lower left X of sampling region",
187 "xsh.xsh_util_ronbias",-1);
188 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"llx") ;
189 cpl_parameterlist_append(recipe->parameters, p) ;
192 p = cpl_parameter_new_value(
"xsh.xsh_util_ronbias.lly",
194 "Lower left Y of sampling region",
195 "xsh.xsh_util_ronbias",-1);
196 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"lly") ;
197 cpl_parameterlist_append(recipe->parameters, p) ;
201 p = cpl_parameter_new_value(
"xsh.xsh_util_ronbias.urx",
203 "Upper right X of sampling region",
204 "xsh.xsh_util_ronbias",-1);
205 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"urx") ;
206 cpl_parameterlist_append(recipe->parameters, p) ;
209 p = cpl_parameter_new_value(
"xsh.xsh_util_ronbias.ury",
211 "Upper right Y of sampling region",
212 "xsh.xsh_util_ronbias",-1);
213 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"ury") ;
214 cpl_parameterlist_append(recipe->parameters, p) ;
235 cpl_recipe * recipe ;
237 cpl_errorstate initial_errorstate = cpl_errorstate_get();
240 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
241 recipe = (cpl_recipe *)plugin ;
248 if (!cpl_errorstate_is_equal(initial_errorstate)) {
251 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
266 cpl_recipe * recipe ;
269 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
270 recipe = (cpl_recipe *)plugin ;
273 cpl_parameterlist_delete(recipe->parameters) ;
289 cpl_frameset * frames)
291 cpl_parameter * param= NULL ;
304 xsh_msg(
"Welcome to XSHOOTER Pipeline release %d.%d.%d",
305 XSH_MAJOR_VERSION,XSH_MINOR_VERSION,XSH_MICRO_VERSION);
309 check(param=cpl_parameterlist_find(parlist,
"xsh.xsh_util_ronbias.nsampl"));
310 check(nsampl=cpl_parameter_get_int(param));
312 check(param=cpl_parameterlist_find(parlist,
"xsh.xsh_util_ronbias.hsize"));
313 check(hsize=cpl_parameter_get_int(param));
316 check(param=cpl_parameterlist_find(parlist,
"xsh.xsh_util_ronbias.llx"));
317 check(
llx=cpl_parameter_get_int(param));
319 check(param=cpl_parameterlist_find(parlist,
"xsh.xsh_util_ronbias.lly"));
320 check(
lly=cpl_parameter_get_int(param));
322 check(param=cpl_parameterlist_find(parlist,
"xsh.xsh_util_ronbias.urx"));
323 check(
urx=cpl_parameter_get_int(param));
325 check(param=cpl_parameterlist_find(parlist,
"xsh.xsh_util_ronbias.ury"));
326 check(
ury=cpl_parameter_get_int(param));
330 xsh_msg(
"ron=%g ron_err=%g",ron,ron_err);
334 if (cpl_error_get_code()) {
#define xsh_msg(...)
Print a message on info level.
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static int xsh_util_ronbias_create(cpl_plugin *)
Setup the recipe options
static int xsh_util_ronbias_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static int xsh_util_ronbias(cpl_parameterlist *, cpl_frameset *)
Get the command line options and execute the data reduction.
static int xsh_util_ronbias_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
const char * xsh_get_license(void)
Get the pipeline copyright and license.
void xsh_init(void)
Reset library state.
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)
static char xsh_util_ronbias_description_short[]
#define XSH_UTL_RONBIAS_RECIPE_AUTHOR
#define XSH_UTL_RONBIAS_RECIPE_ID
static char xsh_util_ronbias_description[]
#define XSH_UTL_RONBIAS_RECIPE_CONTACT
cpl_error_code xsh_compute_ron(cpl_frameset *frames, int llx, int lly, int urx, int ury, int nsampl, int hsize, const int reg_id, double *ron, double *ron_err)
compute ron taking random windows of given size in a given region on 2 frames difference