41 #include "irplib_cat.h"
42 #include "irplib_wcs.h"
44 #include "hawki_utils.h"
45 #include "hawki_pfits.h"
46 #include "hawki_load.h"
67 const char * hawki_license =
68 "This file is part of the HAWKI Instrument Pipeline\n"
69 "Copyright (C) 2002,2011 European Southern Observatory\n"
71 "This program is free software; you can redistribute it and/or modify\n"
72 "it under the terms of the GNU General Public License as published by\n"
73 "the Free Software Foundation; either version 2 of the License, or\n"
74 "(at your option) any later version.\n"
76 "This program is distributed in the hope that it will be useful,\n"
77 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
78 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
79 "GNU General Public License for more details.\n"
81 "You should have received a copy of the GNU General Public License\n"
82 "along with this program; if not, write to the Free Software\n"
83 "Foundation, Inc., 59 Temple Place, Suite 330, Boston, \n"
85 return hawki_license ;
95 cpl_msg_info(__func__,
"*****************************************");
96 cpl_msg_info(__func__,
"Welcome to HAWK-I Pipeline release %s",
98 cpl_msg_info(__func__,
"*****************************************");
108 return PACKAGE_VERSION;
120 const cpl_image * in,
123 double med, stdev, threshold ;
125 cpl_image * bpm_int ;
128 if (in == NULL)
return NULL ;
129 if (sigma <= 0)
return NULL ;
131 bpm = cpl_image_duplicate(in);
134 med = cpl_image_get_median_dev(bpm, &stdev) ;
135 threshold = med + sigma*stdev ;
136 cpl_msg_info(__func__,
"Threshold : %g = %g + %g * %g",
137 threshold, med, sigma, stdev) ;
140 cpl_image_threshold(bpm, threshold, threshold, 0.0, 1.0) ;
143 bpm_int = cpl_image_cast(bpm, CPL_TYPE_INT) ;
144 cpl_image_delete(bpm) ;
164 (
const cpl_image * in,
170 cpl_image * filtered ;
171 double med, stdev, threshold ;
172 cpl_image * bpm_sigma;
173 cpl_image * bpm_lowhigh;
175 cpl_image * bpm_int ;
178 if (in == NULL)
return NULL ;
179 if (sigma <= 0)
return NULL ;
182 kernel = cpl_mask_new(3, 3) ;
183 cpl_mask_not(kernel) ;
184 filtered = cpl_image_new(cpl_image_get_size_x(in), cpl_image_get_size_y(in),
185 cpl_image_get_type(in));
186 cpl_image_filter_mask(filtered, in, kernel, CPL_FILTER_MEDIAN,
188 cpl_mask_delete(kernel) ;
191 bpm_sigma = cpl_image_subtract_create(in, filtered) ;
192 cpl_image_delete(filtered) ;
195 med = cpl_image_get_median_dev(bpm_sigma, &stdev) ;
196 threshold = med + sigma*stdev ;
197 cpl_msg_info(__func__,
"Threshold : %g = %g + %g * %g",
198 threshold, med, sigma, stdev) ;
201 cpl_image_threshold(bpm_sigma, threshold, threshold, 0.0, 1.0) ;
204 bpm_lowhigh = cpl_image_duplicate(in);
208 bpm = cpl_image_add_create(bpm_sigma, bpm_lowhigh);
209 cpl_image_threshold(bpm, 0.0, 1.0, 0.0, 1.0);
212 bpm_int = cpl_image_cast(bpm, CPL_TYPE_INT) ;
213 cpl_image_delete(bpm) ;
214 cpl_image_delete(bpm_sigma);
215 cpl_image_delete(bpm_lowhigh);
241 (cpl_image * image_in,
244 double assign_in_range,
245 double assign_out_range)
250 cpl_ensure_code(image_in != NULL, CPL_ERROR_NULL_INPUT);
251 cpl_ensure_code(lo_valid <= hi_valid, CPL_ERROR_ILLEGAL_INPUT);
254 npix = cpl_image_get_size_x(image_in) * cpl_image_get_size_y(image_in);
257 switch (cpl_image_get_type(image_in))
259 case CPL_TYPE_DOUBLE: {
260 double * pdi = cpl_image_get_data_double(image_in);
261 for (i=0; i<npix; i++) {
262 if ((pdi[i]>lo_valid) && (pdi[i]<hi_valid))
263 pdi[i] = (double)assign_in_range;
265 pdi[i] = (double)assign_out_range;
269 case CPL_TYPE_FLOAT: {
270 float * pdi = cpl_image_get_data_float(image_in);
271 for (i=0; i<npix; i++) {
272 if ((pdi[i]>lo_valid) && (pdi[i]<hi_valid))
273 pdi[i] = (float)assign_in_range;
275 pdi[i] = (float)assign_out_range;
280 int * pdi = cpl_image_get_data_int(image_in);
281 for (i=0; i<npix; i++) {
282 if (((
double)pdi[i]>lo_valid) && ((
double)pdi[i]<hi_valid))
283 pdi[i] = (int)assign_in_range;
285 pdi[i] = (int)assign_out_range;
290 cpl_ensure_code(0, CPL_ERROR_INVALID_TYPE);
292 return CPL_ERROR_NONE;
310 cpl_image * ima_ext[HAWKI_NB_DETECTORS] ;
312 cpl_bivector * offsets ;
315 cpl_image ** combined ;
316 cpl_image * stitched ;
320 if (ima == NULL)
return NULL ;
321 if (x == NULL)
return NULL ;
322 if (y == NULL)
return NULL ;
325 lx = cpl_image_get_size_x(ima[0]) ;
326 ly = cpl_image_get_size_y(ima[0]) ;
327 for (i=1 ; i<HAWKI_NB_DETECTORS ; i++) {
328 if (lx > cpl_image_get_size_x(ima[i]))
329 lx = cpl_image_get_size_x(ima[i]) ;
330 if (ly > cpl_image_get_size_y(ima[i]))
331 ly = cpl_image_get_size_y(ima[i]) ;
335 in = cpl_imagelist_new() ;
336 for (i=0 ; i<HAWKI_NB_DETECTORS ; i++) {
337 ima_ext[i] = cpl_image_extract(ima[i], 1, 1, lx, ly) ;
338 cpl_imagelist_set(in, ima_ext[i], i) ;
342 offsets = cpl_bivector_new(HAWKI_NB_DETECTORS) ;
343 offsets_x = cpl_bivector_get_x_data(offsets) ;
344 offsets_y = cpl_bivector_get_y_data(offsets) ;
345 offsets_x[0] = HAWKI_DET1_POSX ;
346 offsets_y[0] = HAWKI_DET1_POSY ;
347 offsets_x[1] = x[0] - x[1] + HAWKI_DET2_POSX ;
348 offsets_y[1] = y[0] - y[1] + HAWKI_DET2_POSY ;
349 offsets_x[2] = x[0] - x[2] + HAWKI_DET3_POSX ;
350 offsets_y[2] = y[0] - y[2] + HAWKI_DET3_POSY ;
351 offsets_x[3] = x[0] - x[3] + HAWKI_DET4_POSX ;
352 offsets_y[3] = y[0] - y[3] + HAWKI_DET4_POSY ;
355 if ((combined = cpl_geom_img_offset_saa(in, offsets,
356 CPL_KERNEL_DEFAULT, 0, 0, CPL_GEOM_UNION, NULL, NULL)) == NULL)
358 cpl_msg_error(__func__,
"Cannot recombine the images") ;
359 cpl_bivector_delete(offsets) ;
360 cpl_imagelist_delete(in) ;
363 cpl_bivector_delete(offsets) ;
364 cpl_imagelist_delete(in) ;
367 stitched = combined[0] ;
368 cpl_image_delete(combined[1]) ;
392 if (in == NULL)
return -1 ;
394 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 0), h1) ;
395 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 1), h2) ;
396 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 2), h3) ;
397 cpl_image_multiply_scalar((cpl_image *)cpl_imagelist_get(in, 3), h4) ;
423 const cpl_imagelist * in,
432 const cpl_image * ima ;
433 double avg1, avg2, avg3, avg4 ;
435 int llx, lly, urx, ury ;
438 if (in == NULL)
return -1 ;
439 if (h1==NULL || h2==NULL || h3==NULL || h4==NULL || h==NULL)
return -1 ;
442 ima = cpl_imagelist_get_const(in, 0) ;
443 nx = cpl_image_get_size_x(ima) ;
444 ny = cpl_image_get_size_y(ima) ;
445 llx = 1 ; lly = ny - width + 1 ; urx = nx ; ury = ny ;
446 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
447 if (cpl_error_get_code()) {
448 cpl_msg_error(__func__,
"Cannot get statistics from chip 1") ;
451 llx = nx - width + 1 ; lly = 1 ; urx = nx ; ury = ny ;
452 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
453 if (cpl_error_get_code()) {
454 cpl_msg_error(__func__,
"Cannot get statistics from chip 1") ;
457 avg1 = (val1 + val2) / 2.0 ;
460 ima = cpl_imagelist_get_const(in, 1) ;
461 nx = cpl_image_get_size_x(ima) ;
462 ny = cpl_image_get_size_y(ima) ;
463 llx = 1 ; lly = 1 ; urx = width ; ury = ny ;
464 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
465 if (cpl_error_get_code()) {
466 cpl_msg_error(__func__,
"Cannot get statistics from chip 2") ;
469 llx = 1 ; lly = ny - width + 1 ; urx = nx ; ury = ny ;
470 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
471 if (cpl_error_get_code()) {
472 cpl_msg_error(__func__,
"Cannot get statistics from chip 2") ;
475 avg2 = (val1 + val2) / 2.0 ;
478 ima = cpl_imagelist_get_const(in, 2) ;
479 nx = cpl_image_get_size_x(ima) ;
480 ny = cpl_image_get_size_y(ima) ;
481 llx = 1 ; lly = 1 ; urx = nx ; ury = width ;
482 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
483 if (cpl_error_get_code()) {
484 cpl_msg_error(__func__,
"Cannot get statistics from chip 3") ;
487 llx = nx - width + 1 ; lly = 1 ; urx = nx ; ury = ny ;
488 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
489 if (cpl_error_get_code()) {
490 cpl_msg_error(__func__,
"Cannot get statistics from chip 3") ;
493 avg3 = (val1 + val2) / 2.0 ;
496 ima = cpl_imagelist_get_const(in, 3) ;
497 nx = cpl_image_get_size_x(ima) ;
498 ny = cpl_image_get_size_y(ima) ;
499 llx = 1 ; lly = 1 ; urx = width ; ury = ny ;
500 val1 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
501 if (cpl_error_get_code()) {
502 cpl_msg_error(__func__,
"Cannot get statistics from chip 4") ;
505 llx = 1 ; lly = 1 ; urx = nx ; ury = width ;
506 val2 = cpl_image_get_mean_window(ima, llx, lly, urx, ury) ;
507 if (cpl_error_get_code()) {
508 cpl_msg_error(__func__,
"Cannot get statistics from chip 4") ;
511 avg4 = (val1 + val2) / 2.0 ;
514 *h = (avg1 + avg2 + avg3 + avg4) / 4.0 ;
535 cpl_image * filtered ;
536 cpl_image * subsampled ;
539 cpl_polynomial * poly ;
540 cpl_bivector * xy_pos ;
542 int quad_sz, nbpoints, lx, ly, nx, ny ;
550 if (in == NULL)
return NULL ;
551 nx = cpl_image_get_size_x(in) ;
552 ny = cpl_image_get_size_y(in) ;
556 tmp = (cpl_image *)in ;
560 quad_sz = pow(2, (
double)nscales) ;
564 if (quad_sz >= nx || quad_sz >= ny)
return NULL ;
567 kernel = cpl_mask_new(3, 3) ;
568 cpl_mask_not(kernel) ;
571 for (i=0 ; i<nscales ; i++) {
574 filtered = cpl_image_new(cpl_image_get_size_x(tmp),
575 cpl_image_get_size_y(tmp),
576 cpl_image_get_type(tmp));
577 cpl_image_filter_mask(filtered, in, kernel, CPL_FILTER_MEDIAN,
579 if (i>0) cpl_image_delete(tmp) ;
582 subsampled = cpl_image_extract_subsample(filtered, 2, 2) ;
583 cpl_image_delete(filtered) ;
587 cpl_mask_delete(kernel) ;
591 cpl_image_get_size_x(subsampled)*cpl_image_get_size_y(subsampled)) {
592 cpl_msg_error(__func__,
"Invalid size") ;
593 cpl_image_delete(subsampled) ;
598 xy_pos = cpl_bivector_new(nbpoints) ;
599 vals = cpl_vector_new(nbpoints) ;
600 pxy_pos_x = cpl_bivector_get_x_data(xy_pos) ;
601 pxy_pos_y = cpl_bivector_get_y_data(xy_pos) ;
602 pvals = cpl_vector_get_data(vals) ;
603 pima = cpl_image_get_data_float(subsampled) ;
604 for (j=0 ; j<ly ; j++) {
605 for (i=0 ; i<lx ; i++) {
606 pxy_pos_x[i+j*lx] = i * quad_sz + quad_sz/2 ;
607 pxy_pos_y[i+j*lx] = j * quad_sz + quad_sz/2 ;
608 pvals[i+j*lx] = (double)pima[i+j*lx];
611 cpl_image_delete(subsampled) ;
614 if ((poly = cpl_polynomial_fit_2d_create(xy_pos, vals, 3, NULL)) == NULL) {
615 cpl_msg_error(__func__,
"Cannot fit the polynomial") ;
616 cpl_bivector_delete(xy_pos) ;
617 cpl_vector_delete(vals) ;
620 cpl_bivector_delete(xy_pos) ;
621 cpl_vector_delete(vals) ;
624 out = cpl_image_duplicate(in) ;
625 cpl_image_fill_polynomial(out, poly, 1.0, 1.0, 1.0, 1.0) ;
626 cpl_polynomial_delete(poly) ;
640 const cpl_frameset * in,
643 const cpl_frame * cur_frame ;
646 if ((cur_frame = cpl_frameset_find_const(in, tag)) == NULL)
return NULL ;
647 return cpl_frame_get_filename(cur_frame) ;
659 if (!strcmp(f,
"J"))
return HAWKI_BAND_J ;
660 if (!strcmp(f,
"H"))
return HAWKI_BAND_H ;
661 if (!strcmp(f,
"K"))
return HAWKI_BAND_K ;
662 if (!strcmp(f,
"Ks"))
return HAWKI_BAND_K ;
663 if (!strcmp(f,
"Y"))
return HAWKI_BAND_Y ;
664 return HAWKI_BAND_UNKNOWN ;
677 case HAWKI_BAND_J:
return "J" ;
678 case HAWKI_BAND_H:
return "H" ;
679 case HAWKI_BAND_K:
return "K" ;
680 case HAWKI_BAND_Y:
return "Y" ;
681 default:
return "Unknown" ;
697 cpl_bivector * offsets ;
700 const cpl_frame * frame ;
701 cpl_propertylist * plist ;
704 cpl_errorstate error_prevstate = cpl_errorstate_get();
708 if (fset == NULL)
return NULL ;
711 nfiles = cpl_frameset_get_size(fset) ;
712 offsets = cpl_bivector_new(nfiles) ;
713 offsets_x = cpl_bivector_get_x_data(offsets) ;
714 offsets_y = cpl_bivector_get_y_data(offsets) ;
715 for (i=0 ; i<nfiles ; i++) {
718 frame = cpl_frameset_get_frame_const(fset, i) ;
719 plist=cpl_propertylist_load(cpl_frame_get_filename(frame),0);
722 cpl_propertylist_delete(plist) ;
723 if(!cpl_errorstate_is_equal(error_prevstate ))
725 cpl_msg_error(__func__,
"Cannot get offsets from header") ;
726 cpl_bivector_delete(offsets) ;
743 cpl_frame * cur_frame;
744 cpl_propertylist * plist;
746 double mean_airmass = 0.0;
749 if (
set == NULL)
return -1;
752 nframes = cpl_frameset_get_size(
set);
754 for (iframe=0 ; iframe<nframes ; iframe++)
756 cur_frame = cpl_frameset_get_frame(
set, iframe);
757 plist = cpl_propertylist_load(cpl_frame_get_filename(cur_frame), 0);
760 cpl_propertylist_delete(plist);
762 mean_airmass /= 2. * nframes;
782 (
const cpl_frameset * in)
785 cpl_bivector * offsets ;
794 if (in == NULL)
return NULL ;
797 nframes = cpl_frameset_get_size(in) ;
801 cpl_msg_error(__func__,
"Cannot read the offsets") ;
804 poff_x = cpl_bivector_get_x_data(offsets) ;
805 poff_y = cpl_bivector_get_y_data(offsets) ;
808 off_x_mean = cpl_vector_get_mean(cpl_bivector_get_x(offsets));
809 off_y_mean = cpl_vector_get_mean(cpl_bivector_get_y(offsets));
812 labels = cpl_malloc(nframes *
sizeof(
int)) ;
813 for (i=0 ; i<nframes ; i++) {
814 if (poff_x[i] - off_x_mean <= 0 && poff_y[i] - off_y_mean <= 0)
816 else if (poff_x[i] - off_x_mean >= 0 && poff_y[i] - off_y_mean <= 0)
818 else if (poff_x[i] - off_x_mean >= 0 && poff_y[i] - off_y_mean >= 0)
820 else if (poff_x[i] - off_x_mean <= 0 && poff_y[i] - off_y_mean >= 0)
824 cpl_bivector_delete(offsets) ;
837 (
const cpl_frameset * in,
846 if (in == NULL)
return -1;
849 nframes = cpl_frameset_get_size(in) ;
852 for (iframe=0 ; iframe<nframes ; iframe++)
854 const char * filename;
855 filename = cpl_frame_get_filename
856 (cpl_frameset_get_frame_const(in, iframe));
858 for (idet=0 ; idet<HAWKI_NB_DETECTORS ; idet++)
860 cpl_propertylist * main_header;
861 cpl_propertylist * ext_header;
863 double naxis1, naxis2;
864 double star_x, star_y;
867 main_header = cpl_propertylist_load(filename, 0);
868 ext_header = cpl_propertylist_load
872 wcs = cpl_wcs_new_from_propertylist(ext_header);
875 cpl_msg_error(__func__,
"Could not get WCS info");
876 cpl_propertylist_delete(ext_header);
877 cpl_propertylist_delete(main_header);
880 if(irplib_wcs_radectoxy(wcs, star_ra, star_dec, &star_x, &star_y)
883 cpl_errorstate_set(CPL_ERROR_NONE);
889 if(star_x > 0 && star_x < naxis1 && star_y > 0 && star_y < naxis2)
891 labels[iframe] = idet + 1;
895 cpl_propertylist_delete(ext_header);
896 cpl_propertylist_delete(main_header);
899 if(labels[iframe] == 0)
901 cpl_msg_error(__func__,
"Frame %d does not contain the star in any "
902 "detector", iframe + 1);
918 (
const cpl_vector *
self,
const cpl_vector * valid)
920 double max_val = DBL_MIN;
925 nvals = cpl_vector_get_size(
self);
926 for(ival = 0; ival < nvals; ++ival)
928 if(cpl_vector_get(valid, ival) >= -0.5)
932 max_val = cpl_vector_get(
self, ival);
935 if(cpl_vector_get(
self, ival) > max_val)
936 max_val = cpl_vector_get(
self, ival);
952 (
const cpl_vector *
self,
const cpl_vector * valid)
954 double min_val = DBL_MAX;
959 nvals = cpl_vector_get_size(
self);
960 for(ival = 0; ival < nvals; ++ival)
962 if(cpl_vector_get(valid, ival) >= -0.5)
966 min_val = cpl_vector_get(
self, ival);
969 if(cpl_vector_get(
self, ival) < min_val)
970 min_val = cpl_vector_get(
self, ival);
989 cpl_bivector * hist ;
990 cpl_vector * hist_x ;
991 cpl_vector * hist_y ;
1000 if (vec == NULL)
return -1.0 ;
1003 nb = cpl_vector_get_size(vec) ;
1007 min = cpl_vector_get_min(vec) ;
1008 max = cpl_vector_get_max(vec) ;
1009 bin_size = (max-min)/nbins ;
1010 hist = cpl_bivector_new(nbins) ;
1011 hist_x = cpl_bivector_get_x(hist) ;
1012 hist_y = cpl_bivector_get_y(hist) ;
1013 cpl_vector_fill(hist_x, 0.0) ;
1014 cpl_vector_fill(hist_y, 0.0) ;
1015 for (i=0 ; i<nbins ; i++) {
1016 cpl_vector_set(hist_x, i, min + i * bin_size) ;
1018 for (i=0 ; i<nb ; i++) {
1019 cur_val = cpl_vector_get(vec, i) ;
1020 cur_bin = (int)((cur_val - min) / bin_size) ;
1021 if (cur_bin >= nbins) cur_bin -= 1.0 ;
1022 cur_val = cpl_vector_get(hist_y, cur_bin) ;
1024 cpl_vector_set(hist_y, cur_bin, cur_val) ;
1028 max_val = cpl_vector_get(hist_y, 0) ;
1030 for (i=0 ; i<nbins ; i++) {
1031 cur_val = cpl_vector_get(hist_y, i) ;
1032 if (cur_val > max_val) {
1037 mode = cpl_vector_get(hist_x, max_bin) ;
1038 cpl_bivector_delete(hist) ;
1052 (cpl_frameset * frames,
double (*func)(
const cpl_propertylist *))
1057 if(cpl_frameset_get_size(frames) < 2)
1060 for(iframe = 0; iframe < cpl_frameset_get_size(frames); ++iframe)
1062 cpl_propertylist * header;
1063 header = cpl_propertylist_load(
1064 cpl_frame_get_filename(
1065 cpl_frameset_get_frame_const(frames, iframe)),0);
1067 value = (func)(header);
1069 if(value != (func)(header))
1071 cpl_propertylist_delete(header);
1074 cpl_propertylist_delete(header);
1089 (cpl_frameset * frames,
int (*func)(
const cpl_propertylist *))
1094 if(cpl_frameset_get_size(frames) < 2)
1097 for(iframe = 0; iframe < cpl_frameset_get_size(frames); ++iframe)
1099 cpl_propertylist * header;
1100 header = cpl_propertylist_load(
1101 cpl_frame_get_filename(
1102 cpl_frameset_get_frame_const(frames, iframe)),0);
1104 value = (func)(header);
1106 if(value != (func)(header))
1108 cpl_propertylist_delete(header);
1111 cpl_propertylist_delete(header);
1145 ra = fmod(ra, 360.0);
1156 b = (a - (double)hours) * 60.0;
1160 seconds = (b - (double)minutes) * 60.0;
1162 if (seconds > 59.99)
1165 minutes = minutes + 1;
1173 (void) sprintf (tstring,
"%02d:%02d:%05.2f",hours,minutes,seconds);
1176 ltstr = (int) strlen (tstring);
1177 if (ltstr < length_str-1)
1178 strcpy (str, tstring);
1181 strncpy (str, tstring, length_str-1);
1182 str[length_str-1] = 0;
1200 double a, b, dsgn, deg1;
1217 deg1 = fmod(deg1, 360.0);
1220 deg1 = deg1 + 360.0;
1237 b = (a - (double)degrees) * 60.0;
1241 seconds = (b - (double)minutes) * 60.0;
1243 if (seconds > 59.99)
1246 minutes = minutes + 1;
1251 degrees = degrees + 1;
1253 (void) sprintf (tstring,
"%c%02d:%02d:%05.2f",sign,degrees,minutes,seconds);
1256 ltstr = (int) strlen (tstring);
1257 if (ltstr < length_str-1)
1258 strcpy (str, tstring);
1261 strncpy (str, tstring, length_str-1);
1262 str[length_str-1] = 0;
1281 nframes = cpl_frameset_get_size(other);
1283 for(iframe = 0; iframe<nframes; ++iframe)
1285 cpl_frame * newframe;
1286 newframe = cpl_frame_duplicate
1287 (cpl_frameset_get_frame_const(other, iframe));
1288 if(cpl_frameset_insert(
self, newframe) != CPL_ERROR_NONE)
1290 cpl_error_set(cpl_func, CPL_ERROR_ILLEGAL_INPUT);
1291 return CPL_ERROR_ILLEGAL_INPUT;
1294 return CPL_ERROR_NONE;