X-shooter Pipeline Reference Manual 3.8.15
xsh_mbias.c
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2013-10-02 15:47:47 $
23 * $Revision: 1.133 $
24 * $Name: not supported by cvs2svn $
25 */
26
27#ifdef HAVE_CONFIG_H
28#include <config.h>
29#endif
30
31/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
42/*----------------------------------------------------------------------------
43 Includes
44 ----------------------------------------------------------------------------*/
45
46#include <hdrl.h>
47/* DRL steps */
48
49/* Error handling */
50#include <xsh_error.h>
51/* Utility fonctions */
52#include <xsh_utils.h>
53#include <xsh_msg.h>
54#include <xsh_data_instrument.h>
55#include <math.h>
56/* DFS functions */
57#include <xsh_dfs.h>
58/* DRL functions */
59#include <xsh_drl.h>
60#include <xsh_pfits.h>
61#include <xsh_detmon.h>
62#include <xsh_paf_save.h>
63#include <xsh_utils_image.h>
64#include <xsh_parameters.h>
65#include <xsh_drl_check.h>
67
68/* Library */
69#include <cpl.h>
70#include <assert.h>
71/*----------------------------------------------------------------------------
72 Defines
73 ----------------------------------------------------------------------------*/
74
75#define RECIPE_ID "xsh_mbias"
76#define RECIPE_AUTHOR "P.Goldoni, L.Guglielmi, R. Haigron, F. Royer, D. Bramich, A. Modigliani"
77#define RECIPE_CONTACT "amodigli@eso.org"
78
79/*----------------------------------------------------------------------------
80 Functions prototypes
81 ----------------------------------------------------------------------------*/
82
83/*
84 * Plugin initalization, execute and cleanup handlers
85 */
86
87static int xsh_mbias_create(cpl_plugin *);
88static int xsh_mbias_exec(cpl_plugin *);
89static int xsh_mbias_destroy(cpl_plugin *);
90
91/* The actual executor function */
92static void xsh_mbias(cpl_parameterlist *, cpl_frameset *);
93
94/*----------------------------------------------------------------------------
95 Static variables
96 ----------------------------------------------------------------------------*/
97static char xsh_mbias_description_short[] = "Create the master bias frame";
98
99static char xsh_mbias_description[] =
100 "This recipe creates a master bias frame by computing the median of all \
101input bias frames.\n\
102Input Frames : \n\
103 - A set of n RAW frames (Format=RAW, n >=3, Tag = BIAS_arm)\n\
104 - [OPTIONAL] A map of non linear bad pixels (Format=QUP, Tag = BP_MAP_NL_arm)\n\
105 - [OPTIONAL] A map of reference bad pixels (Format = QUP,RAW, Tag = BP_MAP_RP_arm)\n\
106Products : \n\
107 - A master bias frame (Format=PRE, PRO.CATG = MASTER_BIAS_arm)\n";
108
109/*----------------------------------------------------------------------------
110 Functions code
111 ----------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123int cpl_plugin_get_info(cpl_pluginlist * list)
124{
125 cpl_recipe *recipe = NULL;
126 cpl_plugin *plugin = NULL;
127
128 recipe = cpl_calloc(1, sizeof(*recipe));
129 if (recipe == NULL) {
130 return -1;
131 }
132
133 plugin = &recipe->interface;
134
135 cpl_plugin_init(plugin, CPL_PLUGIN_API, /* Plugin API */
136 XSH_BINARY_VERSION, /* Plugin version */
137 CPL_PLUGIN_TYPE_RECIPE, /* Plugin type */
138 RECIPE_ID, /* Plugin name */
139 xsh_mbias_description_short, /* Short help */
140 xsh_mbias_description, /* Detailed help */
141 RECIPE_AUTHOR, /* Author name */
142 RECIPE_CONTACT, /* Contact address */
143 xsh_get_license(), /* Copyright */
147
148 cpl_pluginlist_append(list, plugin);
149
150 return (cpl_error_get_code() != CPL_ERROR_NONE);
151}
152
153/*---------------------------------------------------------------------------*/
163/*--------------------------------------------------------------------------*/
164
165static int xsh_mbias_create(cpl_plugin * plugin)
166{
167 cpl_recipe *recipe = NULL;
168 xsh_fpn_param fpn_param = {10,10,1024,1024,10,100};
169 xsh_ron_param ron_param = {"ALL",
170 10,100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,25};
171 xsh_struct_param struct_param = {-1,-1};
172 xsh_stack_param stack_param = {"median",5.,5.};
173 xsh_pd_noise_param pd_noise_param = {1,1,CPL_FALSE};
174 int ival=DECODE_BP_FLAG_DEF;
175 /* Reset library state */
176 xsh_init();
177
178 /* Check input */
179 assure(plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
180
181 /* Get the recipe out of the plugin */
182 assure(cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
183 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
184
185 recipe = (cpl_recipe *) plugin;
186
187 /* Create the parameter list in the cpl_recipe object */
188 recipe->parameters = cpl_parameterlist_new();
189 assure(recipe->parameters != NULL,
190 CPL_ERROR_ILLEGAL_OUTPUT, "Memory allocation failed!");
191
192 /* Set generic parameters (common to all recipes) */
193 check( xsh_parameters_generic( RECIPE_ID, recipe->parameters ) ) ;
194 xsh_parameters_decode_bp(RECIPE_ID,recipe->parameters,ival);
195 check(xsh_parameters_stack_create(RECIPE_ID,recipe->parameters,stack_param));
196 check(xsh_parameters_fpn_create(RECIPE_ID,recipe->parameters,fpn_param));
197 check(xsh_parameters_ron_create(RECIPE_ID,recipe->parameters,ron_param));
198 check(xsh_parameters_struct_create(RECIPE_ID,recipe->parameters,struct_param));
200 pd_noise_param));
201 cleanup:
202 if (cpl_error_get_code() != CPL_ERROR_NONE) {
203 xsh_error_dump(CPL_MSG_ERROR);
204 return 1;
205 } else {
206 return 0;
207 }
208}
209
210/*---------------------------------------------------------------------------*/
216/*---------------------------------------------------------------------------*/
217
218static int xsh_mbias_exec(cpl_plugin * plugin)
219{
220 cpl_recipe *recipe = NULL;
221
222 /* Check parameter */
223 assure(plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
224
225 /* Get the recipe out of the plugin */
226 assure(cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
227 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
228
229 recipe = (cpl_recipe *) plugin;
230
231 /* Check recipe */
232 xsh_mbias(recipe->parameters, recipe->frames);
233
234 cleanup:
235 if (cpl_error_get_code() != CPL_ERROR_NONE) {
236 xsh_error_dump(CPL_MSG_ERROR);
237 cpl_error_reset();
238 return 1;
239 } else {
240 return 0;
241 }
242}
243
244/*---------------------------------------------------------------------------*/
250/*---------------------------------------------------------------------------*/
251static int xsh_mbias_destroy(cpl_plugin * plugin)
252{
253 cpl_recipe *recipe = NULL;
254
256 /* Check parameter */
257 assure(plugin != NULL, CPL_ERROR_NULL_INPUT, "Null plugin");
258
259 /* Get the recipe out of the plugin */
260 assure(cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE,
261 CPL_ERROR_TYPE_MISMATCH, "Plugin is not a recipe");
262
263 recipe = (cpl_recipe *) plugin;
264
265 xsh_free_parameterlist(&recipe->parameters);
266
267 cleanup:
268 if (cpl_error_get_code() != CPL_ERROR_NONE) {
269 return 1;
270 } else {
271 return 0;
272 }
273}
274
275static cpl_error_code
276xsh_mbias_fpn(cpl_frameset *frames, const cpl_parameterlist* parameters,
277 xsh_instrument* instrument, const char* recipe_id){
278 xsh_msg("compute noise");
279 int binx=instrument->binx;
280 int biny=instrument->biny;
282
283 //const char* bias_raw_tag=xsh_get_tag_from_arm(XSH_BIAS, instrument);
284
285 const char* bias_raw_tag=XSH_GET_TAG_FROM_ARM_EXT(XSH_BIAS,instrument);
286
287 const char* power_spectrum_mask_tag=XSH_GET_TAG_FROM_ARM_EXT(XSH_BIAS_PD_MASK,
288 instrument);
289 cpl_parameter* p;
290
291 p=xsh_parameters_find(parameters,RECIPE_ID,"pd_noise_dc_x");
292 int dc_mask_x=cpl_parameter_get_int(p);
293
294 p=xsh_parameters_find(parameters,RECIPE_ID,"pd_noise_dc_y");
295 int dc_mask_y=cpl_parameter_get_int(p);
296
297 /* Create the raw and powerspec_mask framesets (only RAW and POWERSPEC_MASK) */
298 cpl_size nframes = cpl_frameset_get_size(frames);
299 cpl_frameset *fs_raws = cpl_frameset_new();
300 cpl_frameset *fs_masks = cpl_frameset_new();
301 //xsh_msg("nframes=%ld",nframes);
302 for (cpl_size i = 0; i < nframes; i++) {
303
304 cpl_frame *frame = cpl_frameset_get_position(frames, i);
305
306 if (!strcmp(cpl_frame_get_tag(frame), bias_raw_tag)) {
307 cpl_frameset_insert(fs_raws, cpl_frame_duplicate(frame));
308
309 } else if (!strcmp(cpl_frame_get_tag(frame), power_spectrum_mask_tag)) {
310 cpl_frameset_insert(fs_masks, cpl_frame_duplicate(frame));
311 }
312 }
313
314 cpl_size n_masks = cpl_frameset_count_tags(frames, power_spectrum_mask_tag);
315 //xsh_msg("n_masks=%ld",n_masks);
316 cpl_size n_raws = cpl_frameset_get_size(fs_raws);
317 //xsh_msg("n_raws=%ld",n_raws);
318
319
320 /* Calculate QC header keywords. We call hdrl_fpn_compute calculations twice,
321 given CPL limitations */
322 cpl_propertylist *qclist = cpl_propertylist_new();
323
324 for (int n_frame = 0; n_frame < n_raws; n_frame++) {
325 cpl_frame *frm_raw = cpl_frameset_get_position(fs_raws, n_frame);
326 const char *filename_raw = cpl_frame_get_filename(frm_raw);
327 cpl_msg_info(cpl_func,"Load image, filename=%s ...", filename_raw);
328 cpl_image *img_in = cpl_image_load(cpl_frame_get_filename(frm_raw),
329 CPL_TYPE_DOUBLE, 0, 0);
330
331 /* Compute Pattern noise */
332 cpl_image *power_spectrum = NULL;
333 double std = -1.;
334 double std_mad = -1.;
335 cpl_mask *mask_in = NULL;
336 //cpl_frameset_dump(fs_masks,stdout);
337 //if (n_frame < n_masks && n_masks > 0) {
338 if (n_masks > 0) {
339 /* only one input mask is expected for each arm */
340 cpl_frame *frm_mask = cpl_frameset_get_position(fs_masks, 0);
341 const char *filename_mask = cpl_frame_get_filename(frm_mask);
342
343 /* Load input mask, extension 0 same mask for any input raw n */
344 cpl_msg_info(cpl_func,"Load mask, filename=%s ...", filename_mask);
345 mask_in = cpl_mask_load(filename_mask, 0, 0);
346 }
347
348 if (hdrl_fpn_compute(img_in, mask_in, dc_mask_x, dc_mask_y,
349 &power_spectrum, &std, &std_mad) != CPL_ERROR_NONE) {
350
351 if (img_in ) cpl_image_delete(img_in);
352 if (mask_in ) cpl_mask_delete(mask_in);
353 if (power_spectrum ) cpl_image_delete(power_spectrum);
354
355 return cpl_error_get_code();
356 }
357 if (!isnan(std) && !isnan(std_mad)) {
358 //add to qclist
359 const char* key = cpl_sprintf("ESO QC STDRAT%d",n_frame+1);
360 cpl_propertylist_update_double(qclist,key, std/std_mad);
361 }// else {
362 //add junk value?
363 //}
364 }
365
366 cpl_size nqclist = cpl_propertylist_get_size(qclist);
367 if(nqclist > 0){
368 double max = cpl_property_get_double(cpl_propertylist_get(qclist,0));
369 for(int i=1;i<nqclist;i++){
370 double val = cpl_property_get_double(cpl_propertylist_get(qclist,i));
371 if(val > max){
372 max = val;
373 }
374 }
375 cpl_propertylist_update_double(qclist,"ESO QC STD MAX",max);
376 }
377
378
379 char *out_filename = cpl_sprintf("%s","bias_fpn_power_spectrum.fits");
380 char *out_filename_mask = cpl_sprintf("%s","bias_fpn_mask.fits");
381 for (int n_frame = 0; n_frame < n_raws; n_frame++) {
382 cpl_frame *frm_raw = cpl_frameset_get_position(fs_raws, n_frame);
383 const char *filename_raw = cpl_frame_get_filename(frm_raw);
384 cpl_msg_info(cpl_func,"Load image, filename=%s ...", filename_raw);
385 cpl_image *img_in = cpl_image_load(cpl_frame_get_filename(frm_raw),
386 CPL_TYPE_DOUBLE, 0, 0);
387
388 /* Compute Pattern noise */
389 cpl_image *power_spectrum = NULL;
390 double std = -1.;
391 double std_mad = -1.;
392 cpl_mask *mask_in = NULL;
393 //cpl_frameset_dump(fs_masks,stdout);
394 //if (n_frame < n_masks && n_masks > 0) {
395 if (n_masks > 0) {
396 /* only one input mask is expected for each arm */
397 cpl_frame *frm_mask = cpl_frameset_get_position(fs_masks, 0);
398 const char *filename_mask = cpl_frame_get_filename(frm_mask);
399
400 /* Load input mask, extension 0 same mask for any input raw n */
401 cpl_msg_info(cpl_func,"Load mask, filename=%s ...", filename_mask);
402 mask_in = cpl_mask_load(filename_mask, 0, 0);
403 }
404
405 if (hdrl_fpn_compute(img_in, mask_in, dc_mask_x, dc_mask_y,
406 &power_spectrum, &std, &std_mad) != CPL_ERROR_NONE) {
407
408 if (img_in ) cpl_image_delete(img_in);
409 if (mask_in ) cpl_mask_delete(mask_in);
410 if (power_spectrum ) cpl_image_delete(power_spectrum);
411
412 return cpl_error_get_code();
413 }
414
415 cpl_propertylist *plist = cpl_propertylist_new();
416 cpl_propertylist *xlist = cpl_propertylist_new();
417
418 /* Add STD */
419 if (!isnan(std)) {
420 cpl_propertylist_update_double(plist, "ESO QC FPN STD", std);
421 cpl_propertylist_update_double(xlist, "ESO QC FPN STD", std);
422
423 } else {
424 cpl_propertylist_update_double(plist, "ESO QC FPN STD", -DBL_MAX);
425 cpl_propertylist_update_double(xlist, "ESO QC FPN STD", -DBL_MAX);
426 }
427
428 /* Add Peak value */
429 if (!isnan(std_mad)) {
430 cpl_propertylist_update_double(plist, "ESO QC FPN STDMAD", std_mad);
431 cpl_propertylist_update_double(xlist, "ESO QC FPN STDMAD", std_mad);
432 } else {
433 cpl_propertylist_update_double(plist, "ESO QC FPN STDMAD", -DBL_MAX);
434 cpl_propertylist_update_double(xlist, "ESO QC FPN STDMAD", -DBL_MAX);
435 }
436
437 /* Set EXTNAME for xlist for QC purposes */
438 if(n_frame > 0){
439 const char* extname = cpl_sprintf("BIAS_PN_%d",n_frame+1);
440 cpl_propertylist_update_string(xlist, "EXTNAME",extname);
441 } else {
442 cpl_propertylist_update_string(plist, "EXTNAME","BIAS_PN_1");
443 }
444
445
446 /* Save pattern noise mask image */
447 cpl_propertylist_update_string(plist, CPL_DFS_PRO_CATG,
448 power_spectrum_mask_tag);
449
450
451 /* Create an output frameset */
452
453 /* power spectrum mask */
454
455 cpl_image *out_mask_image = cpl_image_new_from_mask(cpl_image_get_bpm(power_spectrum));
456 if(n_frame == 0) {
457 /* same mask for any input raw frame */
458 cpl_dfs_save_image(frames, NULL, parameters, frames, frm_raw,
459 out_mask_image, CPL_TYPE_INT, recipe_id, plist, NULL,
460 PACKAGE "/" PACKAGE_VERSION, out_filename_mask);
461 }
462
463 /* Add QC keywords we calculated earlier */
464 cpl_propertylist_append(plist,qclist);
465
466 /* power spectrum */
467 const char* bias_fpn_tag=xsh_get_tag_from_arm(XSH_BIAS_PD, instrument);
468 cpl_propertylist_update_string(plist, CPL_DFS_PRO_CATG, bias_fpn_tag);
469
470
471 if(n_frame == 0) {
472 cpl_dfs_save_image(frames, NULL, parameters, frames, frm_raw,
473 power_spectrum, CPL_TYPE_DOUBLE, recipe_id, plist, NULL,
474 PACKAGE "/" PACKAGE_VERSION, out_filename);
475 } else {
476 cpl_image_save(power_spectrum, out_filename, CPL_TYPE_DOUBLE, xlist, CPL_IO_EXTEND);
477 }
478
479 if(out_mask_image) cpl_image_delete(out_mask_image);
480 if(power_spectrum) cpl_image_delete(power_spectrum);
481 if (mask_in ) cpl_mask_delete(mask_in);
482
483 cpl_propertylist_delete(plist);
484 cpl_propertylist_delete(xlist);
485
486 }
487 cpl_propertylist_delete(qclist);
488 cpl_frameset_delete(fs_raws);
489 cpl_frameset_delete(fs_masks);
490 cpl_free(out_filename);
491 cpl_free(out_filename_mask);
492 return cpl_error_get_code();
493}
494
495/*---------------------------------------------------------------------------*/
503/*---------------------------------------------------------------------------*/
504static void xsh_mbias(cpl_parameterlist * parameters, cpl_frameset * frameset)
505{
506 const char* recipe_tags[1] = {XSH_BIAS};
507 int recipe_tags_size = 1;
508
509 cpl_frameset *raws = NULL;
510 cpl_frameset *calib = NULL;
511 cpl_frame *bpmap = NULL;
512 cpl_frame *master_bias = NULL;
513 cpl_frame *product = NULL;
515
516 cpl_frame* bias_frm=NULL;
517 cpl_propertylist* plist=NULL;
518 char name[256];
519 const char* ftag;
520
521 int pre_overscan_corr=0;
522 xsh_stack_param* stack_par=NULL;
523
524 /**************************************************************************/
525 /* DFS management */
526 /**************************************************************************/
527 check( xsh_begin( frameset, parameters, &instrument, &raws, &calib,
528 recipe_tags, recipe_tags_size,
529 RECIPE_ID, XSH_BINARY_VERSION,
531
532 /* check critical parameter values */
534 /**************************************************************************/
535 /* Recipe frames */
536 /**************************************************************************/
537 //AModigliani: why should be prevent to reduce < 3 frames if it works?
538 //XSH_ASSURE_NOT_ILLEGAL(cpl_frameset_get_size(raws) >= 3);
540
541 check(bias_frm=cpl_frameset_get_frame(raws,0));
542 check(plist=cpl_propertylist_load(cpl_frame_get_filename(bias_frm),0));
543 xsh_free_propertylist(&plist);
544
546 sprintf(name,"%s.fits",ftag);
547 xsh_msg("tag=%s",ftag);
548
549 /**************************************************************************/
550 /* Recipe parameters */
551 /**************************************************************************/
552 check( stack_par = xsh_stack_frames_get( RECIPE_ID, parameters));
553 /**************************************************************************/
554 /* Recipe code */
555 /**************************************************************************/
556 cpl_parameter* p;
557 p=xsh_parameters_find(parameters,RECIPE_ID,"pd_noise_compute");
558 int pd_noise_compute=cpl_parameter_get_bool(p);
559
560
561 /* prepare RAW frames in XSH format */
562 check(xsh_prepare(raws, bpmap, NULL, XSH_BIAS, instrument,pre_overscan_corr,CPL_TRUE));
563 /* compute fpn power spectrum */
564
565 if(pd_noise_compute) {
566 xsh_mbias_fpn(frameset, parameters, instrument,RECIPE_ID );
567 }
568 /* remove cosmic rays and merge the RAWS */
569
570 if(strcmp(stack_par->stack_method,"mean") == 0) {
571 check(master_bias = xsh_create_master_bias2(raws,stack_par,instrument,ftag,1));
572 } else {
573 check(master_bias = xsh_create_master_bias2(raws,stack_par,instrument,ftag,0));
574 }
575
576
577 /* create master bias */
578 check(product=xsh_compute_qc_on_master_bias(raws,master_bias,instrument,parameters));
579
580 /**************************************************************************/
581 /* Products */
582 /**************************************************************************/
583
584 xsh_msg("Save products");
585 //check( xsh_add_product_pre(product, frameset, parameters, RECIPE_ID,
586 // instrument));
587 check(xsh_add_product_image(product, frameset, parameters,RECIPE_ID, instrument,XSH_MASTER_BIAS));
588
589 xsh_msg("xsh_mbias success!!");
590
591 cleanup:
592 xsh_end( RECIPE_ID, frameset, parameters );
593
594 xsh_free_propertylist(&plist);
596 xsh_free_frame(&product);
597 xsh_free_frameset(&raws);
598 xsh_free_frameset(&calib);
599 xsh_free_frame(&master_bias);
600 xsh_free_frame(&bpmap);
601
602 cpl_free(stack_par);
603 return;
604}
605
cpl_frame * xsh_compute_qc_on_master_bias(cpl_frameset *raws, cpl_frame *frame, xsh_instrument *instr, cpl_parameterlist *params)
Computes QC on a master bias frame.
cpl_frame * xsh_create_master_bias2(cpl_frameset *rawFrames, xsh_stack_param *stack_par, xsh_instrument *instr, const char *result_tag, const int method_code)
Creates master bias.
static xsh_instrument * instrument
int binx
int biny
void xsh_prepare(cpl_frameset *frames, cpl_frame *bpmap, cpl_frame *mbias, const char *prefix, xsh_instrument *instr, const int pre_overscan_corr, const bool flag_neg_and_thresh_pix)
This function transform RAW frames dataset in PRE frames dataset attaching the default bad pixel map ...
Definition: xsh_prepare.c:122
#define assure(CONDITION, ERROR_CODE,...)
Definition: xsh_error.h:54
#define check(COMMAND)
Definition: xsh_error.h:71
#define xsh_error_dump(level)
Definition: xsh_error.h:92
#define xsh_error_reset()
Definition: xsh_error.h:87
const char * xsh_instrument_arm_tostring(xsh_instrument *i)
Get the string associated with an arm.
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
#define RECIPE_CONTACT
Definition: xsh_mbias.c:77
static char xsh_mbias_description[]
Definition: xsh_mbias.c:99
static cpl_error_code xsh_mbias_fpn(cpl_frameset *frames, const cpl_parameterlist *parameters, xsh_instrument *instrument, const char *recipe_id)
Definition: xsh_mbias.c:276
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
Definition: xsh_mbias.c:123
static char xsh_mbias_description_short[]
Definition: xsh_mbias.c:97
static void xsh_mbias(cpl_parameterlist *, cpl_frameset *)
Interpret the command line options and execute the data processing.
Definition: xsh_mbias.c:504
static int xsh_mbias_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
Definition: xsh_mbias.c:218
static int xsh_mbias_create(cpl_plugin *)
Setup the recipe options.
Definition: xsh_mbias.c:165
static int xsh_mbias_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
Definition: xsh_mbias.c:251
#define RECIPE_ID
Definition: xsh_mbias.c:75
#define RECIPE_AUTHOR
Definition: xsh_mbias.c:76
#define xsh_msg(...)
Print a message on info level.
Definition: xsh_msg.h:121
void xsh_free_parameterlist(cpl_parameterlist **p)
Deallocate a parameter list and set the pointer to NULL.
Definition: xsh_utils.c:2224
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
Definition: xsh_utils.c:2269
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
Definition: xsh_utils.c:2254
const char * xsh_get_license(void)
Get the pipeline copyright and license.
Definition: xsh_utils.c:1193
void xsh_init(void)
Reset library state.
Definition: xsh_utils.c:1160
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.
Definition: xsh_utils.c:1244
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
Definition: xsh_utils.c:2179
cpl_error_code xsh_end(const char *recipe_id, cpl_frameset *frames, cpl_parameterlist *parameters)
Recipe termination.
Definition: xsh_utils.c:1519
const char * stack_method
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)
Definition: xsh_dfs.c:2965
char * xsh_get_tag_from_arm(const char *tag, xsh_instrument *instr)
Find arm specific tag from base and instrument setting.
Definition: xsh_dfs.c:3374
#define XSH_GET_TAG_FROM_ARM_EXT(TAG, instr)
Definition: xsh_dfs.h:1553
#define XSH_MASTER_BIAS
Definition: xsh_dfs.h:549
#define XSH_BIAS_PD
Definition: xsh_dfs.h:648
#define XSH_BIAS
Definition: xsh_dfs.h:219
#define XSH_BIAS_PD_MASK
Definition: xsh_dfs.h:653
cpl_frame * xsh_check_load_master_bpmap(cpl_frameset *calib, xsh_instrument *inst, const char *rec_id)
Definition: xsh_drl_check.c:51
#define max(a, b)
cpl_parameter * xsh_parameters_find(cpl_parameterlist *list, const char *recipe_id, const char *name)
find a parameter
void xsh_parameters_ron_create(const char *recipe_id, cpl_parameterlist *list, xsh_ron_param p)
create the RON determination parameters in a parameters list
void xsh_parameters_stack_create(const char *recipe_id, cpl_parameterlist *list, xsh_stack_param sp)
create the RON determination parameters in a parameters list
xsh_stack_param * xsh_stack_frames_get(const char *recipe_id, cpl_parameterlist *list)
get the detect arclines parameters in a parameters list
cpl_error_code xsh_parameters_decode_bp(const char *recipe_id, cpl_parameterlist *plist, const int ival)
void xsh_parameters_fpn_create(const char *recipe_id, cpl_parameterlist *list, xsh_fpn_param p)
create the FPN parameters in a parameters list
void xsh_parameters_pd_noise_create(const char *recipe_id, cpl_parameterlist *list, xsh_pd_noise_param p)
create the FPN parameters in a parameters list
void xsh_parameters_struct_create(const char *recipe_id, cpl_parameterlist *list, xsh_struct_param p)
create the structX/Y region definition parameters in a parameters list
void xsh_parameters_generic(const char *recipe_id, cpl_parameterlist *plist)
cpl_error_code xsh_recipe_params_check(cpl_parameterlist *parameters, xsh_instrument *instrument, const char *rec_id)
#define DECODE_BP_FLAG_DEF