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_sky_description[] =
54"This recipe reduces either:\n"
55" a set of sky image frames taken at 2 different airmasses to produce\n"
56" "ERIS_NIX_MASTER_FLAT_SKY_HIFREQ_PRO_CATG
", "
57ERIS_NIX_MASTER_FLAT_SKY_LOFREQ_PRO_CATG
", and\n"
58" "ERIS_NIX_MASTER_BPM_SKY_PRO_CATG
" results,\n"
60" a set of sky LSS frames taken at 2 different airmasses to produce\n"
61" "ERIS_NIX_MASTER_FLAT_LSS_HIFREQ_PRO_CATG
" and "
62ERIS_NIX_MASTER_BPM_LSS_PRO_CATG
" results.\n"
65" The recipe works with a set of sky frames, equal numbers taken at \n"
66" two different airmasses:\n"
68" DO CATG Explanation Req. #Frames\n"
69" ------- ----------- --- -------\n"
70" "ERIS_NIX_RAW_FLAT_SKY_DO_CATG
71 " sky frames Y >2*min-coadds\n"
73" "ERIS_NIX_RAW_FLAT_SKY_LSS_DO_CATG
74 " sky LSS frames Y >2*min-coadds\n"
75" "ERIS_NIX_MASTER_DARK_IMG_PRO_CATG
76 " a MASTER_DARK with Y 1\n"
77" matching detector \n"
79" "ERIS_NIX_GAIN_PRO_CATG
80 " DETMON gain N 0 or 1\n"
81" information e.g. in\n"
83" detmon_ir_lg_gain_table.fits\n"
84" "ERIS_NIX_COEFFS_CUBE_PRO_CATG
85 " DETMON linearity N 0 or 1\n"
86" curves e.g. in file \n"
87" detmon_ir_coeffs_cube.fits\n"
88" "ERIS_NIX_NL_BPM_PRO_CATG
89 " DETMON non-linear N 0 or 1\n"
91" detmon_ir_lg_bpm.fits\n"
95" DO CATG Explanation \n"
96" ------- ----------- \n"
97" "ERIS_NIX_MASTER_FLAT_SKY_HIFREQ_PRO_CATG
98 " The required sky HIFREQ flatfield.\n"
99" "ERIS_NIX_MASTER_FLAT_SKY_LOFREQ_PRO_CATG
100 " For imaging data only, the\n"
101" required sky LOFREQ flatfield.\n"
103" "ERIS_NIX_MASTER_BPM_SKY_PRO_CATG
104 " The required sky master BPM.\n"
106" The HIFREQ output will be a FITS file named \n"
107" 'master_flat_hifreq.fits', with extensions:\n"
108" - DATA, with the flatfield data.\n"
109" - ERR, with the flatfield error plane.\n"
110" - DQ, with the flatfield data quality plane.\n"
111" - COLD_BPM, with a bpm for the 'cold' pixels.\n"
112" - CONFIDENCE, with the flatfield confidence plane.\n"
114" The LOFREQ output will be a FITS file named \n"
115" 'master_flat_lofreq.fits', with extensions:\n"
116" - DATA, with the flatfield data.\n"
117" - ERR, with the flatfield error plane.\n"
118" - DQ, with the flatfield data quality plane.\n"
119" - CONFIDENCE, with the flatfield confidence plane.\n"
121" The master BPM output will be a FITS file named \n"
122" 'master_bpm.fits'. Common pixel values are:\n"
123" - 512, 'hot' pixel.\n"
124" - 1024, 'cold' pixel.\n"
125" - 32768, 'non-linear' pixel.\n"
128#define RECIPE_NAME "eris.eris_nix_flat_sky"
129#define CONTEXT "eris."RECIPE_NAME
134cpl_recipe_define(eris_nix_flat_sky, ERIS_BINARY_VERSION,
"John Lightfoot",
135 PACKAGE_BUGREPORT,
"2017",
136 "Calculate a MASTER_FLAT_SKY_HIFREQ/LOFREQ and "
137 "MASTER_SKY_BPM", eris_nix_flat_sky_description);
153static cpl_error_code eris_nix_flat_sky_fill_parameterlist(
154 cpl_parameterlist *self) {
156 if (cpl_error_get_code() != CPL_ERROR_NONE)
return cpl_error_get_code();
158 cpl_parameterlist * bpm_parlist = NULL;
159 cpl_parameterlist * collapse_parlist = NULL;
160 hdrl_parameter * filter_defaults = NULL;
161 hdrl_parameter * flat_defaults = NULL;
162 cpl_parameterlist * flat_parlist = NULL;
163 hdrl_parameter * legendre_defaults = NULL;
164 hdrl_parameter * minmax_defaults = NULL;
165 hdrl_parameter * sigclip_defaults = NULL;
168 hdrl_parameter * mode_def =
173 "collapse",
"MEDIAN", sigclip_defaults,
174 minmax_defaults, mode_def);
178 for (
const cpl_parameter * p =
179 cpl_parameterlist_get_first_const(collapse_parlist);
181 p = cpl_parameterlist_get_next_const(collapse_parlist)) {
183 const char * pname = cpl_parameter_get_name(p);
184 if (strstr(pname,
"minmax") == NULL) {
185 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
186 cpl_parameterlist_append(self, duplicate);
196 for (
const cpl_parameter * p =
197 cpl_parameterlist_get_first(flat_parlist);
199 p = cpl_parameterlist_get_next(flat_parlist)) {
200 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
201 cpl_parameterlist_append(self, duplicate);
207 CPL_FILTER_MEDIAN, CPL_BORDER_NOP, 21, 21);
209 20, 21, 11, 12, 2, 10);
211 "FILTER", filter_defaults, legendre_defaults);
213 for (
const cpl_parameter * p =
214 cpl_parameterlist_get_first_const(bpm_parlist);
216 p = cpl_parameterlist_get_next_const(bpm_parlist)) {
217 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
218 cpl_parameterlist_append(self, duplicate);
224 cpl_parameter * cp = NULL;
225 cp = cpl_parameter_new_value(RECIPE_NAME
".min_coadds", CPL_TYPE_INT,
226 "minimum acceptable number of (lamp_on - "
227 "lamp_off) images", RECIPE_NAME, 1);
228 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"min-coadds");
229 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
230 cpl_parameterlist_append(self, cp);
235 cp = cpl_parameter_new_value(RECIPE_NAME
".x_probe", CPL_TYPE_INT,
236 "x coord of diagnostic pixel",
238 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"x-probe");
239 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
240 cpl_parameterlist_append(self, cp);
242 cp = cpl_parameter_new_value(RECIPE_NAME
".y_probe", CPL_TYPE_INT,
243 "y coord of diagnostic pixel",
245 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"y-probe");
246 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
247 cpl_parameterlist_append(self, cp);
251 cp = cpl_parameter_new_value(CONTEXT
".threshold", CPL_TYPE_DOUBLE,
252 "positive saturation level (for QC)",
254 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"threshold");
255 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
256 cpl_parameterlist_append(self, cp);
258 cp = cpl_parameter_new_value(CONTEXT
".saturation_neg", CPL_TYPE_DOUBLE,
259 "negative saturation level (for QC)", CONTEXT, -4.5e7);
260 cpl_parameter_set_alias(cp, CPL_PARAMETER_MODE_CLI,
"saturation_neg");
261 cpl_parameter_disable(cp, CPL_PARAMETER_MODE_ENV);
262 cpl_parameterlist_append(self, cp);
266 cpl_parameterlist_delete(bpm_parlist);
267 cpl_parameterlist_delete(collapse_parlist);
270 cpl_parameterlist_delete(flat_parlist);
292static hdrl_value hdrl_get_airmass_young(hdrl_value hvaCosZt)
294 double aCosZt = hvaCosZt.data,
295 aCosZtErr = hvaCosZt.error;
297 hdrl_value airmass = {(1.002432 * aCosZt * aCosZt + 0.148386 * aCosZt + 0.0096467)
298 / (aCosZt * aCosZt * aCosZt + 0.149864 * aCosZt * aCosZt + 0.0102963 * aCosZt
300 aCosZtErr * fabs( ( (2. * 1.002432 * aCosZt + 0.148386) * (aCosZt * aCosZt * aCosZt + 0.149864 * aCosZt * aCosZt + 0.0102963 * aCosZt + 0.000303978)
301 - (3. * aCosZt * aCosZt + 2. * 0.149864 * aCosZt + 0.0102963) * (1.002432 * aCosZt * aCosZt + 0.148386 * aCosZt + 0.0096467)
302 ) / pow(aCosZt * aCosZt * aCosZt + 0.149864 * aCosZt * aCosZt + 0.0102963 * aCosZt + 0.000303978, 2) )};
323static cpl_error_code eris_nix_flat_sky_bin_by_airmass(
324 cpl_frameset * frameset,
325 const int min_coadds,
327 located_imagelist ** low_z_limlist,
328 located_imagelist ** high_z_limlist,
331 if (cpl_error_get_code() != CPL_ERROR_NONE)
return cpl_error_get_code();
333 cpl_ensure_code(frameset, CPL_ERROR_NULL_INPUT);
334 cpl_ensure_code(used, CPL_ERROR_NULL_INPUT);
336 cpl_vector * airmass = NULL;
337 cpl_vector * high_z_list = NULL;
338 cpl_vector * low_z_list = NULL;
339 located_imagelist * sky_limlist = NULL;
340 located_imagelist * sky_lss_limlist = NULL;
345 ERIS_NIX_RAW_FLAT_SKY_DO_CATG, used);
347 ERIS_NIX_RAW_FLAT_SKY_LSS_DO_CATG, used);
348 enu_check_error_code(
"Failed to read sky data from frameset");
350 cpl_msg_info(cpl_func,
"%d SKY frames read",
351 (
int) sky_limlist->size);
352 cpl_msg_info(cpl_func,
"%d SKY LSS frames read",
353 (
int) sky_lss_limlist->size);
357 enu_check(!((sky_limlist->size > 0) && (sky_lss_limlist->size > 0)),
358 CPL_ERROR_ILLEGAL_INPUT,
"cannot combine imaging and LSS data");
359 enu_check(!((sky_limlist->size == 0) && (sky_lss_limlist->size == 0)),
360 CPL_ERROR_ILLEGAL_INPUT,
"no sky flat data found");
363 if (sky_lss_limlist->size > 0) {
366 sky_limlist = sky_lss_limlist;
367 sky_lss_limlist = NULL;
373 airmass = cpl_vector_new(sky_limlist->size);
374 for (cpl_size i = 0; i < sky_limlist->size; i++) {
451 double zenith_dist = 90.0 - tel_alt;
452 hdrl_value hvaCosZt = {cos(zenith_dist), 0};
453 hdrl_value hva_airm = hdrl_get_airmass_young(hvaCosZt);
459 cpl_vector_set(airmass, i, air);
464 double max_z = cpl_vector_get_max(airmass);
465 double min_z = cpl_vector_get_min(airmass);
466 low_z_list = cpl_vector_new(sky_limlist->size);
467 cpl_vector_fill(low_z_list, -1.0);
469 high_z_list = cpl_vector_new(sky_limlist->size);
470 cpl_vector_fill(high_z_list, -1.0);
473 for (cpl_size i = 0; i < cpl_vector_get_size(airmass); i++) {
474 if (fabs(cpl_vector_get(airmass, i) - min_z) < 0.1) {
475 cpl_vector_set(low_z_list, ilow, i);
477 }
else if (fabs(cpl_vector_get(airmass, i) - max_z) < 0.1) {
478 cpl_vector_set(high_z_list, ihigh, i);
483 cpl_msg_info(cpl_func,
"Found %d frames at high airmass", (
int)ihigh);
484 cpl_msg_info(cpl_func,
"Found %d frames at low airmass", (
int)ilow);
488 enu_check(ilow >= min_coadds, CPL_ERROR_ILLEGAL_INPUT,
489 "SoF contains insufficient sky frames at lower airmass "
490 "%d < %d", (
int) ilow, min_coadds);
491 enu_check(ilow == ihigh, CPL_ERROR_ILLEGAL_INPUT,
492 "SoF contains unequal numbers of high / low airmass frames "
493 "%d != %d", (
int) ihigh, (
int) ilow);
498 for (cpl_size i = 0; i < ilow; i++) {
501 sky_limlist->limages[(
int)
502 cpl_vector_get(low_z_list, i)]), i);
506 for (cpl_size i = 0; i < ihigh; i++) {
509 sky_limlist->limages[(
int)
510 cpl_vector_get(high_z_list, i)]), i);
514 cpl_vector_delete(airmass);
515 cpl_vector_delete(high_z_list);
516 cpl_vector_delete(low_z_list);
520 if (cpl_error_get_code() != CPL_ERROR_NONE) {
522 *high_z_limlist = NULL;
524 *low_z_limlist = NULL;
527 return cpl_error_get_code();
544static hdrl_imagelist * eris_nix_reduce_sky(located_imagelist * high_z_limlist,
545 located_imagelist * low_z_limlist,
546 const master_dark * mdark,
547 const gain_linearity * gain_lin,
548 const cpl_size x_probe,
549 const cpl_size y_probe) {
552 hdrl_imagelist * result = NULL;
553 cpl_ensure(high_z_limlist, CPL_ERROR_NULL_INPUT, NULL);
554 cpl_ensure(low_z_limlist, CPL_ERROR_NULL_INPUT, NULL);
555 cpl_ensure(mdark, CPL_ERROR_NULL_INPUT, NULL);
557 enu_check(high_z_limlist->size == low_z_limlist->size,
558 CPL_ERROR_INCOMPATIBLE_INPUT,
559 "different number of high z and low z frames");
574 for (
int i = 0; i < high_z_limlist->size; i++) {
604 enu_check_error_code(
"error performing basic calibration of sky "
610 low_z_limlist->limages[i]->himage);
613 high_z_limlist->limages[i]->himage),
618 if (cpl_error_get_code() != CPL_ERROR_NONE) {
637static int eris_nix_flat_sky(cpl_frameset * frameset,
638 const cpl_parameterlist * parlist) {
639 cpl_mask * bpm_mask = NULL;
640 hdrl_parameter * bpm_params = NULL;
641 cpl_propertylist * bpm_plist = NULL;
642 cpl_mask * cold_bpm = NULL;
643 hdrl_parameter * collapse_params = NULL;
644 cpl_image * confidence_hi = NULL;
645 cpl_image * confidence_lo = NULL;
646 hdrl_parameter * flat_params = NULL;
647 cpl_propertylist * flat_plist = NULL;
648 const gain_linearity * gain_lin = NULL;
649 located_imagelist * high_z_limlist = NULL;
650 located_imagelist * low_z_limlist = NULL;
651 master_bpm * mbad_pix_map = NULL;
652 master_dark * mdark = NULL;
653 hdrl_image * master_flat_hifreq = NULL;
654 hdrl_image * master_flat_lofreq = NULL;
655 const cpl_parameter * param = NULL;
656 hdrl_imagelist * sky_reduced_data = NULL;
657 cpl_frameset * used = NULL;
659 enu_check_error_code(
"%s():%d: An error is already set: %s",
660 cpl_func, __LINE__, cpl_error_get_where());
664 cpl_ensure_code(frameset, CPL_ERROR_NULL_INPUT);
665 cpl_ensure_code(parlist, CPL_ERROR_NULL_INPUT);
669 cpl_msg_set_level_from_env();
670 cpl_msg_severity severity = cpl_msg_get_level();
671 cpl_msg_info(cpl_func,
"level %d", (
int) severity);
675 const char* required_tags[5] = {
676 ERIS_NIX_RAW_FLAT_SKY_DO_CATG,
677 ERIS_NIX_NL_BPM_PRO_CATG,
678 ERIS_NIX_COEFFS_CUBE_PRO_CATG,
679 ERIS_NIX_GAIN_PRO_CATG,
680 ERIS_NIX_MASTER_DARK_IMG_PRO_CATG
682 cpl_ensure_code(CPL_ERROR_NONE ==
683 eris_dfs_check_input_tags(frameset, required_tags, ntags, 1),
684 CPL_ERROR_ILLEGAL_INPUT);
688 RECIPE_NAME
".collapse");
702 RECIPE_NAME
".coldpix");
706 param = cpl_parameterlist_find_const(parlist, RECIPE_NAME
".min_coadds");
707 int min_coadds = cpl_parameter_get_int(param);
711 param = cpl_parameterlist_find_const(parlist, RECIPE_NAME
".x_probe");
712 cpl_size x_probe = (cpl_size) cpl_parameter_get_int(param);
713 param = cpl_parameterlist_find_const(parlist, RECIPE_NAME
".y_probe");
714 cpl_size y_probe = (cpl_size) cpl_parameter_get_int(param);
716 enu_check_error_code(
"Could not retrieve input parameters");
721 enu_check_error_code(
"Could not identify RAW and CALIB frames");
723 used = cpl_frameset_new();
727 int required = CPL_FALSE;
728 gain_lin = engl_gain_linearity_load_from_frameset(frameset,
729 ERIS_NIX_GAIN_PRO_CATG, ERIS_NIX_COEFFS_CUBE_PRO_CATG,
730 ERIS_NIX_NL_BPM_PRO_CATG, required, used);
731 enu_check_error_code(
"failed to read gain/linearity information from SoF");
736 ERIS_NIX_MASTER_DARK_IMG_PRO_CATG, used);
737 enu_check_error_code(
"failed to read master dark from SoF");
742 eris_nix_flat_sky_bin_by_airmass(frameset,
751 sky_reduced_data = eris_nix_reduce_sky(high_z_limlist,
761 char * fname = cpl_sprintf(
"sky%d.fits", (
int)i);
763 fname, NULL, CPL_IO_CREATE);
773 HDRL_FLAT_FREQ_HIGH);
774 enu_check_error_code(
"error computing hi-freq flatfield");
780 CPL_TYPE_UNSPECIFIED, NULL, CPL_IO_CREATE);
782 CPL_TYPE_UNSPECIFIED, NULL, CPL_IO_CREATE);
785 enu_check_error_code(
"error computing cold-pixel bpm");
789 mbad_pix_map = en_master_bpm_create(
"eris_nix_flat_sky", cold_bpm,
791 en_master_bpm_set(mbad_pix_map, mdark->hot_bpm, BPM_HOT);
793 en_master_bpm_set(mbad_pix_map, gain_lin->bpm, BPM_NON_LINEAR);
801 flag_mask = ~flag_mask;
802 bpm_mask = en_master_bpm_get_mask(mbad_pix_map, flag_mask);
803 bpm_plist = cpl_propertylist_new();
804 int nbad = cpl_mask_count(bpm_mask);
805 cpl_propertylist_append_int(bpm_plist,
"ESO QC NUMBER BAD PIXELS", nbad);
806 cpl_size sx = cpl_mask_get_size_x(bpm_mask);
807 cpl_size sy = cpl_mask_get_size_y(bpm_mask);
808 double fraction = (double) nbad / (sx * sy);
809 cpl_propertylist_append_double(bpm_plist,
"ESO QC FRACTION BAD PIXELS",
fraction);
813 frameset, parlist, used, mbad_pix_map,
814 RECIPE_NAME, bpm_plist, PACKAGE
"/" PACKAGE_VERSION,
816 enu_check_error_code(
"Failed to save MASTER_BPM");
822 master_flat_hifreq));
823 cpl_image_fill_rejected(confidence_hi, 0.0);
824 cpl_image_accept_all(confidence_hi);
826 enu_check_error_code(
"error computing HIFREQ confidence map");
836 "master_flat_hifreq.fits",
838 enu_check_error_code(
"Failed to save HIFREQ flat");
850 cpl_mask_or(current_mask, bpm_mask);
863 master_flat_lofreq));
864 cpl_image_fill_rejected(confidence_lo, 0.0);
865 cpl_image_accept_all(confidence_lo);
867 enu_check_error_code(
"error computing LOFREQ confidence map");
870 const char* saturation_limit = cpl_propertylist_get_string(gain_lin->plist,
871 "ESO PRO REC1 PARAM25 VALUE");
872 double saturation = atof(saturation_limit);
875 ERIS_NIX_RAW_FLAT_SKY_DO_CATG, used);
879 parlist, CONTEXT, saturation, CPL_FALSE, CPL_FALSE);
889 "master_flat_lofreq.fits",
891 cpl_propertylist_delete(qclog);
894 enu_check_error_code(
"Failed to save LOFREQ flat");
899 cpl_mask_delete(bpm_mask);
900 cpl_propertylist_delete(bpm_plist);
902 cpl_mask_delete(cold_bpm);
904 cpl_image_delete(confidence_hi);
905 cpl_image_delete(confidence_lo);
907 cpl_propertylist_delete(flat_plist);
908 engl_gain_linearity_delete((gain_linearity *) gain_lin);
916 cpl_frameset_delete(used);
918 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.
located_image * enu_located_image_duplicate(const located_image *limage)
Make a deep copy of a located_image and its contents.
void enu_located_imagelist_delete(located_imagelist *limlist)
Delete a located_imagelist and its contents.
cpl_error_code enu_located_imagelist_insert(located_imagelist *limlist, located_image *limage, cpl_size position)
Insert a located_image at a specified point in a located_imagelist.
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.
double enu_get_tel_alt(const cpl_propertylist *plist)
Get telescope altitude of an observation.
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.
located_imagelist * enu_located_imagelist_new(cpl_size size)
Return a pointer to a new located_imagelist.
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.
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_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_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.