40 #include "irplib_utils.h"
41 #include "irplib_flat.h"
43 #include "isaac_utils.h"
44 #include "irplib_oddeven.h"
45 #include "isaac_pfits.h"
46 #include "isaac_dfs.h"
49 #define PRO_DATANCOM "ESO PRO DATANCOM"
55 static int isaac_img_twflat_create(cpl_plugin *);
56 static int isaac_img_twflat_exec(cpl_plugin *);
57 static int isaac_img_twflat_destroy(cpl_plugin *);
58 static int isaac_img_twflat(cpl_parameterlist *, cpl_frameset *);
59 static cpl_imagelist * isaac_img_twflat_reduce(cpl_frameset *, cpl_frameset *);
60 static int isaac_img_twflat_save(cpl_imagelist *, cpl_image *,
int,
61 const cpl_frameset *, cpl_parameterlist *,
63 static int isaac_img_twflat_compare(
const cpl_frame *,
const cpl_frame *);
81 double oddeven_ll_max;
82 double oddeven_lr_max;
83 double oddeven_ul_max;
84 double oddeven_ur_max;
85 double oddeven_ll_stdev;
86 double oddeven_lr_stdev;
87 double oddeven_ul_stdev;
88 double oddeven_ur_stdev;
89 double oddeven_ll_mean;
90 double oddeven_lr_mean;
91 double oddeven_ul_mean;
92 double oddeven_ur_mean;
93 } isaac_img_twflat_config;
95 static char isaac_img_twflat_description[] =
96 "isaac_img_twflat -- ISAAC imaging flat-field creation from twillight images.\n"
97 "The files listed in the Set Of Frames (sof-file) must be tagged:\n"
98 "raw-file.fits "ISAAC_IMG_TWFLAT_RAW
" or\n"
99 "raw-file.fits "ISAAC_IMG_TWFLAT_POL_RAW
" or\n"
100 "dark-raw-file.fits "ISAAC_CALIB_DARK
"\n";
115 int cpl_plugin_get_info(cpl_pluginlist * list)
117 cpl_recipe * recipe = cpl_calloc(1,
sizeof(*recipe));
118 cpl_plugin * plugin = &recipe->interface;
120 cpl_plugin_init(plugin,
122 ISAAC_BINARY_VERSION,
123 CPL_PLUGIN_TYPE_RECIPE,
125 "Twillight flat recipe",
126 isaac_img_twflat_description,
130 isaac_img_twflat_create,
131 isaac_img_twflat_exec,
132 isaac_img_twflat_destroy);
134 cpl_pluginlist_append(list, plugin);
149 static int isaac_img_twflat_create(cpl_plugin * plugin)
155 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
156 recipe = (cpl_recipe *)plugin;
157 else return CPL_ERROR_UNSPECIFIED;
160 recipe->parameters = cpl_parameterlist_new();
164 p = cpl_parameter_new_value(
"isaac.isaac_img_twflat.thresholds",
166 "Low and high thresholds for the BPM",
167 "isaac.isaac_img_twflat",
169 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"t");
170 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
171 cpl_parameterlist_append(recipe->parameters, p);
173 p = cpl_parameter_new_value(
"isaac.isaac_img_twflat.proport", CPL_TYPE_BOOL,
174 "flag to activate the proportional fit",
"isaac.isaac_img_twflat",
176 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"prop");
177 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
178 cpl_parameterlist_append(recipe->parameters, p);
181 p = cpl_parameter_new_value(
"isaac.isaac_img_twflat.bpm", CPL_TYPE_BOOL,
182 "flag to create the bad pixels map",
"isaac.isaac_img_twflat",
184 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"bpm");
185 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
186 cpl_parameterlist_append(recipe->parameters, p);
189 p = cpl_parameter_new_value(
"isaac.isaac_img_twflat.errmap", CPL_TYPE_BOOL,
190 "flag to create the error map",
"isaac.isaac_img_twflat",
192 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"errmap");
193 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
194 cpl_parameterlist_append(recipe->parameters, p);
197 p = cpl_parameter_new_value(
"isaac.isaac_img_twflat.intercept",
198 CPL_TYPE_BOOL,
"flag to create the intercept image",
199 "isaac.isaac_img_twflat", FALSE);
200 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"intercept");
201 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
202 cpl_parameterlist_append(recipe->parameters, p);
215 static int isaac_img_twflat_exec(cpl_plugin * plugin)
220 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
221 recipe = (cpl_recipe *)plugin;
222 else return CPL_ERROR_UNSPECIFIED;
224 return isaac_img_twflat(recipe->parameters, recipe->frames);
234 static int isaac_img_twflat_destroy(cpl_plugin * plugin)
239 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
240 recipe = (cpl_recipe *)plugin;
241 else return CPL_ERROR_UNSPECIFIED;
243 cpl_parameterlist_delete(recipe->parameters);
255 static int isaac_img_twflat(
256 cpl_parameterlist * parlist,
257 cpl_frameset * framelist)
263 cpl_frameset * flatframes;
264 cpl_frameset * darkframes;
265 cpl_frameset * flat_one;
266 cpl_frameset * dark_one;
268 cpl_imagelist * twflat;
271 cpl_boolean did_reduce = CPL_FALSE;
277 isaac_img_twflat_config.nb_badpix = -1;
281 par = cpl_parameterlist_find(parlist,
"isaac.isaac_img_twflat.thresholds");
282 sval = cpl_parameter_get_string(par);
283 if (sscanf(sval,
"%lg,%lg",
284 &isaac_img_twflat_config.low_thresh,
285 &isaac_img_twflat_config.high_thresh)!=2) {
286 return CPL_ERROR_UNSPECIFIED;
289 par = cpl_parameterlist_find(parlist,
"isaac.isaac_img_twflat.proport");
290 isaac_img_twflat_config.prop_flag = cpl_parameter_get_bool(par);
292 par = cpl_parameterlist_find(parlist,
"isaac.isaac_img_twflat.bpm");
293 isaac_img_twflat_config.bpm_flag = cpl_parameter_get_bool(par);
295 par = cpl_parameterlist_find(parlist,
"isaac.isaac_img_twflat.errmap");
296 isaac_img_twflat_config.errmap_flag = cpl_parameter_get_bool(par);
298 par = cpl_parameterlist_find(parlist,
"isaac.isaac_img_twflat.intercept");
299 isaac_img_twflat_config.intercept_flag = cpl_parameter_get_bool(par);
303 cpl_msg_error(cpl_func,
"Cannot identify RAW and CALIB frames");
304 return CPL_ERROR_UNSPECIFIED;
309 ISAAC_IMG_TWFLAT_RAW)) != NULL) {
311 ISAAC_IMG_TWFLAT_POL_RAW)) != NULL) {
313 cpl_msg_error(cpl_func,
"Cannot find flat frames in the input list");
314 return CPL_ERROR_UNSPECIFIED;
319 if (darkframes != NULL) {
320 ndarks = cpl_frameset_get_size(darkframes);
321 if ((ndarks != 1) && (cpl_frameset_get_size(flatframes) != ndarks)) {
322 cpl_msg_error(cpl_func,
"Invalid number of dark frames submitted");
323 cpl_frameset_delete(flatframes);
324 cpl_frameset_delete(darkframes);
325 return CPL_ERROR_UNSPECIFIED;
330 labels = cpl_frameset_labelise(flatframes, isaac_img_twflat_compare,
332 if (labels == NULL) {
333 cpl_msg_error(cpl_func,
"Cannot labelise input frames");
334 cpl_frameset_delete(flatframes);
335 if (darkframes) cpl_frameset_delete(darkframes);
336 return CPL_ERROR_UNSPECIFIED;
340 for (i=0; i<nlabels; i++) {
342 cpl_msg_info(cpl_func,
"Reduce data set no %d out of %d", i+1,
344 cpl_msg_indent_more();
345 flat_one = cpl_frameset_extract(flatframes, labels, i);
347 if (darkframes) dark_one = cpl_frameset_extract(darkframes, labels, i);
348 twflat = isaac_img_twflat_reduce(flat_one, dark_one);
349 cpl_msg_indent_less();
352 cpl_msg_info(cpl_func,
"Save the products");
353 cpl_msg_indent_more();
354 if (twflat == NULL) {
355 cpl_msg_warning(cpl_func,
"Cannot reduce set nb %d", i+1);
358 if (isaac_img_twflat_config.bpm_flag) {
359 if ((bpm = cpl_mask_threshold_image_create(
360 cpl_imagelist_get(twflat, 0),
361 isaac_img_twflat_config.low_thresh,
362 isaac_img_twflat_config.high_thresh)) == NULL) {
363 cpl_msg_warning(cpl_func,
"Cannot create bad pixels map");
366 isaac_img_twflat_config.nb_badpix = cpl_mask_count(bpm);
367 bpm_im = cpl_image_new_from_mask(bpm);
368 cpl_mask_delete(bpm);
371 isaac_img_twflat_save(twflat, bpm_im, i+1, flat_one, parlist,
373 if (bpm_im) cpl_image_delete(bpm_im);
374 cpl_imagelist_delete(twflat);
375 if (!cpl_error_get_code()) did_reduce = CPL_TRUE;
377 cpl_msg_indent_less();
378 cpl_frameset_delete(flat_one);
379 if (dark_one) cpl_frameset_delete(dark_one);
383 cpl_frameset_delete(flatframes);
384 if (darkframes) cpl_frameset_delete(darkframes);
387 cpl_ensure_code(did_reduce, CPL_ERROR_ILLEGAL_INPUT);
389 return cpl_error_set_where(cpl_func);
404 static cpl_imagelist * isaac_img_twflat_reduce(
405 cpl_frameset * flatframes,
406 cpl_frameset * darkframes)
409 cpl_propertylist * plist;
411 cpl_image * flat_image;
415 cpl_stats * stats_ima;
416 cpl_vector * medians;
420 cpl_vector * reve_ll;
421 cpl_vector * reve_lr;
422 cpl_vector * reve_ul;
423 cpl_vector * reve_ur;
424 double ll, lr, ul, ur;
428 if (flatframes == NULL)
return NULL;
431 nima = cpl_frameset_get_size(flatframes);
434 if (cpl_error_get_code())
return NULL;
437 frame = cpl_frameset_get_position(flatframes, 0);
438 plist=cpl_propertylist_load(cpl_frame_get_filename(frame), 0);
440 if (cpl_error_get_code()) {
441 cpl_msg_error(cpl_func,
"Cannot get the filter or ROM or TPL.ID");
442 cpl_propertylist_delete(plist);
445 cpl_msg_info(cpl_func,
"Filter: [%s]", sval);
446 cpl_propertylist_delete(plist);
449 cpl_msg_info(cpl_func,
"---> Loading input set");
450 if ((in = cpl_imagelist_load_frameset(flatframes, CPL_TYPE_FLOAT, 1,
452 cpl_msg_error(cpl_func,
"Cannot load the image set");
457 cpl_msg_info(cpl_func,
"---> Computing stats");
458 cpl_msg_info(cpl_func,
"image min max med rms");
459 cpl_msg_info(cpl_func,
"---------------------------------------------");
460 medians = cpl_vector_new(nima);
461 for (i=0; i<nima; i++) {
462 stats_ima = cpl_stats_new_from_image(cpl_imagelist_get(in, i),
464 if (stats_ima == NULL) {
465 cpl_msg_error(cpl_func,
"Cannot compute stats on image %d", i+1);
466 cpl_imagelist_delete(in);
467 cpl_vector_delete(medians);
470 cpl_vector_set(medians, i, cpl_stats_get_median(stats_ima));
471 cpl_msg_info(cpl_func,
"%02d %10.2f %10.2f %10.2f %10.2f",
473 cpl_stats_get_min(stats_ima),
474 cpl_stats_get_max(stats_ima),
475 cpl_stats_get_median(stats_ima),
476 cpl_stats_get_stdev(stats_ima));
477 if (cpl_stats_get_median(stats_ima) < 1e-6) {
478 cpl_msg_error(cpl_func,
"image %d has negative flux: aborting",
480 cpl_imagelist_delete(in);
481 cpl_vector_delete(medians);
482 cpl_stats_delete(stats_ima);
485 cpl_stats_delete(stats_ima);
487 cpl_msg_info(cpl_func,
"---------------------------------------------");
490 isaac_img_twflat_config.med_min = cpl_vector_get_min(medians);
491 isaac_img_twflat_config.med_max = cpl_vector_get_max(medians);
492 isaac_img_twflat_config.med_avg = cpl_vector_get_mean(medians);
493 isaac_img_twflat_config.med_stdev = cpl_vector_get_stdev(medians);
494 cpl_vector_delete(medians);
498 cpl_msg_info(cpl_func,
"---> Subtracting dark");
500 if ((dark = cpl_imagelist_load_frameset(darkframes, CPL_TYPE_FLOAT, 1,
502 cpl_msg_error(cpl_func,
"Cannot load the darks set");
503 cpl_imagelist_delete(in);
507 if (cpl_imagelist_get_size(dark) == 1) {
508 cpl_imagelist_subtract_image(in, cpl_imagelist_get(dark, 0));
510 cpl_imagelist_subtract(in, dark);
512 cpl_imagelist_delete(dark);
515 cpl_msg_info(cpl_func,
"switching to proportional fit");
516 isaac_img_twflat_config.prop_flag = 1;
520 if (!isaac_img_twflat_config.prop_flag) {
521 gradient=fabs(isaac_img_twflat_config.med_max/
522 isaac_img_twflat_config.med_min);
523 if (gradient < 4.0) {
524 cpl_msg_warning(cpl_func,
"low flux gradient: %g", gradient);
525 cpl_msg_warning(cpl_func,
"a proportional fit may give better ");
526 cpl_msg_warning(cpl_func,
"results (requires a master dark frame)");
531 cpl_msg_info(cpl_func,
"---> Monitor odd/even column effect");
532 reve_ll = cpl_vector_new(nima);
533 reve_lr = cpl_vector_new(nima);
534 reve_ul = cpl_vector_new(nima);
535 reve_ur = cpl_vector_new(nima);
536 for (i=0; i<nima; i++) {
537 irplib_oddeven_monitor(cpl_imagelist_get(in, i), 1, &ll);
538 irplib_oddeven_monitor(cpl_imagelist_get(in, i), 2, &lr);
539 irplib_oddeven_monitor(cpl_imagelist_get(in, i), 3, &ul);
540 irplib_oddeven_monitor(cpl_imagelist_get(in, i), 4, &ur);
541 cpl_vector_set(reve_ll, i, ll);
542 cpl_vector_set(reve_lr, i, lr);
543 cpl_vector_set(reve_ul, i, ul);
544 cpl_vector_set(reve_ur, i, ur);
546 isaac_img_twflat_config.oddeven_ll_max = cpl_vector_get_max(reve_ll);
547 isaac_img_twflat_config.oddeven_lr_max = cpl_vector_get_max(reve_lr);
548 isaac_img_twflat_config.oddeven_ul_max = cpl_vector_get_max(reve_ul);
549 isaac_img_twflat_config.oddeven_ur_max = cpl_vector_get_max(reve_ur);
550 isaac_img_twflat_config.oddeven_ll_stdev = cpl_vector_get_stdev(reve_ll);
551 isaac_img_twflat_config.oddeven_lr_stdev = cpl_vector_get_stdev(reve_lr);
552 isaac_img_twflat_config.oddeven_ul_stdev = cpl_vector_get_stdev(reve_ul);
553 isaac_img_twflat_config.oddeven_ur_stdev = cpl_vector_get_stdev(reve_ur);
554 isaac_img_twflat_config.oddeven_ll_mean = cpl_vector_get_mean(reve_ll);
555 isaac_img_twflat_config.oddeven_lr_mean = cpl_vector_get_mean(reve_lr);
556 isaac_img_twflat_config.oddeven_ul_mean = cpl_vector_get_mean(reve_ul);
557 isaac_img_twflat_config.oddeven_ur_mean = cpl_vector_get_mean(reve_ur);
558 cpl_vector_delete(reve_ll);
559 cpl_vector_delete(reve_lr);
560 cpl_vector_delete(reve_ul);
561 cpl_vector_delete(reve_ur);
564 cpl_msg_info(cpl_func,
"---> Fitting slopes");
565 if (isaac_img_twflat_config.prop_flag) {
566 results = irplib_flat_fit_set(in, 0);
567 if (results == NULL) {
568 cpl_msg_error(cpl_func,
"creating twilight flat-field: aborting");
569 cpl_imagelist_delete(in);
573 results = irplib_flat_fit_set(in, 1);
574 if (results == NULL) {
575 cpl_msg_error(cpl_func,
"creating twilight flat-field: aborting");
576 cpl_imagelist_delete(in);
580 cpl_imagelist_delete(in);
583 flat_image = cpl_imagelist_get(results, 0);
584 norm = cpl_image_get_mean(flat_image);
585 cpl_image_divide_scalar(flat_image, norm);
586 if (cpl_error_get_code()) {
587 cpl_imagelist_delete(results);
605 static int isaac_img_twflat_save(
606 cpl_imagelist * flat,
609 const cpl_frameset * set,
610 cpl_parameterlist * parlist,
611 cpl_frameset * set_tot)
613 const cpl_size nframes = cpl_frameset_get_size(set);
614 cpl_propertylist * plist;
615 cpl_propertylist * paflist;
616 cpl_propertylist * qclist;
617 const cpl_frame * ref_frame;
624 nima = cpl_imagelist_get_size(flat);
625 if (nima != 2 && nima != 3)
return CPL_ERROR_UNSPECIFIED;
628 qclist = cpl_propertylist_new();
631 ref_frame = irplib_frameset_get_first_from_group(set, CPL_FRAME_GROUP_RAW);
632 if ((plist=cpl_propertylist_load(cpl_frame_get_filename(ref_frame),
634 cpl_msg_error(cpl_func,
"getting header from reference frame");
635 cpl_propertylist_delete(qclist);
636 return CPL_ERROR_UNSPECIFIED;
639 if (cpl_error_get_code()) {
640 cpl_propertylist_delete(qclist);
641 cpl_propertylist_delete(plist);
642 return CPL_ERROR_UNSPECIFIED;
646 if (cpl_error_get_code()) cpl_error_reset();
647 else cpl_propertylist_append_string(qclist,
"ESO QC FILTER OBS", sval);
650 if (cpl_error_get_code()) cpl_error_reset();
651 else cpl_propertylist_append_string(qclist,
"ESO QC OBJECTIVE", sval);
652 cpl_propertylist_delete(plist);
653 cpl_propertylist_append_double(qclist,
"ESO QC TWFLAT MEDMIN",
654 isaac_img_twflat_config.med_min);
655 cpl_propertylist_append_double(qclist,
"ESO QC TWFLAT MEDMAX",
656 isaac_img_twflat_config.med_max);
657 cpl_propertylist_append_double(qclist,
"ESO QC TWFLAT MEDAVG",
658 isaac_img_twflat_config.med_avg);
659 cpl_propertylist_append_double(qclist,
"ESO QC TWFLAT MEDSTDEV",
660 isaac_img_twflat_config.med_stdev);
661 if (isaac_img_twflat_config.nb_badpix >=0 ) {
662 cpl_propertylist_append_int(qclist,
"ESO QC TWFLAT NBADPIX",
663 isaac_img_twflat_config.nb_badpix);
665 cpl_propertylist_append_int(qclist,
"ESO QC TWFLAT NFRAMES",
667 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN LLMAX",
668 isaac_img_twflat_config.oddeven_ll_max);
669 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN LLMEAN",
670 isaac_img_twflat_config.oddeven_ll_mean);
671 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN LLSTDEV",
672 isaac_img_twflat_config.oddeven_ll_stdev);
673 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN LRMAX",
674 isaac_img_twflat_config.oddeven_lr_max);
675 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN LRMEAN",
676 isaac_img_twflat_config.oddeven_lr_mean);
677 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN LRSTDEV",
678 isaac_img_twflat_config.oddeven_lr_stdev);
679 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN ULMAX",
680 isaac_img_twflat_config.oddeven_ul_max);
681 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN ULMEAN",
682 isaac_img_twflat_config.oddeven_ul_mean);
683 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN ULSTDEV",
684 isaac_img_twflat_config.oddeven_ul_stdev);
685 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN URMAX",
686 isaac_img_twflat_config.oddeven_ur_max);
687 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN URMEAN",
688 isaac_img_twflat_config.oddeven_ur_mean);
689 cpl_propertylist_append_double(qclist,
"ESO QC ODDEVEN URSTDEV",
690 isaac_img_twflat_config.oddeven_ur_stdev);
693 filename = cpl_sprintf(
"isaac_img_twflat_set%02d.fits", set_nb);
694 irplib_dfs_save_image(set_tot,
697 cpl_imagelist_get(flat, 0),
700 ISAAC_IMG_TWFLAT_RES,
703 PACKAGE
"/" PACKAGE_VERSION,
709 filename = cpl_sprintf(
"isaac_img_twflat_set%02d_bpm.fits", set_nb);
710 irplib_dfs_save_image(set_tot,
716 ISAAC_IMG_TWFLAT_BPM,
719 PACKAGE
"/" PACKAGE_VERSION,
725 if (isaac_img_twflat_config.intercept_flag && nima == 3) {
726 filename = cpl_sprintf(
"isaac_img_twflat_set%02d_inter.fits",set_nb);
727 irplib_dfs_save_image(set_tot,
730 cpl_imagelist_get(flat, 1),
733 ISAAC_IMG_TWFLAT_INTERC,
736 PACKAGE
"/" PACKAGE_VERSION,
742 if (isaac_img_twflat_config.errmap_flag) {
743 if (nima == 2) file_id = 1;
745 filename=cpl_sprintf(
"isaac_img_twflat_set%02d_errmap.fits", set_nb);
746 irplib_dfs_save_image(set_tot,
749 cpl_imagelist_get(flat, file_id),
752 ISAAC_IMG_TWFLAT_ERR,
755 PACKAGE
"/" PACKAGE_VERSION,
761 if ((plist=cpl_propertylist_load(cpl_frame_get_filename(ref_frame),
763 cpl_msg_error(cpl_func,
"getting header from reference frame");
764 cpl_propertylist_delete(qclist);
765 return CPL_ERROR_UNSPECIFIED;
769 paflist = cpl_propertylist_new();
770 cpl_propertylist_copy_property_regexp(paflist, plist,
771 "^(DATE-OBS|ESO DET CHIP NAME|ARCFILE|ESO TPL ID|ESO DET MODE NAME|"
772 "ESO DET NCORRS NAME|ESO DET RSPEED|ESO DET DIT)$", 0);
773 cpl_propertylist_delete(plist);
778 for (cpl_size i = 0; i < nframes; i++) {
779 const cpl_frame* iframe = cpl_frameset_get_position_const(set, i);
780 if (cpl_frame_get_group(iframe) == CPL_FRAME_GROUP_RAW) nraw++;
783 if (!cpl_propertylist_has(paflist, PRO_DATANCOM)) {
784 cpl_propertylist_update_int(paflist, PRO_DATANCOM, nraw);
785 cpl_propertylist_set_comment(paflist, PRO_DATANCOM,
786 "Number of combined frames");
793 cpl_propertylist_copy_property_regexp(paflist, qclist,
".", 0);
794 cpl_propertylist_delete(qclist);
797 cpl_propertylist_update_string(paflist, CPL_DFS_PRO_CATG,
798 ISAAC_IMG_TWFLAT_RES);
801 filename = cpl_sprintf(
"isaac_img_twflat_set%02d.paf", set_nb);
802 cpl_dfs_save_paf(
"ISAAC",
807 cpl_propertylist_delete(paflist);
819 static int isaac_img_twflat_compare(
820 const cpl_frame * frame1,
821 const cpl_frame * frame2)
824 cpl_propertylist * plist1;
825 cpl_propertylist * plist2;
830 if (frame1==NULL || frame2==NULL)
return CPL_ERROR_UNSPECIFIED;
833 if ((plist1=cpl_propertylist_load(cpl_frame_get_filename(frame1),
835 cpl_msg_error(cpl_func,
"getting header from reference frame");
836 return CPL_ERROR_UNSPECIFIED;
838 if ((plist2=cpl_propertylist_load(cpl_frame_get_filename(frame2),
840 cpl_msg_error(cpl_func,
"getting header from reference frame");
841 cpl_propertylist_delete(plist1);
842 return CPL_ERROR_UNSPECIFIED;
846 if (cpl_error_get_code()) {
847 cpl_propertylist_delete(plist1);
848 cpl_propertylist_delete(plist2);
849 return CPL_ERROR_UNSPECIFIED;
857 if (cpl_error_get_code()) {
858 cpl_msg_error(cpl_func,
"cannot get the filter");
859 cpl_propertylist_delete(plist1);
860 cpl_propertylist_delete(plist2);
861 return CPL_ERROR_UNSPECIFIED;
863 if (strcmp(sval1, sval2)) comparison = 0;
865 cpl_propertylist_delete(plist1);
866 cpl_propertylist_delete(plist2);
int isaac_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
const char * isaac_pfits_get_objective(const cpl_propertylist *plist)
find out the objective
const char * isaac_pfits_get_filter(const cpl_propertylist *plist)
find out the filter
cpl_frameset * isaac_extract_frameset(const cpl_frameset *self, const char *tag)
Extract the frames with the given tag from a frameset.
const char * isaac_get_license(void)
Get the pipeline copyright and license.