34#include "kmo_functions.h"
35#include "kmo_priv_reconstruct.h"
36#include "kmo_priv_functions.h"
37#include "kmo_priv_lcorr.h"
38#include "kmo_cpl_extensions.h"
42#include "kmo_constants.h"
49static int kmos_reconstruct_check_inputs(cpl_frameset *,
const char *);
51static int kmos_reconstruct_create(cpl_plugin *);
52static int kmos_reconstruct_exec(cpl_plugin *);
53static int kmos_reconstruct_destroy(cpl_plugin *);
54static int kmos_reconstruct(cpl_parameterlist *, cpl_frameset *);
60static char kmos_reconstruct_description[] =
61"Data with or without noise is reconstructed into a cube using X/Y/LCAL, YCAL\n"
62"The input data can contain noise extensions and will be reconstructed into\n"
63"additional extensions.\n"
64"If an OH spectrum is given in the SOF file the lambda axis will be corrected\n"
65"using the OH lines as reference.\n"
67"---------------------------------------------------------------------------\n"
71" category Type Explanation Required #Frames\n"
72" -------- ----- ----------- -------- -------\n"
73" DARK or RAW/F2D data with Y 1 \n"
74" FLAT_ON or RAW/F2D or without noise \n"
75" ARC_ON or RAW/F2D \n"
80" XCAL F2D x-direction calib. frame Y 1 \n"
81" YCAL F2D y-direction calib. frame Y 1 \n"
82" LCAL F2D Wavelength calib. frame Y 1 \n"
83" WAVE_BAND F2L Table with start-/end-wavelengths Y 1 \n"
84" OH_SPEC F1S Vector holding OH lines N 1 \n"
89" category Type Explanation\n"
90" -------- ----- -----------\n"
91" CUBE_DARK or F3I Reconstructed cube \n"
92" CUBE_FLAT or RAW/F2D with or without noise\n"
97"---------------------------------------------------------------------------\n"
124 cpl_recipe *recipe = cpl_calloc(1,
sizeof *recipe);
125 cpl_plugin *plugin = &recipe->interface;
127 cpl_plugin_init(plugin,
130 CPL_PLUGIN_TYPE_RECIPE,
132 "Performs the cube reconstruction",
133 kmos_reconstruct_description,
134 "Alex Agudo Berbel, Y. Jung",
135 "https://support.eso.org/",
137 kmos_reconstruct_create,
138 kmos_reconstruct_exec,
139 kmos_reconstruct_destroy);
141 cpl_pluginlist_append(list, plugin);
155static int kmos_reconstruct_create(cpl_plugin *plugin)
161 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
162 recipe = (cpl_recipe *)plugin;
167 recipe->parameters = cpl_parameterlist_new();
171 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.imethod",
173 "Method to use for interpolation. [\"NN\" (nearest neighbour), "
174 "\"lwNN\" (linear weighted nearest neighbor), "
175 "\"swNN\" (square weighted nearest neighbor), "
176 "\"MS\" (Modified Shepard's method)"
177 "\"CS\" (Cubic spline)]",
178 "kmos.kmos_reconstruct",
"CS");
179 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"imethod");
180 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
181 cpl_parameterlist_append(recipe->parameters, p);
184 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.neighborhoodRange",
186 "Defines the range to search for neighbors. in pixels",
187 "kmos.kmos_reconstruct", 1.001);
188 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"neighborhoodRange");
189 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
190 cpl_parameterlist_append(recipe->parameters, p);
193 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.flux", CPL_TYPE_BOOL,
194 "TRUE: Apply flux conservation. FALSE: otherwise",
195 "kmos.kmos_reconstruct", FALSE);
196 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"flux");
197 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
198 cpl_parameterlist_append(recipe->parameters, p);
201 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.detectorimage",
203 "TRUE: if resampled detector frame should be "
204 "created, FALSE: otherwise",
205 "kmos.kmos_reconstruct", FALSE);
206 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"detimg");
207 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
208 cpl_parameterlist_append(recipe->parameters, p);
211 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.file_extension",
213 "TRUE: if OBS_ID keyword should be appended to "
214 "output frames, FALSE: otherwise",
215 "kmos.kmos_reconstruct", FALSE);
216 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"file_extension");
217 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
218 cpl_parameterlist_append(recipe->parameters, p);
221 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.pix_scale",
223 "Change the pixel scale [arcsec]. "
224 "Default of 0.2\" results into cubes of 14x14pix, "
225 "a scale of 0.1\" results into cubes of 28x28pix, etc.",
226 "kmos.kmos_reconstruct", KMOS_PIX_RESOLUTION);
227 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"pix_scale");
228 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
229 cpl_parameterlist_append(recipe->parameters, p);
232 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.xcal_interpolation",
234 "TRUE: Interpolate xcal between rotator angles. FALSE: otherwise",
235 "kmos.kmos_reconstruct", TRUE);
236 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"xcal_interpolation");
237 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
238 cpl_parameterlist_append(recipe->parameters, p);
241 p = cpl_parameter_new_value(
"kmos.kmos_reconstruct.lcmethod",
243 "Method to use for the level correction "
244 "[\"NONE\" (no correction), "
245 "\"OSCAN\" (overscan)]",
246 "kmos.kmos_reconstruct",
"NONE");
247 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"lcmethod");
248 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
249 cpl_parameterlist_append(recipe->parameters, p);
252 kmos_band_pars_create(recipe->parameters,
"kmos.kmos_reconstruct");
263static int kmos_reconstruct_exec(cpl_plugin *plugin)
268 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
269 recipe = (cpl_recipe *)plugin;
272 return kmos_reconstruct(recipe->parameters, recipe->frames);
282static int kmos_reconstruct_destroy(cpl_plugin *plugin)
287 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
288 recipe = (cpl_recipe *)plugin;
291 cpl_parameterlist_delete(recipe->parameters);
309static int kmos_reconstruct(cpl_parameterlist *parlist, cpl_frameset *frameset)
311 const cpl_parameter * par ;
312 const char * imethod ;
313 const char * lcmethod ;
314 int flux, detectorimage, xcal_interpolation,
316 double neighborhoodRange, pix_scale, scaling ;
317 cpl_frame * input_frame ;
318 cpl_frame * xcal_frame ;
319 cpl_frame * ycal_frame ;
320 cpl_frame * lcal_frame ;
321 cpl_frame * ref_spectrum_frame ;
322 float * pdet_img_data ;
323 float * pdet_img_noise ;
325 const char * input_frame_name ;
326 const char * output_frame_name ;
327 const char * filter_id ;
333 cpl_image * det_img_data ;
334 cpl_image * det_img_noise;
335 cpl_image * tmp_img ;
336 cpl_imagelist * cube_data ;
337 cpl_imagelist * cube_noise ;
338 cpl_propertylist * main_header ;
339 cpl_propertylist * sub_header ;
340 cpl_propertylist * tmp_header ;
341 cpl_table * band_table ;
343 cpl_polynomial * lcorr_coeffs ;
344 main_fits_desc desc1 ;
345 int i, j, index, ifu_nr, detImgCube, l, x, y ;
351 if (parlist == NULL || frameset == NULL) {
352 cpl_msg_error(__func__,
"Null Inputs") ;
353 cpl_error_set(__func__, CPL_ERROR_NULL_INPUT) ;
358 par = cpl_parameterlist_find_const(parlist,
"kmos.kmos_reconstruct.imethod");
359 imethod = cpl_parameter_get_string(par) ;
360 par=cpl_parameterlist_find_const(parlist,
"kmos.kmos_reconstruct.lcmethod");
361 lcmethod = cpl_parameter_get_string(par) ;
362 par = cpl_parameterlist_find_const(parlist,
"kmos.kmos_reconstruct.flux");
363 flux = cpl_parameter_get_bool(par);
364 par = cpl_parameterlist_find_const(parlist,
365 "kmos.kmos_reconstruct.detectorimage");
366 detectorimage = cpl_parameter_get_bool(par);
367 par = cpl_parameterlist_find_const(parlist,
368 "kmos.kmos_reconstruct.neighborhoodRange");
369 neighborhoodRange = cpl_parameter_get_double(par) ;
370 kmos_band_pars_load(parlist,
"kmos.kmos_reconstruct");
371 par = cpl_parameterlist_find_const(parlist,
372 "kmos.kmos_reconstruct.file_extension");
373 file_extension = cpl_parameter_get_bool(par);
374 par = cpl_parameterlist_find_const(parlist,
375 "kmos.kmos_reconstruct.pix_scale");
376 pix_scale = cpl_parameter_get_double(par) ;
377 par = cpl_parameterlist_find_const(parlist,
378 "kmos.kmos_reconstruct.xcal_interpolation");
379 xcal_interpolation = cpl_parameter_get_bool(par);
382 if (strcmp(imethod,
"NN") && strcmp(imethod,
"lwNN") &&
383 strcmp(imethod,
"swNN") && strcmp(imethod,
"MS") &&
384 strcmp(imethod,
"CS")) {
385 cpl_msg_error(__func__,
386 "imethod must be 'NN','lwNN','swNN','MS' or 'CS'") ;
387 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
392 if (strcmp(lcmethod,
"OSCAN") && strcmp(lcmethod,
"NONE")) {
393 cpl_msg_error(__func__,
394 "lcmethod must be 'OSCAN' or 'NONE'") ;
395 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
399 if (neighborhoodRange <= 0.0) {
400 cpl_msg_error(__func__,
401 "neighborhoodRange must be greater than 0.0") ;
402 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
405 if (pix_scale < 0.01 || pix_scale > 0.4) {
406 cpl_msg_error(__func__,
"pix_scale must be between 0.01 and 0.4");
407 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
412 if (kmo_dfs_set_groups(frameset) != 1) {
413 cpl_msg_error(__func__,
"Cannot identify RAW and CALIB frames") ;
414 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
419 if (cpl_frameset_count_tags(frameset, DARK) == 1) {
420 input_frame_name = DARK;
421 output_frame_name = CUBE_DARK;
422 }
else if (cpl_frameset_count_tags(frameset, FLAT_ON) == 1) {
423 input_frame_name = FLAT_ON;
424 output_frame_name = CUBE_FLAT;
425 }
else if (cpl_frameset_count_tags(frameset, ARC_ON) == 1) {
426 input_frame_name = ARC_ON;
427 output_frame_name = CUBE_ARC;
428 }
else if (cpl_frameset_count_tags(frameset, OBJECT) == 1) {
429 input_frame_name = OBJECT;
430 output_frame_name = CUBE_OBJECT;
431 }
else if (cpl_frameset_count_tags(frameset, ACQUISITION) == 1) {
432 input_frame_name = ACQUISITION;
433 output_frame_name = CUBE_ACQUISITION;
434 }
else if (cpl_frameset_count_tags(frameset, STD) == 1) {
435 input_frame_name = STD;
436 output_frame_name = CUBE_STD;
437 }
else if (cpl_frameset_count_tags(frameset, SCIENCE) == 1) {
438 input_frame_name = SCIENCE;
439 output_frame_name = CUBE_SCIENCE;
440 }
else if (cpl_frameset_count_tags(frameset, ACQUISITION) == 1) {
441 input_frame_name = SCIENCE;
442 output_frame_name = CUBE_SCIENCE;
444 cpl_msg_error(__func__,
"Missing Inputs") ;
445 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
450 if (kmos_reconstruct_check_inputs(frameset, input_frame_name) != 1) {
451 cpl_msg_error(__func__,
"Input frameset is not consistent") ;
452 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
457 input_frame = kmo_dfs_get_frame(frameset, input_frame_name);
458 suffix = kmo_dfs_get_suffix(input_frame, TRUE, TRUE);
459 cpl_msg_info(__func__,
"Detected instrument setup: %s", suffix+1);
463 xcal_frame = kmo_dfs_get_frame(frameset, XCAL);
464 ycal_frame = kmo_dfs_get_frame(frameset, YCAL) ;
465 lcal_frame = kmo_dfs_get_frame(frameset, LCAL) ;
466 ref_spectrum_frame = kmo_dfs_get_frame(frameset, OH_SPEC) ;
469 main_header = kmo_dfs_load_primary_header(frameset, input_frame_name);
472 if (file_extension) {
473 obs_suffix = cpl_sprintf(
"_%d",
474 cpl_propertylist_get_int(main_header, OBS_ID));
476 obs_suffix = cpl_sprintf(
"%s",
"");
480 kmo_dfs_save_main_header(frameset, output_frame_name, obs_suffix,
481 input_frame, NULL, parlist, cpl_func);
484 if (detectorimage == TRUE)
485 kmo_dfs_save_main_header(frameset, DET_IMG_REC, obs_suffix,
486 input_frame, NULL, parlist, cpl_func);
489 kmclipm_setup_grid(&gd, imethod, neighborhoodRange, pix_scale, 0.);
492 tmp_header = kmo_dfs_load_primary_header(frameset, XCAL);
493 bounds = kmclipm_extract_bounds(tmp_header);
494 cpl_propertylist_delete(tmp_header);
496 kmo_init_fits_desc(&desc1);
497 desc1 = kmo_identify_fits_header(cpl_frame_get_filename(input_frame));
500 for (i = 1; i <= KMOS_NR_DETECTORS; i++) {
501 cpl_msg_info(
"",
"Processing detector No. %d", i);
505 print_cal_angle_msg_once = FALSE;
506 print_xcal_angle_msg_once = FALSE;
508 print_cal_angle_msg_once = TRUE;
509 print_xcal_angle_msg_once = TRUE;
513 keyword = cpl_sprintf(
"%s%d%s", IFU_FILTID_PREFIX,i,IFU_FILTID_POSTFIX);
514 filter_id = cpl_propertylist_get_string(main_header, keyword);
518 band_table = kmo_dfs_load_table(frameset, WAVE_BAND, 1, FALSE);
519 kmclipm_setup_grid_band_lcal(&gd, filter_id, band_table);
520 cpl_table_delete(band_table);
524 det_img_data = cpl_image_new(
525 gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR, gd.l.dim,
527 pdet_img_data = cpl_image_get_data_float(det_img_data);
529 det_img_noise = cpl_image_new(
530 gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR, gd.l.dim,
532 pdet_img_noise = cpl_image_get_data_float(det_img_noise);
536 for (j = 0; j < KMOS_IFUS_PER_DETECTOR; j++) {
537 ifu_nr = (i-1)*KMOS_IFUS_PER_DETECTOR + j + 1;
540 sub_header = kmo_dfs_load_sub_header(frameset, input_frame_name,
544 if (bounds[2*(ifu_nr-1)] != -1 && bounds[2*(ifu_nr-1)+1] != -1) {
548 kmo_calc_wcs_gd(main_header, sub_header, ifu_nr, gd);
549 kmclipm_update_property_int(sub_header, NAXIS, 3,
550 "number of data axes");
551 kmclipm_update_property_int(sub_header, NAXIS1,
552 gd.x.dim,
"length of data axis 1");
553 kmclipm_update_property_int(sub_header, NAXIS2,
554 gd.y.dim,
"length of data axis 2");
555 kmclipm_update_property_int(sub_header, NAXIS3,
556 gd.l.dim,
"length of data axis 3");
559 kmo_reconstruct_sci(ifu_nr, bounds[2*(ifu_nr-1)],
560 bounds[2*(ifu_nr-1)+1], input_frame, input_frame_name,
561 NULL, NULL, NULL, NULL, xcal_frame, ycal_frame,
562 lcal_frame, NULL, NULL, &gd, &cube_data, &cube_noise,
563 flux, 0, xcal_interpolation, lcmethod);
566 if (ref_spectrum_frame != NULL && cube_data != NULL) {
567 lcorr_coeffs = kmo_lcorr_get(cube_data, sub_header,
568 ref_spectrum_frame, gd, filter_id, ifu_nr);
569 cpl_imagelist_delete(cube_data);
570 if (cube_noise != NULL) cpl_imagelist_delete(cube_noise);
571 kmo_reconstruct_sci(ifu_nr, bounds[2*(ifu_nr-1)],
572 bounds[2*(ifu_nr-1)+1], input_frame,
573 input_frame_name, NULL, NULL, NULL, NULL,
574 xcal_frame, ycal_frame, lcal_frame, lcorr_coeffs,
575 NULL, &gd, &cube_data, &cube_noise, flux, 0,
576 xcal_interpolation, lcmethod);
577 cpl_polynomial_delete(lcorr_coeffs);
581 tmp_img = cpl_imagelist_get(cube_data, 0);
582 scaling = (cpl_image_get_size_x(tmp_img)*
583 cpl_image_get_size_y(tmp_img)) /
584 (KMOS_SLITLET_X*KMOS_SLITLET_Y);
585 cpl_imagelist_divide_scalar(cube_data, scaling);
586 if (cube_noise != NULL)
587 cpl_imagelist_divide_scalar(cube_noise, scaling);
590 cube_data = cube_noise = NULL ;
595 if (cube_data != NULL) {
596 for (l = 0; l < gd.l.dim; l++) {
597 slice = cpl_image_get_data_float(
598 cpl_imagelist_get(cube_data, l));
599 for (y = 0; y < gd.y.dim; y++) {
600 for (x = 0; x < gd.x.dim; x++) {
603 j* gd.x.dim*gd.y.dim +
604 l* gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR;
605 pdet_img_data[ix] = slice[x + y*gd.x.dim];
610 if (cube_noise != NULL) {
612 for (l = 0; l < gd.l.dim; l++) {
613 slice = cpl_image_get_data_float(
614 cpl_imagelist_get(cube_noise, l));
615 for (y = 0; y < gd.y.dim; y++) {
616 for (x = 0; x < gd.x.dim; x++) {
619 j* gd.x.dim*gd.y.dim +
620 l* gd.x.dim*gd.y.dim*KMOS_IFUS_PER_DETECTOR;
621 pdet_img_noise[ix] = slice[x + y*gd.x.dim];
629 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_DATA);
630 kmclipm_update_property_string(sub_header, EXTNAME, extname,
631 "FITS extension name");
633 kmo_dfs_save_cube(cube_data, output_frame_name, obs_suffix,
637 if (cube_noise != NULL) {
638 extname = kmo_extname_creator(ifu_frame, ifu_nr, EXT_NOISE);
639 kmclipm_update_property_string(sub_header, EXTNAME,
640 extname,
"FITS extension name");
642 kmo_dfs_save_cube(cube_noise, output_frame_name, obs_suffix,
646 cpl_imagelist_delete(cube_data);
647 if (cube_noise != NULL) cpl_imagelist_delete(cube_noise);
648 cpl_propertylist_delete(sub_header);
654 index = kmo_identify_index(cpl_frame_get_filename(input_frame), i,
657 tmp_header = kmclipm_propertylist_load(
658 cpl_frame_get_filename(input_frame), index);
660 kmo_save_det_img_ext(det_img_data, gd, i, DET_IMG_REC,
661 obs_suffix, tmp_header, FALSE, FALSE);
662 cpl_image_delete(det_img_data);
664 cpl_propertylist_delete(tmp_header);
670 if (desc1.ex_noise) {
671 index = kmo_identify_index(
672 cpl_frame_get_filename(input_frame), i, TRUE);
674 tmp_header = kmclipm_propertylist_load(
675 cpl_frame_get_filename(input_frame), index);
677 kmo_save_det_img_ext(det_img_noise, gd, i, DET_IMG_REC,
678 obs_suffix, tmp_header, FALSE, TRUE);
680 cpl_propertylist_delete(tmp_header);
682 if (det_img_noise) cpl_image_delete(det_img_noise);
685 cpl_propertylist_delete(main_header);
686 cpl_free(obs_suffix);
687 kmo_free_fits_desc(&desc1);
703static int kmos_reconstruct_check_inputs(
704 cpl_frameset * frameset,
705 const char * input_frame_name)
707 cpl_propertylist * lcal_header ;
708 cpl_propertylist * input_header ;
709 int nb_xcal, nb_ycal, nb_lcal, nb_oh_spec ;
711 const char * filter_id ;
712 const char * filter_id_tmp ;
716 if (frameset == NULL || input_frame_name == NULL)
return -1;
719 if (cpl_frameset_count_tags(frameset, DARK) != 1 &&
720 cpl_frameset_count_tags(frameset, FLAT_ON) != 1 &&
721 cpl_frameset_count_tags(frameset, ARC_ON) != 1 &&
722 cpl_frameset_count_tags(frameset, OBJECT) != 1 &&
723 cpl_frameset_count_tags(frameset, ACQUISITION) != 1 &&
724 cpl_frameset_count_tags(frameset, STD) != 1 &&
725 cpl_frameset_count_tags(frameset, SCIENCE) != 1) {
726 cpl_msg_error(__func__,
"1 data frame must be provided") ;
727 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
730 nb_xcal = cpl_frameset_count_tags(frameset, XCAL) ;
731 nb_ycal = cpl_frameset_count_tags(frameset, YCAL) ;
732 nb_lcal = cpl_frameset_count_tags(frameset, LCAL) ;
733 if (nb_xcal != 1 || nb_ycal != 1 || nb_lcal != 1) {
734 cpl_msg_error(__func__,
"Exactly 1 XCAL/YCAL/LCAL expected") ;
735 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
738 if (cpl_frameset_count_tags(frameset, WAVE_BAND) != 1) {
739 cpl_msg_error(__func__,
"Missing WAVE_BAND") ;
740 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
743 nb_oh_spec = cpl_frameset_count_tags(frameset, OH_SPEC) ;
744 if (nb_oh_spec != 0 && nb_oh_spec != 1) {
745 cpl_msg_error(__func__,
"Only 1 reference spectrum can be provided") ;
746 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
751 kmo_check_frame_setup(frameset, XCAL, YCAL, TRUE, FALSE, TRUE);
752 kmo_check_frame_setup(frameset, XCAL, LCAL, TRUE, FALSE, TRUE);
753 if (nb_oh_spec == 1) kmo_check_oh_spec_setup(frameset, XCAL);
755 if (cpl_frameset_count_tags(frameset, DARK) != 1) {
756 kmo_check_frame_setup(frameset, XCAL, input_frame_name, TRUE, FALSE,
759 kmo_check_frame_setup_md5_xycal(frameset);
760 kmo_check_frame_setup_md5(frameset);
763 input_header = kmo_dfs_load_primary_header(frameset, input_frame_name);
764 lcal_header = kmo_dfs_load_primary_header(frameset, LCAL);
765 for (i = 1; i <= KMOS_NR_DETECTORS; i++) {
767 keyword = cpl_sprintf(
"%s%d%s", IFU_FILTID_PREFIX,i,IFU_FILTID_POSTFIX);
768 filter_id = cpl_propertylist_get_string(lcal_header, keyword);
769 if (strcmp(filter_id,
"IZ") && strcmp(filter_id,
"YJ") &&
770 strcmp(filter_id,
"H") && strcmp(filter_id,
"K") &&
771 strcmp(filter_id,
"HK")) {
773 cpl_propertylist_delete(input_header) ;
774 cpl_propertylist_delete(lcal_header) ;
775 cpl_msg_error(__func__,
"LCAL Filter ID must be IZ, YJ, H, HK or K");
776 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
781 if (!strcmp(input_frame_name, DARK)) {
782 filter_id_tmp = cpl_propertylist_get_string(input_header, keyword);
783 if (strcmp(filter_id, filter_id_tmp)) {
785 cpl_propertylist_delete(input_header) ;
786 cpl_propertylist_delete(lcal_header) ;
787 cpl_msg_error(__func__,
"Filter mismatch");
788 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT) ;
794 cpl_propertylist_delete(input_header) ;
795 cpl_propertylist_delete(lcal_header) ;
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.