37#include "eris_utils.h"
38#include "eris_nix_utils.h"
39#include "eris_pfits.h"
41#include "eris_nix_dfs.h"
42#include "eris_nix_master_bpm.h"
43#include "eris_nix_master_dark.h"
44#include "eris_nix_gain_linearity.h"
53static const char eris_nix_flat_lamp_description[] =
54"This recipe reduces a set of calibration lamp frames to produce \n"
55ERIS_NIX_MASTER_FLAT_LAMP_HIFREQ_PRO_CATG
", "
56ERIS_NIX_MASTER_FLAT_LAMP_LOFREQ_PRO_CATG
" and\n"
57ERIS_NIX_MASTER_BPM_LAMP_PRO_CATG
" results.\n"
60" The recipe works either with a set of lamp-on/lamp-off pairs:\n"
62" DO CATG Explanation Req. #Frames\n"
63" ------- ----------- --- -------\n"
64" "ERIS_NIX_RAW_FLAT_LAMP_ON_DO_CATG
65 " lamp-on frames Y >min-coadds\n"
66" "ERIS_NIX_RAW_FLAT_LAMP_OFF_DO_CATG
67 " lamp-off frames Y = #lamp-on\n"
68" "ERIS_NIX_MASTER_DARK_IMG_PRO_CATG
69 " a MASTER_DARK with Y 1\n"
70" matching detector \n"
72" "ERIS_NIX_GAIN_PRO_CATG
73 " DETMON gain N 0 or 1\n"
74" information e.g. in\n"
76" detmon_ir_lg_gain_table.fits\n"
77" "ERIS_NIX_COEFFS_CUBE_PRO_CATG
78 " DETMON linearity N 0 or 1\n"
79" curves e.g. in file \n"
80" detmon_ir_coeffs_cube.fits\n"
81" "ERIS_NIX_NL_BPM_PRO_CATG
82 " DETMON non-linear bpm N 0 or 1\n"
84" detmon_ir_lg_bpm.fits\n"
86" or with a series of lamp-on frames:\n"
88" "ERIS_NIX_RAW_FLAT_LAMP_ON_DO_CATG
89 " lamp-on frames Y >min-coadds\n"
90" "ERIS_NIX_MASTER_DARK_IMG_PRO_CATG
91 " a MASTER_DARK with Y 1\n"
92" matching detector \n"
94" "ERIS_NIX_GAIN_PRO_CATG
95 " DETMON gain info N 0 or 1\n"
97" detmon_ir_lg_gain_table.fits\n"
98" "ERIS_NIX_COEFFS_CUBE_PRO_CATG
99 " DETMON linearity N 0 or 1\n"
100" curves e.g. in file \n"
101" detmon_ir_coeffs_cube.fits\n"
102" "ERIS_NIX_NL_BPM_PRO_CATG
103 " DETMON non-linear bpm N 0 or 1\n"
105" detmon_ir_lg_bpm.fits\n"
109" DO CATG Explanation \n"
110" ------- ----------- \n"
111" "ERIS_NIX_MASTER_FLAT_LAMP_HIFREQ_PRO_CATG
112 " The required HIFREQ flatfield.\n"
113" "ERIS_NIX_MASTER_FLAT_LAMP_LOFREQ_PRO_CATG
114 " The required LOFREQ flatfield.\n"
116" "ERIS_NIX_MASTER_BPM_LAMP_PRO_CATG
117 " The required master BPM flatfield.\n"
119" The HIFREQ output will be a FITS file named \n"
120" 'master_flat_lamp_hifreq.fits', with extensions:\n"
121" - DATA, with the flatfield data.\n"
122" - ERR, with the flatfield error plane.\n"
123" - DQ, with the flatfield data quality plane.\n"
124" - COLD_BPM, with a bpm for the 'cold' pixels.\n"
125" - CONFIDENCE, with the flatfield confidence plane.\n"
127" The LOFREQ output will be a FITS file named \n"
128" 'master_flat_lamp_lofreq.fits', with extensions:\n"
129" - DATA, with the flatfield data.\n"
130" - ERR, with the flatfield error plane.\n"
131" - DQ, with the flatfield data quality plane.\n"
132" - CONFIDENCE, with the flatfield confidence plane.\n"
134" The master BPM output will be a FITS file named \n"
135" 'master_bpm_lamp.fits'. Common pixel values are:\n"
136" - 512, 'hot' pixel.\n"
137" - 1024, 'cold' pixel.\n"
138" - 32768, 'non-linear' pixel.\n"
141#define RECIPE_NAME "eris_nix_flat_lamp"
142#define CONTEXT "eris."RECIPE_NAME
147cpl_recipe_define(eris_nix_flat_lamp, ERIS_BINARY_VERSION,
"John Lightfoot",
148 PACKAGE_BUGREPORT,
"2017",
"Calculate a "
149 ERIS_NIX_MASTER_FLAT_LAMP_HIFREQ_PRO_CATG
", "
150 ERIS_NIX_MASTER_FLAT_LAMP_LOFREQ_PRO_CATG
" and "
151 ERIS_NIX_MASTER_BPM_LAMP_PRO_CATG,
152 eris_nix_flat_lamp_description);
168static cpl_error_code eris_nix_flat_lamp_fill_parameterlist(
169 cpl_parameterlist *self) {
171 if (cpl_error_get_code() != CPL_ERROR_NONE)
return cpl_error_get_code();
173 cpl_parameterlist * bpm_parlist = NULL;
174 cpl_parameterlist * collapse_parlist = NULL;
175 hdrl_parameter * filter_defaults = NULL;
176 hdrl_parameter * flat_defaults = NULL;
177 cpl_parameterlist * flat_parlist = NULL;
178 hdrl_parameter * legendre_defaults = NULL;
179 hdrl_parameter * minmax_defaults = NULL;
180 hdrl_parameter * sigclip_defaults = NULL;
183 hdrl_parameter * mode_def =
188 "collapse",
"MEDIAN", sigclip_defaults,
189 minmax_defaults,mode_def);
193 for (
const cpl_parameter * p =
194 cpl_parameterlist_get_first_const(collapse_parlist);
196 p = cpl_parameterlist_get_next_const(collapse_parlist)) {
198 const char * pname = cpl_parameter_get_name(p);
199 if (strstr(pname,
"minmax") == NULL) {
200 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
201 cpl_parameterlist_append(self, duplicate);
211 for (
const cpl_parameter * p =
212 cpl_parameterlist_get_first(flat_parlist);
214 p = cpl_parameterlist_get_next(flat_parlist)) {
215 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
216 cpl_parameterlist_append(self, duplicate);
222 CPL_FILTER_MEDIAN, CPL_BORDER_NOP, 21, 21);
224 20, 21, 11, 12, 2, 10);
226 "FILTER", filter_defaults, legendre_defaults);
228 for (
const cpl_parameter * p =
229 cpl_parameterlist_get_first_const(bpm_parlist);
231 p = cpl_parameterlist_get_next_const(bpm_parlist)) {
232 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
233 cpl_parameterlist_append(self, duplicate);
239 cpl_parameter * cp = NULL;
240 cp = cpl_parameter_new_value(CONTEXT
".min_coadds", CPL_TYPE_INT,
241 "minimum acceptable number of (lamp_on - "
242 "lamp_off) images", CONTEXT, 1);
243 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"min-coadds");
244 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
245 cpl_parameterlist_append(self, cp);
250 cp = cpl_parameter_new_value(CONTEXT
".x_probe", CPL_TYPE_INT,
251 "x coord of diagnostic pixel",
253 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"x-probe");
254 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
255 cpl_parameterlist_append(self, cp);
257 cp = cpl_parameter_new_value(CONTEXT
".y_probe", CPL_TYPE_INT,
258 "y coord of diagnostic pixel",
260 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"y-probe");
261 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
262 cpl_parameterlist_append(self, cp);
264 cp = cpl_parameter_new_value(CONTEXT
".saturation_pos", CPL_TYPE_DOUBLE,
265 "positive saturation level (for QC). If -1 uses the value "
266 "of the parameter saturation_limit from the input GAIN_INFO table."
267 "Else uses the value set by the user. Recommended values are:"
268 "15000 for slow readout mode; 46500 for fast readout mode.",
270 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"saturation_pos");
271 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
272 cpl_parameterlist_append(self, cp);
274 cp = cpl_parameter_new_value(CONTEXT
".saturation_neg", CPL_TYPE_DOUBLE,
275 "negative saturation level (for QC)", CONTEXT, -4.5e7);
276 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"saturation_neg");
277 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
278 cpl_parameterlist_append(self, cp);
283 cpl_parameterlist_delete(bpm_parlist);
284 cpl_parameterlist_delete(collapse_parlist);
287 cpl_parameterlist_delete(flat_parlist);
308static hdrl_imagelist * eris_nix_reduce_lamp_on(
309 located_imagelist * lamp_on_limlist,
310 const master_dark * master_drk,
311 const gain_linearity * gain_lin,
312 const cpl_size x_probe,
313 const cpl_size y_probe) {
315 cpl_ensure(lamp_on_limlist, CPL_ERROR_NULL_INPUT, NULL);
316 cpl_ensure(master_drk, CPL_ERROR_NULL_INPUT, NULL);
320 cpl_msg_info(cpl_func,
"basic calibration of lamp-on data");
322 for (
int i = 0; i < lamp_on_limlist->size; i++) {
337 enu_check_error_code(
"error performing basic calibration of lamp-on "
347 if (cpl_error_get_code() != CPL_ERROR_NONE) {
368static hdrl_imagelist * eris_nix_reduce_lamp_on_off(
369 located_imagelist * lamp_on_limlist,
370 located_imagelist * lamp_off_limlist,
371 const master_dark * master_drk,
372 const gain_linearity * gain_lin,
373 const cpl_size x_probe,
374 const cpl_size y_probe) {
376 cpl_ensure(lamp_on_limlist, CPL_ERROR_NULL_INPUT, NULL);
377 cpl_ensure(lamp_off_limlist, CPL_ERROR_NULL_INPUT, NULL);
378 cpl_ensure(master_drk, CPL_ERROR_NULL_INPUT, NULL);
382 const int debug = x_probe > 0 &&
384 lamp_on_limlist->limages[0]->himage) &&
387 lamp_on_limlist->limages[0]->himage);
390 cpl_msg_info(cpl_func,
".. ON (err) DQ OFF (err) DQ ON-OFF (err) DQ");
393 enu_check(lamp_on_limlist->size == lamp_off_limlist->size,
394 CPL_ERROR_INCOMPATIBLE_INPUT,
395 "different number of lamp-on and lamp-off frames");
397 for (
int i = 0; i < lamp_on_limlist->size; i++) {
427 enu_check_error_code(
"error performing basic calibration of lamp-on/off "
433 hdrl_value hon = {0.0, 0.0};
435 hdrl_value hoff = {0.0, 0.0};
437 hdrl_value hres = {0.0, 0.0};
441 x_probe, y_probe, &ron);
443 x_probe, y_probe, &roff);
447 lamp_off_limlist->limages[i]->himage);
449 himage), master_drk->hot_bpm);
457 himage, x_probe, y_probe, &rres);
458 cpl_msg_info(cpl_func,
".. %8.2f(%5.2f) %d %8.2f(%5.2f) %d "
460 hon.data, hon.error, ron,
461 hoff.data, hoff.error, roff,
462 hres.data, hres.error, rres);
467 if (cpl_error_get_code() != CPL_ERROR_NONE) {
513static int eris_nix_flat_lamp(cpl_frameset * frameset,
514 const cpl_parameterlist * parlist) {
515 cpl_mask * bpm_mask = NULL;
516 hdrl_parameter * bpm_params = NULL;
517 cpl_propertylist * bpm_plist = NULL;
518 cpl_mask * cold_bpm = NULL;
519 hdrl_parameter * collapse_params = NULL;
520 cpl_image * confidence_hi = NULL;
521 cpl_image * confidence_lo = NULL;
522 hdrl_parameter * flat_params = NULL;
523 cpl_propertylist * flat_plist = NULL;
524 const gain_linearity * gain_lin = NULL;
525 hdrl_image * illumination_flat = NULL;
526 located_imagelist * lamp_off_limlist = NULL;
527 located_imagelist * lamp_on_limlist = NULL;
528 hdrl_imagelist * lamp_reduced_data = NULL;
529 master_bpm * master_bad_pix_map = NULL;
530 master_dark * master_drk = NULL;
531 hdrl_image * master_flat_hifreq = NULL;
532 hdrl_image * master_flat_lofreq = NULL;
533 cpl_mask * old_mask = NULL;
534 const cpl_parameter * param = NULL;
535 cpl_mask * un_illum = NULL;
536 cpl_frameset * used_frameset = NULL;
538 enu_check_error_code(
"%s():%d: An error is already set: %s",
539 cpl_func, __LINE__, cpl_error_get_where());
543 cpl_ensure_code(frameset, CPL_ERROR_NULL_INPUT);
544 cpl_ensure_code(parlist, CPL_ERROR_NULL_INPUT);
548 cpl_msg_set_level_from_env();
549 cpl_msg_severity severity = cpl_msg_get_level();
550 cpl_msg_info(cpl_func,
"level %d", (
int) severity);
554 const char* required_tags[5] = {ERIS_NIX_RAW_FLAT_LAMP_ON_DO_CATG,
555 ERIS_NIX_NL_BPM_PRO_CATG,
556 ERIS_NIX_COEFFS_CUBE_PRO_CATG,
557 ERIS_NIX_GAIN_PRO_CATG,
558 ERIS_NIX_MASTER_DARK_IMG_PRO_CATG
560 const int nopt_tags = 1;
561 const char* optional_tags[1] = {ERIS_NIX_RAW_FLAT_LAMP_OFF_DO_CATG,
564 cpl_ensure_code(CPL_ERROR_NONE ==
565 eris_dfs_check_input_tags(frameset, required_tags, ntags, 1),
566 CPL_ERROR_ILLEGAL_INPUT);
568 eris_dfs_check_input_tags(frameset, optional_tags, nopt_tags, 0);
594 param = cpl_parameterlist_find_const(parlist, CONTEXT
".min_coadds");
595 int min_coadds = cpl_parameter_get_int(param);
599 param = cpl_parameterlist_find_const(parlist, CONTEXT
".x_probe");
600 cpl_size x_probe = (cpl_size) cpl_parameter_get_int(param);
601 param = cpl_parameterlist_find_const(parlist, CONTEXT
".y_probe");
602 cpl_size y_probe = (cpl_size) cpl_parameter_get_int(param);
604 enu_check_error_code(
"Could not retrieve input parameters");
609 enu_check_error_code(
"Could not identify RAW and CALIB frames");
611 used_frameset = cpl_frameset_new();
615 int required = CPL_FALSE;
616 gain_lin = engl_gain_linearity_load_from_frameset(frameset,
617 ERIS_NIX_GAIN_PRO_CATG, ERIS_NIX_COEFFS_CUBE_PRO_CATG,
618 ERIS_NIX_NL_BPM_PRO_CATG, required, used_frameset);
619 enu_check_error_code(
"failed to read gain/linearity information from SoF");
624 ERIS_NIX_MASTER_DARK_IMG_PRO_CATG, used_frameset);
625 enu_check_error_code(
"failed to read master dark from SoF");
630 ERIS_NIX_RAW_FLAT_LAMP_ON_DO_CATG, used_frameset);
632 ERIS_NIX_RAW_FLAT_LAMP_OFF_DO_CATG, used_frameset);
634 double saturation = 0;
637 param = cpl_parameterlist_find_const(parlist, CONTEXT
".saturation_pos");
640 saturation = cpl_parameter_get_double(param);
642 const char* sat_limit = cpl_propertylist_get_string(gain_lin->plist,
643 "ESO PRO REC1 PARAM25 VALUE");
644 saturation = atof(sat_limit);
648 parlist, CONTEXT, saturation,
649 CPL_TRUE, CPL_FALSE);
656 if (lamp_on_limlist->size > 0 && lamp_off_limlist->size > 0) {
657 lamp_reduced_data = eris_nix_reduce_lamp_on_off(lamp_on_limlist,
663 }
else if (lamp_on_limlist->size > 0 && lamp_off_limlist->size == 0) {
664 lamp_reduced_data = eris_nix_reduce_lamp_on(lamp_on_limlist,
670 enu_check_error_code(
"error doing basic calibration");
674 cpl_msg_info(cpl_func,
"measuring illumination...");
680 5, 5, HDRL_FLAT_FREQ_LOW);
690 enu_check_error_code(
"error computing un-illuminated bpm");
695 cpl_mask * data_mask = cpl_image_get_bpm(data);
696 cpl_binary * data_mask_data = cpl_mask_get_data(data_mask);
698 cpl_mask * error_mask = cpl_image_get_bpm(error);
699 cpl_binary * error_mask_data = cpl_mask_get_data(error_mask);
701 cpl_binary * illum_mask_data = cpl_mask_get_data(un_illum);
703 cpl_size nx = cpl_image_get_size_x(data);
704 cpl_size ny = cpl_image_get_size_y(data);
706 for (cpl_size p = 0; p < nx * ny; p++) {
707 if (illum_mask_data[p] == CPL_BINARY_1) {
708 data_mask_data[p] = CPL_BINARY_1;
709 error_mask_data[p] = CPL_BINARY_1;
723 HDRL_FLAT_FREQ_HIGH);
730 enu_check_error_code(
"error computing cold-pixel bpm");
734 master_bad_pix_map = en_master_bpm_create(
"eris_nix_flat_lamp", cold_bpm,
736 en_master_bpm_set(master_bad_pix_map, master_drk->hot_bpm, BPM_HOT);
737 en_master_bpm_set(master_bad_pix_map, un_illum, BPM_UNILLUMINATED);
739 en_master_bpm_set(master_bad_pix_map, gain_lin->bpm, BPM_NON_LINEAR);
747 flag_mask = ~flag_mask;
748 bpm_mask = en_master_bpm_get_mask(master_bad_pix_map, flag_mask);
749 bpm_plist = cpl_propertylist_new();
750 int nbad = cpl_mask_count(bpm_mask);
751 cpl_propertylist_append_int(bpm_plist,
"ESO QC NUMBER BAD PIXELS", nbad);
752 cpl_size sx = cpl_mask_get_size_x(bpm_mask);
753 cpl_size sy = cpl_mask_get_size_y(bpm_mask);
754 double fraction = (double) nbad / (sx * sy);
755 cpl_propertylist_append_double(bpm_plist,
"ESO QC FRACTION BAD PIXELS",
fraction);
759 frameset, parlist, used_frameset, master_bad_pix_map,
760 RECIPE_NAME, bpm_plist, PACKAGE
"/" PACKAGE_VERSION,
761 "master_bpm_lamp.fits");
762 enu_check_error_code(
"Failed to save MASTER_BPM");
770 master_flat_hifreq));
771 cpl_image_fill_rejected(confidence_hi, 0.0);
772 cpl_image_accept_all(confidence_hi);
774 enu_check_error_code(
"error computing HIFREQ confidence map");
784 "master_flat_lamp_hifreq.fits",
787 cpl_propertylist_delete(qclog);
788 enu_check_error_code(
"Failed to save HIFREQ flat");
797 cpl_mask_or(current_mask, bpm_mask);
812 master_flat_lofreq));
813 cpl_image_fill_rejected(confidence_lo, 0.0);
814 cpl_image_accept_all(confidence_lo);
816 enu_check_error_code(
"error computing LOFREQ confidence map");
824 "master_flat_lamp_lofreq.fits",
827 enu_check_error_code(
"Failed to save LOFREQ flat");
830 cpl_mask_delete(bpm_mask);
831 cpl_propertylist_delete(bpm_plist);
833 cpl_mask_delete(cold_bpm);
835 cpl_image_delete(confidence_hi);
836 cpl_image_delete(confidence_lo);
838 cpl_propertylist_delete(flat_plist);
839 engl_gain_linearity_delete((gain_linearity *) gain_lin);
848 cpl_mask_delete(old_mask);
849 cpl_mask_delete(un_illum);
850 cpl_frameset_delete(used_frameset);
852 return (
int)cpl_error_get_code();
cpl_error_code eris_nix_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
cpl_error_code enu_dfs_save_bpm(const char *procat, cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *usedframes, const master_bpm *mbad_pix_map, const char *recipe, const cpl_propertylist *applist, const char *pipe_id, const char *filename)
Save a master_bpm as a DFS-compliant pipeline product.
void en_master_bpm_delete(master_bpm *target)
Delete a 'master_bpm' struct.
master_dark * en_master_dark_load_from_frameset(const cpl_frameset *frameset, const char *tag, cpl_frameset *used)
Load a 'master_dark' struct from a frameset.
void en_master_dark_delete(master_dark *target)
Delete a 'master_dark' struct.
void enu_located_imagelist_delete(located_imagelist *limlist)
Delete a located_imagelist and its contents.
cpl_propertylist * enu_raw_flats_qc(located_imagelist *lamp_on_limlist, cpl_mask *bp_map_nl_mask, const cpl_parameterlist *parlist, const char *context, const double threshold_pos, const cpl_boolean verbose, const cpl_boolean rescale_by_dit)
Compute QC on input raw flats.
cpl_error_code enu_flat_save(const char *pro_catg, const hdrl_image *flat, const cpl_image *confidence, const cpl_mask *cold_bpm, cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *filename, const char *recipe_name, const cpl_propertylist *qclog)
Save a flatfield result.
hdrl_image * enu_calc_flat(hdrl_imagelist *himlist, const int min_coadds, const hdrl_parameter *collapse_params, const cpl_size filter_size_x, const cpl_size filter_size_y, const hdrl_flat_method method)
Calculate a flatfield result.
cpl_error_code enu_basic_calibrate(located_image *limage, const int read_offsets, const cpl_table *refine_wcs, const master_dark *mdark, const gain_linearity *gain_lin, const master_flat *flatfield_1, const master_flat *flatfield_2, const master_bpm *mbad_pix_map, const int flag_mask, const char *fill_rejected, const double fill_value, const cpl_size x_probe, const cpl_size y_probe)
Do basic calibration of located_image (single or cube)
located_imagelist * enu_limlist_load_from_frameset(cpl_frameset *frameset, const char *tag, cpl_frameset *used)
Load tagged data from a frameset into a located_imagelist.
cpl_error_code enu_normalise_confidence(cpl_image *confidence)
Normalise confidence array so that mean of good pixels is 100.
cpl_boolean eris_param_has_changed(const cpl_parameter *p)
verify if a parameter value has been changed (from command line or or rc file by a user)
cpl_mask * hdrl_bpm_2d_compute(const hdrl_image *img_in, const hdrl_parameter *params)
Detect bad pixels on a single image with an iterative process.
hdrl_parameter * hdrl_bpm_2d_parameter_parse_parlist(const cpl_parameterlist *parlist, const char *prefix)
Parse parameter list to create input parameters for the BPM_2D.
hdrl_parameter * hdrl_bpm_2d_parameter_create_filtersmooth(double kappa_low, double kappa_high, int maxiter, cpl_filter_mode filter, cpl_border_mode border, int smooth_x, int smooth_y)
Creates BPM_2D Parameters object for HDRL_BPM_2D_FILTERSMOOTH.
cpl_parameterlist * hdrl_bpm_2d_parameter_create_parlist(const char *base_context, const char *prefix, const char *method_def, const hdrl_parameter *filtersmooth_def, const hdrl_parameter *legendresmooth_def)
Create parameter list for the BPM_2D computation.
hdrl_parameter * hdrl_bpm_2d_parameter_create_legendresmooth(double kappa_low, double kappa_high, int maxiter, int steps_x, int steps_y, int filter_size_x, int filter_size_y, int order_x, int order_y)
Creates BPM_2D Parameters object for HDRL_BPM_2D_LEGENDRESMOOTH.
hdrl_parameter * hdrl_collapse_sigclip_parameter_create(double kappa_low, double kappa_high, int niter)
create a parameter object for sigclipped mean
hdrl_parameter * hdrl_collapse_mode_parameter_create(double histo_min, double histo_max, double bin_size, hdrl_mode_type mode_method, cpl_size error_niter)
create a parameter object for the mode
cpl_parameterlist * hdrl_collapse_parameter_create_parlist(const char *base_context, const char *prefix, const char *method_def, hdrl_parameter *sigclip_def, hdrl_parameter *minmax_def, hdrl_parameter *mode_def)
Create parameters for the collapse.
hdrl_parameter * hdrl_collapse_minmax_parameter_create(double nlow, double nhigh)
create a parameter object for min-max rejected mean
hdrl_parameter * hdrl_collapse_parameter_parse_parlist(const cpl_parameterlist *parlist, const char *prefix)
parse parameterlist for imagelist reduction method
cpl_size hdrl_flat_parameter_get_filter_size_x(const hdrl_parameter *p)
Access the filter_size_x in the FLAT parameter.
hdrl_parameter * hdrl_flat_parameter_create(cpl_size filter_size_x, cpl_size filter_size_y, hdrl_flat_method method)
Creates FLAT Parameters object.
cpl_size hdrl_flat_parameter_get_filter_size_y(const hdrl_parameter *p)
Access the filter_size_y in the FLAT parameter.
hdrl_parameter * hdrl_flat_parameter_parse_parlist(const cpl_parameterlist *parlist, const char *prefix)
Parse a parameterlist to create input parameters for the FLAT.
cpl_parameterlist * hdrl_flat_parameter_create_parlist(const char *base_context, const char *prefix, const hdrl_parameter *defaults)
Create a parameter list for the FLAT computation.
hdrl_value hdrl_image_get_pixel(const hdrl_image *self, cpl_size xpos, cpl_size ypos, int *pis_rejected)
get pixel values of hdrl_image
cpl_error_code hdrl_image_sub_image(hdrl_image *self, const hdrl_image *other)
Subtract two images, store the result in the first image.
hdrl_image * hdrl_image_duplicate(const hdrl_image *himg)
copy hdrl_image
cpl_mask * hdrl_image_get_mask(hdrl_image *himg)
get cpl bad pixel mask from image
cpl_image * hdrl_image_get_error(hdrl_image *himg)
get error as cpl image
cpl_size hdrl_image_get_size_y(const hdrl_image *self)
return size of Y dimension of image
cpl_size hdrl_image_get_size_x(const hdrl_image *self)
return size of X dimension of image
cpl_image * hdrl_image_get_image(hdrl_image *himg)
get data as cpl image
const cpl_image * hdrl_image_get_image_const(const hdrl_image *himg)
get data as cpl image
void hdrl_image_delete(hdrl_image *himg)
delete hdrl_image
cpl_error_code hdrl_imagelist_set(hdrl_imagelist *himlist, hdrl_image *himg, cpl_size pos)
Insert an image into an imagelist.
void hdrl_imagelist_delete(hdrl_imagelist *himlist)
Free all memory used by a hdrl_imagelist object including the images.
cpl_size hdrl_imagelist_get_size(const hdrl_imagelist *himlist)
Get the number of images in the imagelist.
hdrl_imagelist * hdrl_imagelist_new(void)
Create an empty imagelist.
hdrl_imagelist * hdrl_imagelist_duplicate(const hdrl_imagelist *himlist)
Duplicate an image list.
hdrl_image * hdrl_imagelist_get(const hdrl_imagelist *himlist, cpl_size inum)
Get an image from a list of images.
void hdrl_parameter_delete(hdrl_parameter *obj)
shallow delete of a parameter
double fraction(double x, double y, double r_out)
Fraction of pixel bounded.