36#include "eris_utils.h"
58 if(cpl_error_get_code() != CPL_ERROR_NONE) {
59 cpl_msg_info(cpl_func,
"Function %s has an error",func_id);
60 cpl_msg_info(cpl_func,
"%s",(
const char*) cpl_error_get_message());
61 cpl_msg_info(cpl_func,
"%s",(
const char*) cpl_error_get_where());
64 return cpl_error_get_code();
73int eris_print_rec_status(
const int val) {
74 if(cpl_error_get_code() != CPL_ERROR_NONE) {
75 cpl_msg_error(cpl_func,
"Recipe status at %d",val);
76 cpl_msg_error(cpl_func,
"%s",(
const char*) cpl_error_get_message());
77 cpl_msg_error(cpl_func,
"%s",(
const char*) cpl_error_get_where());
98cpl_error_code eris_setup_product_header(
const char* filename,
100 cpl_frame_type frame_type,
101 const char* recipe_name,
102 cpl_frameset* frameset,
103 const cpl_parameterlist* parlist,
104 cpl_propertylist *plist)
107 cpl_ensure_code(filename, CPL_ERROR_NULL_INPUT);
108 cpl_ensure_code(pro_catg, CPL_ERROR_NULL_INPUT);
109 cpl_ensure_code(recipe_name, CPL_ERROR_NULL_INPUT);
110 cpl_ensure_code(frameset, CPL_ERROR_NULL_INPUT);
111 cpl_ensure_code(parlist, CPL_ERROR_NULL_INPUT);
112 cpl_ensure_code(plist, CPL_ERROR_NULL_INPUT);
114 cpl_frame* frame = cpl_frame_new();
115 cpl_frame_set_filename(frame, filename);
116 cpl_frame_set_type(frame, frame_type);
117 cpl_frame_set_tag(frame, pro_catg);
118 cpl_frame_set_group(frame, CPL_FRAME_GROUP_PRODUCT);
119 cpl_frame_set_level(frame, CPL_FRAME_LEVEL_FINAL);
120 cpl_frameset_insert(frameset, frame);
121 cpl_dfs_setup_product_header(plist, frame, frameset, parlist,
122 recipe_name, PACKAGE
"/" PACKAGE_VERSION,
123 CPL_DFS_PRO_DID, NULL);
126 return cpl_error_get_code();
140 const char * eris_license = cpl_get_license(
"ERIS",
"2017");
145eris_image_get_threshpix(cpl_image* img,
double threshold,
146 cpl_boolean thresh_is_min)
148 double* data = cpl_image_get_data_double(img);
149 cpl_size sx = cpl_image_get_size_x(img);
150 cpl_size sy = cpl_image_get_size_y(img);
157 for(
long i = 0; i < npix; i++) {
158 if(data[i] > threshold) {
167 for(
long i = 0; i < npix; i++) {
168 if(data[i] <= threshold) {
179eris_image_flag_threshpix(cpl_image** img,
double threshold,
180 cpl_boolean thresh_is_min)
183 cpl_ensure_code(img != NULL, CPL_ERROR_NULL_INPUT);
185 double* data = cpl_image_get_data_double(*img);
186 cpl_size sx = cpl_image_get_size_x(*img);
187 cpl_size sy = cpl_image_get_size_y(*img);
188 cpl_mask* mask = cpl_image_get_bpm(*img);
189 cpl_binary* pbpm = cpl_mask_get_data(mask);
196 for(
long i = 0; i < npix; i++) {
197 if(data[i] > threshold) {
198 pbpm[i] = CPL_BINARY_1;
206 for(
long i = 0; i < npix; i++) {
207 if(data[i] <= threshold) {
208 pbpm[i] = CPL_BINARY_1;
215 return cpl_error_get_code();
230 cpl_ensure(input != NULL, CPL_ERROR_NULL_INPUT, NULL);
232 cpl_frame *cur_frame = NULL;
235 const char* tag = NULL;
236 cpl_frameset* out = cpl_frameset_new();
238 nfrm = cpl_frameset_get_size(input);
239 for (cpl_size i = 0; i < nfrm; i++) {
240 cur_frame=cpl_frameset_get_position(input,i);
241 tag = cpl_frame_get_tag(cur_frame);
243 if (strcmp(tag, rtag) == 0) {
244 cpl_frameset_insert (out, cpl_frame_duplicate(cur_frame));
262 cpl_frame *cur_frame = NULL;
266 nfrm = cpl_frameset_get_size(input);
267 for (cpl_size i = 0; i < nfrm; i++) {
268 cur_frame=cpl_frameset_get_position(input,i);
270 if (cpl_frame_get_group (cur_frame) == CPL_FRAME_GROUP_RAW) {
271 cpl_frameset_insert (raws, cpl_frame_duplicate(cur_frame));
275 return cpl_error_get_code();
289 cpl_frame *cur_frame = NULL;
293 nfrm = cpl_frameset_get_size(input);
294 for (cpl_size i = 0; i < nfrm; i++) {
295 cur_frame=cpl_frameset_get_position(input,i);
297 if (cpl_frame_get_group (cur_frame) == CPL_FRAME_GROUP_CALIB) {
298 cpl_frameset_insert (calibs, cpl_frame_duplicate(cur_frame));
302 return cpl_error_get_code();
307eris_dfs_check_input_tags(cpl_frameset * input,
const char** tags,
const int n,
310 cpl_ensure_code(input, CPL_ERROR_NULL_INPUT);
311 cpl_ensure_code(tags, CPL_ERROR_NULL_INPUT);
313 for(cpl_size i = 0; i < n; i++) {
314 found = cpl_frameset_count_tags(input, tags[i]);
317 cpl_msg_error(cpl_func,
"Missing required input FITS file with tag: %s", tags[i]);
318 return CPL_ERROR_ILLEGAL_INPUT;
319 }
else if (mode == 0) {
320 cpl_msg_info(cpl_func,
"Missing optional input FITS file with tag: %s", tags[i]);
321 return CPL_ERROR_NONE;
327 return cpl_error_get_code();
338eris_persistence_get_threshpix(cpl_image* img,
double threshold,
339 cpl_boolean thresh_is_min)
341 double* data = cpl_image_get_data_double(img);
342 cpl_size sx = cpl_image_get_size_x(img);
343 cpl_size sy = cpl_image_get_size_y(img);
350 for(
long i = 0; i < npix; i++) {
351 if(data[i] > threshold) {
358 for(
long i = 0; i < npix; i++) {
359 if(data[i] <= threshold) {
378eris_get_thresh_pix_qc_for_image(
const char* frame_name, cpl_frame* frm_mdark,
379 const double threshold,
const long long i, cpl_propertylist* applist)
382 cpl_ensure_code(frame_name, CPL_ERROR_NULL_INPUT);
383 cpl_ensure_code(frm_mdark, CPL_ERROR_NULL_INPUT);
384 cpl_ensure_code(applist, CPL_ERROR_NULL_INPUT);
386 cpl_msg_info(cpl_func,
"Image case");
388 long int nthreshold = 0;
389 int plane_nthresh_max = 0;
391 const char* fname = cpl_frame_get_filename(frm_mdark);
393 cpl_image* mdark = cpl_image_load(fname, CPL_TYPE_DOUBLE, 0, 1);
394 cpl_size sx = cpl_image_get_size_x(mdark);
395 cpl_size sy = cpl_image_get_size_y(mdark);
396 cpl_size npix = sx * sy;
398 cpl_image* img = cpl_image_load(frame_name, CPL_TYPE_DOUBLE, 0, 0 );
400 cpl_image_subtract(img, mdark);
402 nthreshold = eris_persistence_get_threshpix(img, threshold, CPL_TRUE);
404 cpl_msg_info(cpl_func,
"Frame %lld Threshold pixels: %ld", i, nthreshold);
406 cpl_image_delete(img);
407 cpl_image_delete(mdark);
411 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH",i);
412 cpl_propertylist_append_int(applist, keyname, nthreshold);
415 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH MAX",i);
416 cpl_propertylist_append_int(applist, keyname, nthreshold);
419 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH TOT",i);
420 cpl_propertylist_append_int(applist, keyname, nthreshold);
423 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 BPTHRESH FRAC",i);
424 cpl_propertylist_append_double(applist, keyname, (
double)nthreshold / npix);
427 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH AVG",i);
428 cpl_propertylist_append_int(applist, keyname, nthreshold);
431 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 SLICE NTHRESH MAX",i);
432 cpl_propertylist_append_int(applist, keyname, plane_nthresh_max);
436 return cpl_error_get_code();
452eris_get_sat_pix_qc_for_image(
const char* frame_name, cpl_frame* frm_mdark,
453 const double saturation,
const double saturation_negative,
454 const long long i, cpl_propertylist* applist)
457 cpl_ensure_code(frame_name, CPL_ERROR_NULL_INPUT);
458 cpl_ensure_code(frm_mdark, CPL_ERROR_NULL_INPUT);
459 cpl_ensure_code(applist, CPL_ERROR_NULL_INPUT);
461 cpl_msg_info(cpl_func,
"Image case");
463 long int nsat_neg = 0;
464 int plane_nsat_max = 0;
466 const char* fname = cpl_frame_get_filename(frm_mdark);
468 cpl_image* mdark = cpl_image_load(fname, CPL_TYPE_DOUBLE, 0, 1);
469 cpl_size sx = cpl_image_get_size_x(mdark);
470 cpl_size sy = cpl_image_get_size_y(mdark);
471 cpl_size npix = sx * sy;
473 cpl_image* img = cpl_image_load(frame_name, CPL_TYPE_DOUBLE, 0, 0 );
474 cpl_image_subtract(img, mdark);
476 nsat = eris_persistence_get_threshpix(img, saturation,
478 cpl_msg_info(cpl_func,
"Frame %lld saturation pixels above positive threshold: %ld", i, nsat_neg);
480 nsat_neg = eris_persistence_get_threshpix(img, saturation_negative, CPL_FALSE);
481 cpl_msg_info(cpl_func,
"Frame %lld Saturation pixels below negative threshold: %ld", i, nsat_neg);
484 cpl_image_delete(img);
485 cpl_image_delete(mdark);
489 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT",i);
490 cpl_propertylist_append_int(applist, keyname, nsat);
493 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT MAX",i);
494 cpl_propertylist_append_int(applist, keyname, nsat);
497 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT TOT",i);
498 cpl_propertylist_append_int(applist, keyname, nsat);
501 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 BPSAT FRAC",i);
502 cpl_propertylist_append_double(applist, keyname, (
double)nsat / npix);
505 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT AVG",i);
506 cpl_propertylist_append_int(applist, keyname, nsat);
509 keyname = cpl_sprintf(
"ESO QC FRM%lld SLICE NSAT MAX",i);
510 cpl_propertylist_append_int(applist, keyname, plane_nsat_max);
513 return cpl_error_get_code();
519eris_get_sat_qc_for_image(
const char* frame_name, cpl_frame* frm_mdark,
520 const double saturation,
const double saturation_negative,
521 const double threshold,
const long long i, cpl_propertylist* applist)
524 cpl_ensure_code(frame_name, CPL_ERROR_NULL_INPUT);
525 cpl_ensure_code(frm_mdark, CPL_ERROR_NULL_INPUT);
526 cpl_ensure_code(applist, CPL_ERROR_NULL_INPUT);
528 cpl_msg_info(cpl_func,
"Image case");
530 long int nsat_neg = 0;
531 long int nthreshold = 0;
532 int plane_nsat_max = 0;
533 int plane_nthresh_max = 0;
535 const char* fname = cpl_frame_get_filename(frm_mdark);
537 cpl_image* mdark = cpl_image_load(fname, CPL_TYPE_DOUBLE, 0, 1);
538 cpl_size sx = cpl_image_get_size_x(mdark);
539 cpl_size sy = cpl_image_get_size_y(mdark);
540 cpl_size npix = sx * sy;
544 cpl_image* img_persistence = cpl_image_load(frame_name, CPL_TYPE_DOUBLE, 0, 0 );
546 cpl_image_subtract(img_persistence, mdark);
547 cpl_image_save(img_persistence,
"image_persistence.fits",CPL_TYPE_DOUBLE,NULL,CPL_IO_DEFAULT);
549 nsat = eris_persistence_get_threshpix(img_persistence, saturation,
551 cpl_msg_info(cpl_func,
"Frame %lld saturation pixels above positive threshold: %ld", i, nsat_neg);
553 nthreshold = eris_persistence_get_threshpix(img_persistence, threshold,
556 cpl_msg_info(cpl_func,
"Frame %lld Threshold pixels: %ld", i, nthreshold);
557 nsat_neg = eris_persistence_get_threshpix(img_persistence,
558 saturation_negative, CPL_FALSE);
559 cpl_msg_info(cpl_func,
"Frame %lld Saturation pixels below negative threshold: %ld", i, nsat_neg);
562 cpl_image_delete(img_persistence);
563 cpl_image_delete(mdark);
567 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT",i);
568 cpl_propertylist_append_int(applist, keyname, nsat);
571 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT MAX",i);
572 cpl_propertylist_append_int(applist, keyname, nsat);
575 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT TOT",i);
576 cpl_propertylist_append_int(applist, keyname, nsat);
579 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 BPSAT FRAC",i);
580 cpl_propertylist_append_double(applist, keyname, (
double)nsat / npix);
583 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NSAT AVG",i);
584 cpl_propertylist_append_int(applist, keyname, nsat);
587 keyname = cpl_sprintf(
"ESO QC FRM%lld SLICE NSAT MAX",i);
588 cpl_propertylist_append_int(applist, keyname, plane_nsat_max);
593 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH",i);
594 cpl_propertylist_append_int(applist, keyname, nthreshold);
597 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH MAX",i);
598 cpl_propertylist_append_int(applist, keyname, nthreshold);
601 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH TOT",i);
602 cpl_propertylist_append_int(applist, keyname, nthreshold);
605 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 BPTHRESH FRAC",i);
606 cpl_propertylist_append_double(applist, keyname, (
double)nthreshold / npix);
609 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 NTHRESH AVG",i);
610 cpl_propertylist_append_int(applist, keyname, nthreshold);
613 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC0 SLICE NTHRESH MAX",i);
614 cpl_propertylist_append_int(applist, keyname, plane_nthresh_max);
618 return cpl_error_get_code();
622eris_get_sat_qc_for_cube(
const char* frame_name, cpl_frame* frm_mdark,
623 const double saturation,
const double saturation_negative,
624 const double threshold,
const long long i, cpl_propertylist* applist)
627 cpl_ensure_code(frame_name, CPL_ERROR_NULL_INPUT);
628 cpl_ensure_code(frm_mdark, CPL_ERROR_NULL_INPUT);
629 cpl_ensure_code(applist, CPL_ERROR_NULL_INPUT);
632 cpl_msg_info(cpl_func,
"Cube case");
633 const char* fname = cpl_frame_get_filename(frm_mdark);
635 cpl_image* mdark = cpl_image_load(fname, CPL_TYPE_DOUBLE, 0, 1);
636 cpl_size sx = cpl_image_get_size_x(mdark);
637 cpl_size sy = cpl_image_get_size_y(mdark);
638 cpl_size npix = sx * sy;
641 cpl_imagelist* iml_persistence = cpl_imagelist_load(frame_name, CPL_TYPE_DOUBLE, 0 );
642 cpl_size sz = cpl_imagelist_get_size(iml_persistence);
647 long nthreshold_max = 0;
649 int nthreshold_tot = 0;
651 double nthreshold_avg = 0;
653 int plane_nsat_max = 0;
654 int plane_nthresh_max = 0;
655 double bpsat_frac_tot = 0;
656 double bpthresh_frac_tot = 0;
658 for(cpl_size k = 0; k < sz; k++) {
659 cpl_imagelist_subtract_image(iml_persistence, mdark);
660 img = cpl_imagelist_get(iml_persistence, k);
661 nsat = eris_persistence_get_threshpix(img, saturation, CPL_TRUE);
662 nthreshold = eris_persistence_get_threshpix(img, threshold, CPL_TRUE);
663 nsat_neg = eris_persistence_get_threshpix(img,
664 saturation_negative, CPL_FALSE);
668 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC%lld NSAT", i, k);
669 cpl_propertylist_append_int(applist, keyname, nsat);
672 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC%lld BPSAT FRAC",i, k);
673 cpl_propertylist_append_double(applist, keyname, (
double)nsat / npix);
676 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC%lld NTHRESH",i, k);
677 cpl_propertylist_append_int(applist, keyname, nthreshold);
680 keyname = cpl_sprintf(
"ESO QC FRM%lld SLIC%lld BPTHRESH FRAC", i, k);
681 cpl_propertylist_append_double(applist, keyname, (
double)nthreshold / npix);
684 if(nsat > nsat_max) {
689 if(nthreshold > nthreshold_max) {
690 nthreshold_max = nthreshold;
691 plane_nthresh_max = k;
694 bpsat_frac_tot += (double)nsat / npix;
696 nthreshold_tot += nthreshold;
697 bpthresh_frac_tot += (double)nthreshold / npix;
701 cpl_imagelist_delete(iml_persistence);
702 cpl_image_delete(mdark);
704 nsat_avg = (double) nsat_tot / sz;
706 nthreshold_avg = (double) nthreshold_tot / sz;
708 keyname = cpl_sprintf(
"ESO QC FRM%lld NSAT MAX", i);
709 cpl_propertylist_append_int(applist, keyname, nsat_max);
712 keyname = cpl_sprintf(
"ESO QC FRM%lld NSAT TOT", i);
713 cpl_propertylist_append_int(applist, keyname, nsat_tot);
716 keyname = cpl_sprintf(
"ESO QC FRM%lld BPSAT FRAC", i);
717 cpl_propertylist_append_double(applist, keyname, bpsat_frac_tot / sz);
720 keyname = cpl_sprintf(
"ESO QC FRM%lld NSAT AVG", i);
721 cpl_propertylist_append_double(applist, keyname, nsat_avg);
724 keyname = cpl_sprintf(
"ESO QC FRM%lld SLICE NSAT MAX", i);
725 cpl_propertylist_append_int(applist, keyname, plane_nsat_max);
728 keyname = cpl_sprintf(
"ESO QC FRM%lld NTHRESH MAX", i);
729 cpl_propertylist_append_int(applist, keyname, nthreshold_max);
732 keyname = cpl_sprintf(
"ESO QC FRM%lld NTHRESH TOT", i);
733 cpl_propertylist_append_int(applist, keyname, nthreshold_tot);
736 keyname = cpl_sprintf(
"ESO QC FRM%lld BPTHRESH FRAC", i);
737 cpl_propertylist_append_double(applist, keyname, bpthresh_frac_tot / sz);
740 keyname = cpl_sprintf(
"ESO QC FRM%lld NTHRESH AVG", i);
741 cpl_propertylist_append_double(applist, keyname, nthreshold_avg);
744 keyname = cpl_sprintf(
"ESO QC FRM%lld SLICE NTHRESH MAX", i);
745 cpl_propertylist_append_int(applist, keyname, plane_nthresh_max);
748 return cpl_error_get_code();
766 const char* pname,
double *pvalue)
768 cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
769 const cpl_parameter* p = cpl_parameterlist_find_const(parlist, pname);
772 if ( cpl_parameter_get_default_flag(p) && p_has_changed != CPL_FALSE) {
773 *pvalue = cpl_parameter_get_double(p);
775 *pvalue = cpl_parameter_get_default_double(p);
778 return cpl_error_get_code();
783eris_parameters_get_int(
const cpl_parameterlist* parlist,
784 const char* pname,
int *pvalue)
786 cpl_ensure_code(parlist != NULL, CPL_ERROR_NULL_INPUT);
787 const cpl_parameter* p = cpl_parameterlist_find_const(parlist, pname);
790 if ( cpl_parameter_get_default_flag(p) && p_has_changed != CPL_FALSE) {
791 *pvalue = cpl_parameter_get_int(p);
793 *pvalue = cpl_parameter_get_default_int(p);
796 return cpl_error_get_code();
811 cpl_ensure_code(p != NULL,CPL_FALSE);
812 cpl_type type = cpl_parameter_get_type(p);
813 cpl_boolean has_changed = CPL_FALSE;
818 int val = cpl_parameter_get_int(p);
819 int def = cpl_parameter_get_default_int(p);
820 has_changed = (val != def) ? CPL_TRUE : CPL_FALSE;
824 case CPL_TYPE_FLOAT: {
825 float val = cpl_parameter_get_double(p);
826 float def = cpl_parameter_get_default_double(p);
827 has_changed = (val != def) ? CPL_TRUE : CPL_FALSE;
831 case CPL_TYPE_DOUBLE: {
832 double val = cpl_parameter_get_double(p);
833 double def = cpl_parameter_get_default_double(p);
834 has_changed = (val != def) ? CPL_TRUE : CPL_FALSE;
838 case CPL_TYPE_STRING:{
839 const char* val = cpl_parameter_get_string(p);
840 const char* def = cpl_parameter_get_default_string(p);
841 if ( strcmp(val,def) != 0 ) {
842 has_changed = CPL_TRUE;
848 cpl_msg_error(cpl_func,
"case not found! %d string type: %d",type,
869 const char *func =
"dfs_files_dont_exist";
870 cpl_ensure_code(frameset != NULL, CPL_ERROR_NULL_INPUT);
872 if (frameset == NULL ) {
873 cpl_error_set(func, CPL_ERROR_NULL_INPUT);
874 return CPL_ERROR_NULL_INPUT;
877 if (cpl_frameset_is_empty(frameset)) {
878 cpl_error_set(func, CPL_ERROR_FILE_NOT_FOUND);
879 return CPL_ERROR_FILE_NOT_FOUND;
882 cpl_frameset_iterator* it = cpl_frameset_iterator_new(frameset);
883 cpl_frame *frame = cpl_frameset_iterator_get(it);
884 const char* fname = NULL;
885 cpl_propertylist* plist = NULL;
887 fname = cpl_frame_get_filename(frame);
888 cpl_ensure_code(strcmp(fname,
"/dev/null"), CPL_ERROR_NULL_INPUT);
891 if (access(cpl_frame_get_filename(frame), F_OK)) {
892 cpl_msg_error(func,
"File %s (%s) was not found",
893 cpl_frame_get_filename(frame),
894 cpl_frame_get_tag(frame));
895 cpl_error_set(func, CPL_ERROR_FILE_NOT_FOUND);
896 cpl_frameset_iterator_delete(it);
897 cpl_ensure_code(CPL_FALSE, CPL_ERROR_FILE_NOT_FOUND);
900 plist = cpl_propertylist_load(fname, 0);
901 if(!cpl_propertylist_has(plist,
"INSTRUME")) {
902 cpl_propertylist_delete(plist);
903 cpl_frameset_iterator_delete(it);
904 cpl_ensure_code(CPL_FALSE, CPL_ERROR_DATA_NOT_FOUND);
906 cpl_propertylist_delete(plist);
908 cpl_frameset_iterator_advance(it, 1);
909 frame = cpl_frameset_iterator_get(it);
913 cpl_frameset_iterator_delete(it);
915 if (cpl_error_get_code())
916 return cpl_error_get_code();
918 return CPL_ERROR_NONE;
922eris_image_flag_nan(cpl_image** ima)
924 cpl_ensure_code(ima != NULL, CPL_ERROR_NULL_INPUT);
926 cpl_mask* bpm = cpl_image_get_bpm(*ima);
927 cpl_binary* pbpm = cpl_mask_get_data(bpm);
928 cpl_size sx = cpl_image_get_size_x(*ima);
929 cpl_size sy = cpl_image_get_size_y(*ima);
930 double* pdata = cpl_image_get_data(*ima);
931 for(cpl_size j = 0; j < sy; j++ ) {
932 for(cpl_size i = 0; i < sx; i++ ) {
933 if(isnan(pdata[i+j*sx])){
935 pbpm[i+j*sx] = CPL_BINARY_1;
942 return cpl_error_get_code();
cpl_error_code eris_files_dont_exist(cpl_frameset *frameset)
Check if all SOF files exist.
cpl_error_code eris_parameters_get_double(const cpl_parameterlist *parlist, const char *pname, double *pvalue)
get double parameter value if changed by the user
cpl_error_code eris_check_error_code(const char *func_id)
handle CPL errors
cpl_frameset * eris_dfs_extract_frames_with_tag(cpl_frameset *input, const char *rtag)
Extract frames of user given tag.
cpl_error_code eris_dfs_extract_raw_frames(cpl_frameset *input, cpl_frameset *raws)
split input sof in groups: raw and calib
const char * eris_get_license(void)
Get the pipeline copyright and license.
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_error_code eris_dfs_extract_cal_frames(cpl_frameset *input, cpl_frameset *calibs)
split input sof in groups: raw and calib