30#include <eris_utils.h>
39#include "eris_nix_defs.h"
40#include "eris_nix_utils.h"
41#include "eris_pfits.h"
42#include "eris_nix_dfs.h"
49static const char eris_nix_dark_description[] =
50"This recipe reduces a set of DARK frames to produce a MASTER_DARK image,\n"
51"a bad pixel mask of `hot' pixels, and a measurement of the read-out noise.\n"
55" DO CATG Explanation Req. #Frames\n"
56" ------- ----------- --- -------\n"
57" "ERIS_NIX_RAW_DARK_DO_CATG
58 " The raw DARK frames. Y 2-n\n"
59" "ERIS_NIX_GAIN_PRO_CATG
60 " Gain information in Y 1\n"
62" detmon_ir_lg_gain_table.fits\n"
68" DO CATG Explanation \n"
69" ------- ----------- \n"
70" "ERIS_NIX_MASTER_DARK_IMG_PRO_CATG
71 " Master DARK result.\n"
73" The output will be a FITS file named 'master_dark.fits',\n"
74" containing extensions:\n"
76" - ERR Error on the data\n"
78" - HOT_BPM hot pixels\n"
79" Relevant FITS keywords are:\n"
80" - QC.READ.NOISE the measured readout noise\n"
81" of the array [electrons].\n"
82" - QC.READ.NOISE.VAR the variance on the readout\n"
83" noise [electrons^2].\n"
84" - QC.DARK.MED the median value of DARK \n"
85" good pixels [ADU].\n"
86" - QC.DARK.MEAN the mean value of DARK good\n"
88" - QC.DARK.RMS the r.m.s. of the DARK \n"
89" good pixels [ADU].\n"
90" - QC.NUMBER.HOT.PIXEL the number of hot pixels\n"
92" - QC.PARTICLE.RATE the number of cosmic rays\n"
93" detected divided by the total\n"
100#define RECIPE_NAME "eris_nix_dark"
101#define CONTEXT "eris."RECIPE_NAME
102#define ERIS_NIX_DETECTOR_SIZE 2048
103#define ERIS_NIX_DETECTOR_SIZE_X 2048
104#define ERIS_NIX_DETECTOR_SIZE_Y 2048
105cpl_recipe_define(eris_nix_dark, ERIS_BINARY_VERSION,
"John Lightfoot",
106 PACKAGE_BUGREPORT,
"2017",
107 "Calculate MASTER_DARK and 'hot-pixel' BPM",
108 eris_nix_dark_description);
123static cpl_error_code eris_nix_dark_fill_parameterlist(cpl_parameterlist
126 cpl_parameterlist * bpm_parlist = NULL;
127 cpl_parameterlist * collapse_parlist = NULL;
128 hdrl_parameter * filter_defaults = NULL;
129 hdrl_parameter * legendre_defaults = NULL;
130 hdrl_parameter * minmax_defaults = NULL;
131 hdrl_parameter * sigclip_defaults = NULL;
133 if (cpl_error_get_code() != CPL_ERROR_NONE)
return cpl_error_get_code();
136 hdrl_parameter * mode_def =
141 "eris.eris_nix_dark",
"collapse",
"MEDIAN", sigclip_defaults,
142 minmax_defaults, mode_def);
146 for (
const cpl_parameter * p =
147 cpl_parameterlist_get_first_const(collapse_parlist);
149 p = cpl_parameterlist_get_next_const(collapse_parlist)) {
150 const char * pname = cpl_parameter_get_name(p);
151 if (strstr(pname,
"minmax") == NULL) {
152 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
153 cpl_parameterlist_append(self, duplicate);
161 CPL_FILTER_MEDIAN, CPL_BORDER_FILTER, 21, 21);
163 20, 21, 11, 12, 2, 10);
165 "hotpix",
"FILTER", filter_defaults, legendre_defaults);
169 for (
const cpl_parameter * p =
170 cpl_parameterlist_get_first(bpm_parlist);
171 p != NULL; p = cpl_parameterlist_get_next_const(bpm_parlist)) {
172 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
173 cpl_parameterlist_append(self, duplicate);
180 p = cpl_parameter_new_range(
"eris.eris_nix_dark.qc_fpn_xmin",
183 "eris.eris_nix_dark",
184 7,1,ERIS_NIX_DETECTOR_SIZE);
186 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"qc_fpn_xmin");
188 cpl_parameterlist_append(self, p);
191 p = cpl_parameter_new_range(
"eris.eris_nix_dark.qc_fpn_xmax",
194 "eris.eris_nix_dark",
195 2042,1,ERIS_NIX_DETECTOR_SIZE);
197 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"qc_fpn_xmax");
199 cpl_parameterlist_append(self, p);
201 p = cpl_parameter_new_range(
"eris.eris_nix_dark.qc_fpn_ymin",
204 "eris.eris_nix_dark",
205 7,1,ERIS_NIX_DETECTOR_SIZE);
207 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"qc_fpn_ymin");
209 cpl_parameterlist_append(self, p);
212 p = cpl_parameter_new_range(
"eris.eris_nix_dark.qc_fpn_ymax",
215 "eris.eris_nix_dark",
216 2042,1,ERIS_NIX_DETECTOR_SIZE);
218 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"qc_fpn_ymax");
220 cpl_parameterlist_append(self, p);
223 p = cpl_parameter_new_value(
"eris.eris_nix_dark.qc_fpn_hsize",
226 "eris.eris_nix_dark",
229 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"qc_fpn_hsize");
231 cpl_parameterlist_append(self, p);
234 p = cpl_parameter_new_value(
"eris.eris_nix_dark.qc_fpn_nsamp",
237 "eris.eris_nix_dark",
240 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"qc_fpn_nsamp");
242 cpl_parameterlist_append(self, p);
251 cpl_parameterlist_delete(collapse_parlist);
255 cpl_parameterlist_delete(bpm_parlist);
257 return cpl_error_get_code();
269static int eris_nix_dark(cpl_frameset * frameset,
270 const cpl_parameterlist * parlist) {
272 cpl_propertylist * applist = NULL;
273 hdrl_parameter * bpm_params = NULL;
274 hdrl_image * mdark = NULL;
275 cpl_image * contribution = NULL;
276 hdrl_parameter * collapse_params = NULL;
277 cpl_frameset * dark_frameset = NULL;
278 hdrl_image * diff = NULL;
279 const char * filename = NULL;
280 cpl_frameset_iterator * frame_iter = NULL;
281 cpl_propertylist * gain_propertylist = NULL;
282 cpl_mask * hot_bpm = NULL;
283 cpl_frame * inherit = NULL;
284 mef_extension_list * mefs = NULL;
285 const cpl_frame * rawframe = NULL;
286 hdrl_imagelist * dark_himlist = NULL;
287 cpl_propertylist * plist0 = NULL;
291 enu_check_error_code(
"%s():%d: An error is already set: %s",
292 cpl_func, __LINE__, cpl_error_get_where());
296 cpl_ensure_code(frameset, CPL_ERROR_NULL_INPUT);
297 cpl_ensure_code(parlist, CPL_ERROR_NULL_INPUT);
302 cpl_msg_set_level_from_env();
303 cpl_msg_severity severity = cpl_msg_get_level();
304 cpl_msg_info(cpl_func,
"level %d", (
int) severity);
308 const char* required_tags[2] = {ERIS_NIX_RAW_DARK_DO_CATG,
309 ERIS_NIX_GAIN_PRO_CATG,
312 cpl_ensure_code(CPL_ERROR_NONE ==
313 eris_dfs_check_input_tags(frameset, required_tags, ntags, 1),
314 CPL_ERROR_ILLEGAL_INPUT);
320 "eris.eris_nix_dark.collapse");
325 "eris.eris_nix_dark.hotpix");
327 enu_check(cpl_error_get_code() == CPL_ERROR_NONE, cpl_error_get_code(),
328 "Could not retrieve input parameters");
333 enu_check(cpl_error_get_code() == CPL_ERROR_NONE, cpl_error_get_code(),
334 "Could not identify RAW and CALIB frames");
338 rawframe = cpl_frameset_find_const(frameset, ERIS_NIX_RAW_DARK_DO_CATG);
339 enu_check(rawframe != NULL, CPL_ERROR_DATA_NOT_FOUND,
340 "SOF does not have any file tagged with %s",
341 ERIS_NIX_RAW_DARK_DO_CATG);
345 const cpl_frame * gainframe = cpl_frameset_find_const(frameset,
346 ERIS_NIX_GAIN_PRO_CATG);
347 enu_check(gainframe != NULL, CPL_ERROR_DATA_NOT_FOUND,
348 "SOF does not have any file tagged with %s",
349 ERIS_NIX_GAIN_PRO_CATG);
353 dark_frameset = cpl_frameset_new();
354 frame_iter = cpl_frameset_iterator_new(frameset);
356 while (cpl_frameset_iterator_get(frame_iter) != NULL) {
357 cpl_frame * frame = cpl_frameset_iterator_get(frame_iter);
358 const char * tag = cpl_frame_get_tag(frame);
359 filename = cpl_frame_get_filename(frame);
360 cpl_msg_debug(cpl_func,
"filename %s tag %s", filename, tag);
361 if (!strcmp(tag, ERIS_NIX_RAW_DARK_DO_CATG)) {
362 cpl_frameset_insert(dark_frameset, cpl_frame_duplicate(frame));
364 cpl_frameset_iterator_advance(frame_iter, 1);
369 const int ndarks = cpl_frameset_get_size(dark_frameset);
370 cpl_msg_info(cpl_func,
"Number of DARK frames: %d", ndarks);
375 for (
int idark=0; idark < ndarks; idark++) {
379 const cpl_frame * frame = cpl_frameset_get_position_const(
380 dark_frameset, idark);
381 filename = cpl_frame_get_filename(frame);
384 plist0 = cpl_propertylist_load(filename, 0);
385 inherit = cpl_frame_duplicate(frame);
387 cpl_propertylist * plist = cpl_propertylist_load(filename, 0);
391 "^ESO DET SEQ1 DIT$|"
392 "^ESO DET READ CURNAME$|"
394 "^ESO DET NCORRS NAME$");
395 cpl_propertylist_delete(plist);
397 enu_check(cpl_error_get_code()==CPL_ERROR_NONE, cpl_error_get_code(),
398 "error checking frame conformance");
399 cpl_image * image = cpl_image_load(filename, HDRL_TYPE_DATA,
404 cpl_image_delete(image);
406 enu_check(cpl_error_get_code() == CPL_ERROR_NONE, cpl_error_get_code(),
407 "Could not construct DARK imagelist");
409 cpl_msg_debug(cpl_func,
"Size of hdrl imagelist: %d", isize);
410 enu_check(isize > 1, CPL_ERROR_ILLEGAL_INPUT,
"need at least 2 DARKs");
412 const char * instrume = cpl_propertylist_get_string(plist0,
"INSTRUME");
413 if (!strcmp(instrume,
"ERIS")) {
414 cpl_msg_info(cpl_func,
"removing read_offsets");
426 const char * gainfile = cpl_frame_get_filename(gainframe);
427 gain_propertylist = cpl_propertylist_load(gainfile, 0);
428 double gain = cpl_propertylist_get_double(gain_propertylist,
430 enu_check_error_code(
"Error reading QC.GAIN from %s", gainfile);
431 cpl_msg_info(cpl_func,
"detector gain %5.2f", gain);
440 double read_noise = -1.0;
441 double read_noise_std = -1.0;
443 -1, -1, &read_noise, &read_noise_std);
444 read_noise /= sqrt(2.0);
445 read_noise_std /= sqrt(2.0);
446 enu_check_error_code(
"Failed to calculate read-out noise");
450 double read_noise_adu = read_noise;
451 double read_noise_std_adu = read_noise_std;
453 read_noise_std *= gain;
454 cpl_msg_info(cpl_func,
"read-out noise = %5.2e +- %5.2e", read_noise,
460 enu_check_error_code(
"Failed to read required detector mode");
465 double variance = 0.0;
466 if (!strcmp(det_mode,
"Double_RdRstRd")) {
474 const double ndit = (double) cpl_propertylist_get_int(plist0,
478 variance = 2.0 * read_noise * read_noise /
479 (gain * gain * nr * ndit * dit * dit);
481 cpl_msg_info(cpl_func,
482 "variance=%6.2e read-noise=%6.2f gain=%6.2f ndit=%d "
484 variance, read_noise, gain, (
int) ndit, dit);
486 }
else if (!strcmp(det_mode,
"SLOW_GR_UTR")) {
492 const double ndit = (double) cpl_propertylist_get_int(plist0,
494 const int nr = cpl_propertylist_get_int(plist0,
"ESO DET NDSAMPLES");
496 variance = 12.0 * read_noise * read_noise * (nr - 1.0) /
497 (gain * gain * nr * ndit * dit * dit * (nr + 1.0));
498 cpl_msg_info(cpl_func,
499 "variance=%6.2e read-noise=%6.2f gain=%6.2f ndit=%d "
501 variance, read_noise, gain, (
int) ndit, dit);
503 }
else if (!strcmp(det_mode,
"FAST_UNCORR")) {
512 cpl_imagelist * mad_working = cpl_imagelist_new();
515 cpl_imagelist_set(mad_working,
523 cpl_image * dark_med =
524 cpl_imagelist_collapse_median_create(mad_working);
525 cpl_msg_info(cpl_func,
"%e", cpl_image_get_median(dark_med));
530 cpl_image * diff2 = cpl_image_subtract_create(dark_med,
533 cpl_image_abs(diff2);
534 cpl_msg_info(cpl_func,
"%d %e", (
int)i,
535 cpl_image_get_median(diff2));
536 cpl_imagelist_set(mad_working, diff2, i);
538 cpl_image_delete(dark_med);
541 cpl_image * mad = cpl_imagelist_collapse_median_create(mad_working);
542 double median_mad = cpl_image_get_median(mad);
543 cpl_image_delete(mad);
544 cpl_msg_info(cpl_func,
"median mad %e", median_mad);
545 variance = pow(1.4826 * median_mad, 2);
547 cpl_msg_info(cpl_func,
"variance=%6.2e", variance);
549 cpl_imagelist_delete(mad_working);
552 cpl_error_set_message(cpl_func, CPL_ERROR_UNSUPPORTED_MODE,
553 "unsupported detector mode: %s", det_mode);
555 enu_check_error_code(
"failed to calculate master_dark error plane");
557 for (
int idark = 0; idark < isize; idark++) {
559 dark_himlist, idark));
560 cpl_size nx = cpl_image_get_size_x(error);
561 cpl_size ny = cpl_image_get_size_y(error);
562 cpl_image_fill_window(error, 1, 1, nx, ny, sqrt(variance));
569 enu_check_error_code(
"Failed to collapse imagelist");
576 cpl_msg_info(cpl_func,
"kappa-high %6.2e", kappa_high);
577 enu_check_error_code(
"failed to calculate hot-pixel BPM");
584 cpl_mask_or(old_mask, hot_bpm);
587 cpl_mask_delete(old_mask);
599 cpl_msg_warning(cpl_func,
"TBD: calculate CR rate");
603 applist = cpl_propertylist_new();
607 cpl_propertylist_append_string(applist, CPL_DFS_PRO_CATG,
608 ERIS_NIX_MASTER_DARK_IMG_PRO_CATG);
609 cpl_propertylist_update_string(applist,
"PRODCATG",
"ANCILLARY.IMAGE");
613 cpl_propertylist_copy_property_regexp(applist, plist0,
615 "^ESO DET SEQ1 DIT$|"
616 "^ESO DET READ CURNAME$|"
617 "^ESO DET NCORRS NAME$", 0);
621 cpl_propertylist_append_double(applist,
"ESO QC READ NOISE", read_noise);
622 cpl_propertylist_set_comment(applist,
"ESO QC READ NOISE",
623 "[e-] Read Out Noise");
624 cpl_propertylist_append_double(applist,
"ESO QC READ NOISE VAR",
625 pow(read_noise_std, 2.0));
626 cpl_propertylist_set_comment(applist,
"ESO QC READ NOISE VAR",
627 "[e-] Read Out Noise Variance");
629 cpl_propertylist_append_double(applist,
"ESO QC READ NOISE ADU", read_noise_adu);
630 cpl_propertylist_set_comment(applist,
"ESO QC READ NOISE ADU",
631 "[ADU] Read Out Noise");
632 cpl_propertylist_append_double(applist,
"ESO QC READ NOISE VAR ADU",
633 pow(read_noise_std_adu, 2.0));
634 cpl_propertylist_set_comment(applist,
"ESO QC READ NOISE VAR ADU",
635 "[ADU] Read Out Noise Variance");
639 cpl_propertylist_append_double(applist,
"ESO QC DARK MED",
640 (
double) dark_median.data);
641 cpl_propertylist_set_comment(applist,
"ESO QC DARK MED",
642 "[ADU] Median Master Dark");
644 cpl_propertylist_append_double(applist,
"ESO QC DARK MEAN",
645 (
double) dark_mean.data);
646 cpl_propertylist_set_comment(applist,
"ESO QC DARK MEAN",
647 "[ADU] Mean Master Dark");
649 cpl_propertylist_append_double(applist,
"ESO QC DARK RMS", dark_rms);
650 cpl_propertylist_set_comment(applist,
"ESO QC DARK RMS",
651 "[ADU] RMS Master Dark");
652 cpl_size nhot = cpl_mask_count(hot_bpm);
653 cpl_size sx = cpl_mask_get_size_x(hot_bpm);
654 cpl_size sy = cpl_mask_get_size_y(hot_bpm);
655 double fraction = (double) nhot / (sx * sy);
656 cpl_propertylist_append_int(applist,
"ESO QC NUMBER HOT PIXEL", (
int)nhot);
657 cpl_propertylist_set_comment(applist,
"ESO QC NUMBER HOT PIXEL",
658 "Number of hot pixels");
659 cpl_propertylist_append_double(applist,
"ESO QC HOT PIXEL FRACTION",
fraction);
660 cpl_propertylist_set_comment(applist,
"ESO QC HOT PIXEL FRACTION",
661 "Fraction of hot pixels to total");
662 double particle_rate = -1.0;
663 cpl_propertylist_append_double(applist,
"ESO QC PARTICLE_RATE",
668 cpl_propertylist_append_double(applist,
"ESO QC GAIN", gain);
669 cpl_propertylist_set_comment(applist,
"ESO QC GAIN",
670 "[e-/ADU] Detector Gain");
674 double qc_fpn_val = 0, qc_fpn_err = 0;
675 cpl_size zone_def[4];
676 cpl_size hsize, nsamp;
678 zone_def[0] = cpl_parameter_get_int(cpl_parameterlist_find_const(parlist,
679 "eris.eris_nix_dark.qc_fpn_xmin"));
681 zone_def[1] = cpl_parameter_get_int(cpl_parameterlist_find_const(parlist,
682 "eris.eris_nix_dark.qc_fpn_xmax"));
683 zone_def[2] = cpl_parameter_get_int(cpl_parameterlist_find_const(parlist,
684 "eris.eris_nix_dark.qc_fpn_ymin"));
685 zone_def[3] = cpl_parameter_get_int(cpl_parameterlist_find_const(parlist,
686 "eris.eris_nix_dark.qc_fpn_ymax"));
687 hsize = cpl_parameter_get_int(cpl_parameterlist_find_const(parlist,
688 "eris.eris_nix_dark.qc_fpn_hsize"));
689 nsamp = cpl_parameter_get_int(cpl_parameterlist_find_const(parlist,
690 "eris.eris_nix_dark.qc_fpn_nsamp"));
699 cpl_size nx_chip = 0;
700 cpl_size ny_chip = 0;
701 cpl_boolean windowed = 0;
717 zone_def[1] = (zone_def[1] > nx) ? nx: zone_def[1];
718 zone_def[3] = (zone_def[3] > ny) ? ny: zone_def[3];
720 cpl_msg_info(cpl_func,
"Zone: [%lld,%lld,%lld,%lld]",
721 zone_def[0],zone_def[2],zone_def[1],zone_def[3]);
723 if(CPL_ERROR_NONE != cpl_flux_get_noise_window(master_dark_ima, zone_def, hsize,
724 nsamp, &qc_fpn_val, &qc_fpn_err)) {
727 cpl_msg_error(cpl_func,
"FPN computation failed, set dummy values");
733 cpl_propertylist_append_double(applist,
"ESO QC DARKFPN", qc_fpn_val);
734 cpl_propertylist_set_comment(applist,
"ESO QC DARKFPN",
735 "Fixed Pattern Noise of combined frames");
753 PACKAGE
"/" PACKAGE_VERSION,
755 enu_check_error_code(
"Failed to save MASTER_DARK");
758 cpl_frameset_delete(dark_frameset);
759 cpl_propertylist_delete(plist0);
762 if(contribution != NULL) cpl_image_delete(contribution);
765 cpl_propertylist_delete(applist);
767 cpl_frameset_iterator_delete(frame_iter);
768 cpl_propertylist_delete(gain_propertylist);
769 cpl_frame_delete(inherit);
772 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_himage(cpl_frameset *allframes, const cpl_parameterlist *parlist, const cpl_frameset *provenance, const cpl_boolean prov_raw, const hdrl_image *image, const hdrl_imagelist *imagelist, const mef_extension_list *mefs, const char *recipe, const cpl_frame *inherit_frame, const cpl_propertylist *applist, const cpl_propertylist *wcs_plist, const char *pipe_id, const char *filename)
Save an hdrl_image/imagelist as a DFS-compliant MEF pipeline product.
mef_extension * enu_mef_new_mask(const char *name, const cpl_mask *data, const cpl_propertylist *plist)
Create a mef_extension struct holding a cpl_mask.
int enu_check_conformance(const cpl_propertylist *plist1, const cpl_propertylist *plist2, const char *regexp)
Check that the specified subset of two propertylists match.
cpl_error_code enu_get_window_info(cpl_size *nx, cpl_size *ny, int *rot, cpl_size *strx, cpl_size *stry, cpl_size *nx_chip, cpl_size *ny_chip, cpl_boolean *windowed, const cpl_propertylist *plist)
Get the detector 'window' information.
mef_extension_list * enu_mef_extension_list_new(cpl_size size)
Construct a new mef_extension_list.
cpl_error_code enu_remove_read_offsets(hdrl_image *himage, const cpl_propertylist *plist, cpl_image *confidence, const int set_confidence)
Function to remove read offsets from an himage and set blank pixels
void enu_mef_extension_list_delete(mef_extension_list *list)
Delete a mef_extension_list and its contents.
const char * enu_get_det_mode(const cpl_propertylist *plist)
Get the detector mode of an integration.
double enu_get_dit(const cpl_propertylist *plist)
Get the DIT of an integration.
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.
double hdrl_bpm_2d_parameter_get_kappa_high(const hdrl_parameter *p)
Access the kappa_high in the BPM_2D parameter.
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
hdrl_value hdrl_image_get_median(const hdrl_image *self)
computes the median and associated error of an image.
hdrl_image * hdrl_image_sub_image_create(const hdrl_image *self, const hdrl_image *other)
Subtract two images.
double hdrl_image_get_stdev(const hdrl_image *self)
computes the standard deviation of the data of an image
cpl_image * hdrl_image_get_error(hdrl_image *himg)
get error as cpl image
hdrl_value hdrl_image_get_mean(const hdrl_image *self)
computes mean pixel value and associated error of an image.
hdrl_image * hdrl_image_create(const cpl_image *image, const cpl_image *error)
create a new hdrl_image from to existing images by copying them
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.
const hdrl_image * hdrl_imagelist_get_const(const hdrl_imagelist *himlist, cpl_size inum)
Get an image from a list of images.
cpl_size hdrl_imagelist_get_size(const hdrl_imagelist *himlist)
Get the number of images in the imagelist.
cpl_error_code hdrl_imagelist_collapse(const hdrl_imagelist *himlist, const hdrl_parameter *param, hdrl_image **out, cpl_image **contrib)
collapsing of image list
hdrl_imagelist * hdrl_imagelist_new(void)
Create an empty imagelist.
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.