UVES Pipeline Reference Manual  5.4.6
uves_pfits.c
1 /*
2  * This file is part of the UVES Pipeline
3  * Copyright (C) 2002, 2003, 2004, 2005 Europpean Southern Observatory
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
18  */
19 
20 /*
21  * $Author: amodigli $
22  * $Date: 2013-04-16 15:46:38 $
23  * $Revision: 1.110 $
24  * $Name: not supported by cvs2svn $
25  */
26 
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
30 
31 /*----------------------------------------------------------------------------*/
37 /*----------------------------------------------------------------------------*/
40 /*-----------------------------------------------------------------------------
41  Defines
42  -----------------------------------------------------------------------------*/
43 
44 /*-----------------------------------------------------------------------------
45  Includes
46  -----------------------------------------------------------------------------*/
47 #include <stdio.h>
48 #include <uves_pfits.h>
49 
50 #include <uves_utils.h>
51 #include <uves_utils_wrappers.h>
52 #include <uves_dump.h>
53 #include <uves_error.h>
54 
55 #include <irplib_utils.h>
56 
57 #include <cpl.h>
58 
59 #include <stdio.h>
60 #include <stdbool.h>
61 #include <errno.h>
62 #include <string.h>
63 /*-----------------------------------------------------------------------------
64  Forward declarations
65  -----------------------------------------------------------------------------*/
66 
67 /*-----------------------------------------------------------------------------
68  Function codes
69  -----------------------------------------------------------------------------*/
70 
71 
72 /*--------------------------------------------------------------------------- */
78 /*--------------------------------------------------------------------------- */
79 void uves_pfits_set_cd1(uves_propertylist * plist, double value)
80 {
81  check(uves_propertylist_update_double (plist, UVES_CD1, value),
82  "Error writing keyword '%s'", UVES_CD1);
83  cleanup:
84  return;
85 }
86 
87 
88 /*--------------------------------------------------------------------------- */
94 /*--------------------------------------------------------------------------- */
95 void uves_pfits_set_cd11(uves_propertylist * plist, double value)
96 {
97  check(uves_propertylist_update_double (plist, UVES_CD11, value),
98  "Error writing keyword '%s'", UVES_CD11);
99  cleanup:
100  return;
101 }
102 
103 /*--------------------------------------------------------------------------- */
109 /*--------------------------------------------------------------------------- */
110 void uves_pfits_set_cd12(uves_propertylist * plist, double value)
111 {
112  check(uves_propertylist_update_double (plist, UVES_CD12, value),
113  "Error writing keyword '%s'", UVES_CD12);
114  cleanup:
115  return;
116 }
117 
118 /*--------------------------------------------------------------------------- */
124 /*--------------------------------------------------------------------------- */
125 void uves_pfits_set_cd21(uves_propertylist * plist, double value)
126 {
127  check(uves_propertylist_update_double (plist, UVES_CD21, value),
128  "Error writing keyword '%s'", UVES_CD21);
129  cleanup:
130  return;
131 }
132 
133 /*--------------------------------------------------------------------------- */
139 /*--------------------------------------------------------------------------- */
140 void uves_pfits_set_cd22(uves_propertylist * plist, double value)
141 {
142  check(uves_propertylist_update_double (plist, UVES_CD22, value),
143  "Error writing keyword '%s'", UVES_CD22);
144  cleanup:
145  return;
146 }
147 
148 
149 /*----------------------------------------------------------------------------*/
155 /*----------------------------------------------------------------------------*/
157 {
158  int result=0;
159  check(result=uves_propertylist_get_int(plist,UVES_ENCODER_REF1),
160  "Error getting %s", UVES_ENCODER_REF1);
161 
162  cleanup:
163  return result;
164 
165 }
166 
167 /*----------------------------------------------------------------------------*/
173 /*----------------------------------------------------------------------------*/
175 {
176  int result=0;
177  check(result=uves_propertylist_get_int(plist,UVES_ENCODER_REF2),
178  "Error getting %s",UVES_ENCODER_REF2);
179 
180 
181  cleanup:
182  return result;
183 
184 }
185 
186 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
194 {
195  int result=0;
196  check(uves_get_property_value(plist, "MAXFIBRES",
197  CPL_TYPE_INT, &result),
198  "Error reading MAXFIBRES");
199 
200  cleanup:
201  return result;
202 
203 }
204 
205 /*----------------------------------------------------------------------------*/
211 /*----------------------------------------------------------------------------*/
213 {
214  char result=0;
215  check(result=uves_propertylist_get_char(plist,"CHIPCHOICE"),
216  "Error getting CHIPCHOICE");
217 
218  cleanup:
219  return result;
220 
221 }
222 /*----------------------------------------------------------------------------*/
228 /*----------------------------------------------------------------------------*/
229 const char * uves_pfits_get_badpxframe(const uves_propertylist * plist)
230 {
231 
232  const char* result=NULL;
233 
234  check(uves_get_property_value(plist, "BADPXFRAME",
235  CPL_TYPE_STRING, &result),
236  "Error reading BADPXFRAME");
237 
238  cleanup:
239  return result;
240 
241 }
242 
243 
244 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
252 {
253  double result=0;
254 
255  check(uves_get_property_value(plist, "ESO INS SENS26 MEAN",
256  CPL_TYPE_DOUBLE, &result),
257  "Error reading ESO INS SENS26 MEAN");
258 
259  cleanup:
260  return result;
261 
262 }
263 
264 
265 /*---------------------------------------------------------------------------*/
271 /*---------------------------------------------------------------------------*/
272 const char * uves_pfits_get_arcfile(const uves_propertylist * plist)
273 {
274 
275  const char* result=NULL;
276 
277 
278  check(uves_get_property_value(plist, "ARCFILE",
279  CPL_TYPE_STRING, &result),
280  "Error reading ARCFILE");
281 
282  cleanup:
283  return result;
284 
285 }
286 
287 /*---------------------------------------------------------------------------*/
293 /*---------------------------------------------------------------------------*/
295 {
296 
297  const char* result=NULL;
298 
299  check(result=uves_propertylist_get_string(plist,"IDENT"),
300  "Error getting IDENT");
301 
302  cleanup:
303  return result;
304 
305 }
306 
307 /*---------------------------------------------------------------------------*/
313 /*---------------------------------------------------------------------------*/
315 {
316 
317  const char* result=NULL;
318 
319  check(result=uves_propertylist_get_string(plist,UVES_OBJECT),
320  "Error getting OBJECT");
321 
322  cleanup:
323  return result;
324 
325 }
326 
327 /*---------------------------------------------------------------------------*/
333 /*---------------------------------------------------------------------------*/
334 const char * uves_pfits_get_origfile(const uves_propertylist * plist)
335 {
336 
337  const char* result=NULL;
338 
339  check(uves_get_property_value(plist, "ORIGFILE",
340  CPL_TYPE_STRING, &result),
341  "Error reading ORIGFILE");
342 
343  cleanup:
344  return result;
345 
346 }
347 
348 /*----------------------------------------------------------------------------*/
354 /*----------------------------------------------------------------------------*/
355 const char * uves_pfits_get_pipefile(const uves_propertylist * plist)
356 {
357 
358  const char* result=NULL;
359 
360 
361  check(uves_get_property_value(plist, "PIPEFILE",
362  CPL_TYPE_STRING, &result),
363  "Error reading PIPEFILE");
364 
365  cleanup:
366  return result;
367 
368 }
369 
370 
371 
372 
373 /*----------------------------------------------------------------------------*/
379 /*----------------------------------------------------------------------------*/
381 {
382  const char* result=NULL;
383 
384  check(uves_get_property_value(plist, "ESO PRO REC1 RAW1 NAME",
385  CPL_TYPE_STRING, &result),
386  "Error reading ESO PRO REC1 RAW1 NAME");
387 
388 
389  cleanup:
390  return result;
391 }
392 /*----------------------------------------------------------------------------*/
398 /*----------------------------------------------------------------------------*/
399 const char * uves_pfits_get_templateid(const uves_propertylist * plist)
400 {
401  const char* result=NULL;
402 
403  check(uves_get_property_value(plist, "ESO TPL ID",
404  CPL_TYPE_STRING, &result),
405  "Error reading ESO TPL ID");
406 
407 
408  cleanup:
409 
410  return result;
411 }
412 
413 
414 /*----------------------------------------------------------------------------*/
420 /*----------------------------------------------------------------------------*/
421 const char * uves_pfits_get_date_obs(const uves_propertylist * plist)
422 {
423 
424  const char* result=NULL;
425  check(uves_get_property_value(plist, "DATE-OBS",
426  CPL_TYPE_STRING, &result),
427  "Error reading DATE-OBS");
428 
429  cleanup:
430  return result;
431 
432 }
433 /*----------------------------------------------------------------------------*/
439 /*----------------------------------------------------------------------------*/
440 const char * uves_pfits_get_dpr_catg(const uves_propertylist * plist)
441 {
442  const char* result=NULL;
443 
444  check(uves_get_property_value(plist, UVES_DPR_CATG,
445  CPL_TYPE_STRING, &result),
446  "Error reading %s", UVES_DPR_CATG);
447 
448  cleanup:
449  return result;
450 }
451 
452 /*----------------------------------------------------------------------------*/
458 /*----------------------------------------------------------------------------*/
460 {
461  int returnvalue = 0;
462 
463  check( uves_get_property_value(plist, UVES_OCS_SIMCAL, CPL_TYPE_INT, &returnvalue),
464  "Error reading keyword '%s'", UVES_OCS_SIMCAL);
465 
466  cleanup:
467  return returnvalue;
468 }
469 
470 /*----------------------------------------------------------------------------*/
476 /*----------------------------------------------------------------------------*/
478 {
479  check( uves_propertylist_update_int(plist, UVES_OCS_SIMCAL, simcal),
480  "Error writing keyword '%s'", UVES_OCS_SIMCAL);
481 
482  cleanup:
483  return;
484 
485 }
486 
487 /*----------------------------------------------------------------------------*/
493 /*----------------------------------------------------------------------------*/
494 const char * uves_pfits_get_pro_catg(const uves_propertylist * plist)
495 {
496  const char* result=NULL;
497 
498  check(uves_get_property_value(plist, "ESO PRO CATG",
499  CPL_TYPE_STRING, &result),
500  "Error reading ESO PRO CATG");
501 
502  cleanup:
503  return result;
504 }
505 
506 /*----------------------------------------------------------------------------*/
512 /*----------------------------------------------------------------------------*/
513 const char * uves_pfits_get_dpr_tech(const uves_propertylist * plist)
514 {
515  const char* result=NULL;
516 
517  check( uves_get_property_value(plist, UVES_DPR_TECH,
518  CPL_TYPE_STRING, &result),
519  "Error reading %s", UVES_DPR_TECH);
520 
521  cleanup:
522  return result;
523 }
524 
525 /*----------------------------------------------------------------------------*/
531 /*----------------------------------------------------------------------------*/
532 const char * uves_pfits_get_dpr_type(const uves_propertylist * plist)
533 {
534  const char* result=NULL;
535 
536 
537  check( uves_get_property_value(plist, UVES_DPR_TYPE,
538  CPL_TYPE_STRING, &result),
539  "Error reading %s", UVES_DPR_TYPE);
540 
541  cleanup:
542  return result;
543 }
544 
545 /*----------------------------------------------------------------------------*/
552 /*----------------------------------------------------------------------------*/
554 {
555  double mjd_obs = 0.0; /* Observation date */
556 
557  check( mjd_obs = uves_pfits_get_mjdobs(plist),
558  "Could not read observation date");
559 
560  cleanup:
561  /* New format iff modified julian date is after April 1st, 2004 = 53096 mjd */
562  return (mjd_obs > 55018.0);
563 }
564 
565 /*----------------------------------------------------------------------------*/
572 /*----------------------------------------------------------------------------*/
574 {
575  double mjd_obs = 0.0; /* Observation date */
576 
577  check( mjd_obs = uves_pfits_get_mjdobs(plist),
578  "Could not read observation date");
579 
580  cleanup:
581  /* New format iff modified julian date is after April 1st, 2004 = 53096 mjd */
582  return (mjd_obs > 53096.0);
583 }
584 
585 /*----------------------------------------------------------------------------*/
593 /*----------------------------------------------------------------------------*/
594 int uves_pfits_get_prescanx(const uves_propertylist * plist, enum uves_chip chip)
595 {
596  int returnvalue = 0;
597  bool new_format;
598 
599  check( new_format = uves_format_is_new(plist),
600  "Error determining FITS header format");
601 
602  check( uves_get_property_value(plist, UVES_PRESCANX(new_format, chip),
603  CPL_TYPE_INT, &returnvalue),
604  "Error reading keyword %s", UVES_PRESCANX(new_format, chip));
605 
606  cleanup:
607  return returnvalue;
608 }
609 
610 /*----------------------------------------------------------------------------*/
618 /*----------------------------------------------------------------------------*/
619 const char* uves_pfits_get_chipid(const uves_propertylist * plist, enum uves_chip chip)
620 {
621  const char* returnvalue = "";
622 
623  check( uves_get_property_value(plist, UVES_CHIP_ID(chip), CPL_TYPE_STRING, &returnvalue),
624  "Error reading keyword %s", UVES_CHIP_ID(chip));
625 
626  cleanup:
627  return returnvalue;
628 }
629 
630 /*----------------------------------------------------------------------------*/
638 /*----------------------------------------------------------------------------*/
639 const char* uves_pfits_get_chip_name(const uves_propertylist * plist, enum uves_chip chip)
640 {
641  const char* returnvalue = "";
642 
643  check( uves_get_property_value(plist, UVES_CHIP_NAME(chip), CPL_TYPE_STRING, &returnvalue),
644  "Error reading keyword %s", UVES_CHIP_NAME(chip));
645 
646  cleanup:
647  return returnvalue;
648 }
649 
650 /*----------------------------------------------------------------------------*/
658 /*----------------------------------------------------------------------------*/
659 int uves_pfits_get_ovrscanx(const uves_propertylist * plist, enum uves_chip chip)
660 {
661  int returnvalue = 0;
662  bool new_format;
663 
664  check( new_format = uves_format_is_new(plist),
665  "Error determining FITS header format");
666 
667  check( uves_get_property_value(plist, UVES_OVRSCANX(new_format, chip),
668  CPL_TYPE_INT, &returnvalue),
669  "Error reading keyword %s", UVES_OVRSCANX(new_format, chip));
670 
671  cleanup:
672  return returnvalue;
673 }
674 
675 /*----------------------------------------------------------------------------*/
683 /*----------------------------------------------------------------------------*/
684 int uves_pfits_get_prescany(const uves_propertylist * plist, enum uves_chip chip)
685 {
686  int returnvalue = 0;
687  bool new_format;
688 
689 
690  check( new_format = uves_format_is_new(plist),
691  "Error determining FITS header format");
692 
693  check( uves_get_property_value(plist, UVES_PRESCANY(new_format, chip),
694  CPL_TYPE_INT, &returnvalue),
695  "Error reading keyword %s", UVES_PRESCANY(new_format, chip));
696 
697  cleanup:
698  return returnvalue;
699 }
700 
701 /*----------------------------------------------------------------------------*/
709 /*----------------------------------------------------------------------------*/
710 int uves_pfits_get_ovrscany(const uves_propertylist * plist, enum uves_chip chip)
711 {
712  int returnvalue = 0;
713  bool new_format;
714 
715  check( new_format = uves_format_is_new(plist),
716  "Error determining FITS header format");
717 
718  check( uves_get_property_value(plist, UVES_OVRSCANY(new_format, chip),
719  CPL_TYPE_INT, &returnvalue),
720  "Error reading keyword %s", UVES_OVRSCANY(new_format, chip));
721 
722  cleanup:
723  return returnvalue;
724 }
725 
726 /*----------------------------------------------------------------------------*/
739 /*----------------------------------------------------------------------------*/
740 double uves_pfits_get_ron_adu(const uves_propertylist * plist, enum uves_chip chip)
741 {
742  double ron_el = 0; /* Read-out noise in electron units */
743  double default_ron_el = 5.0;/* Number converted from MIDAS */
744  double gain = 0; /* Conversion from electrons to ADUs */
745  bool new_format;
746 
747  check( new_format = uves_format_is_new(plist),
748  "Error determining FITS header format");
749 
750  check( uves_get_property_value(plist, UVES_RON(new_format, chip), CPL_TYPE_DOUBLE, &ron_el),
751  "Error reading keyword '%s'", UVES_RON(new_format, chip));
752 
753  if (ron_el <= 0)
754  {
755  uves_msg_warning("Read-out-noise is "
756  "non-positive (%e electrons). Using default value %e",
757  ron_el, default_ron_el);
758  ron_el = default_ron_el;
759  }
760 
761  check( gain = uves_pfits_get_gain(plist, chip),
762  "Error reading gain");
763 
764  assure( ron_el * gain > 0, CPL_ERROR_ILLEGAL_INPUT,
765  "Non-positive read-out noise: %f ADU", ron_el * gain);
766 
767  cleanup:
768  return ron_el * gain;
769 }
770 
771 
772 /*----------------------------------------------------------------------------*/
780 /*----------------------------------------------------------------------------*/
782 {
783  double result = 0;
784 
785  check( uves_get_property_value(plist, UVES_TEL_ALT, CPL_TYPE_DOUBLE, &result),
786  "Error reading keyword '%s'", UVES_TEL_ALT);
787 
788  cleanup:
789  return result;
790 }
791 
792 /*----------------------------------------------------------------------------*/
800 /*----------------------------------------------------------------------------*/
802 {
803  double result = 0;
804 
805  check( uves_get_property_value(plist, UVES_AIRMASS_START, CPL_TYPE_DOUBLE, &result),
806  "Error reading keyword '%s'", UVES_AIRMASS_START);
807 
808  cleanup:
809  return result;
810 }
811 /*----------------------------------------------------------------------------*/
819 /*----------------------------------------------------------------------------*/
821 {
822  double result = 0;
823 
824  check( uves_get_property_value(plist, UVES_AIRMASS_END, CPL_TYPE_DOUBLE, &result),
825  "Error reading keyword '%s'", UVES_AIRMASS_END);
826 
827  cleanup:
828  return result;
829 }
830 /*----------------------------------------------------------------------------*/
839 /*----------------------------------------------------------------------------*/
840 double uves_pfits_get_conad(const uves_propertylist * plist, enum uves_chip chip)
841 {
842  double result = 0;
843 
844  bool new_format;
845 
846  check( new_format = uves_format_is_new(plist),
847  "Error determining FITS header format");
848 
849  check( uves_get_property_value(plist, UVES_CONAD(new_format, chip),
850  CPL_TYPE_DOUBLE, &result),
851  "Error reading keyword '%s'", UVES_CONAD(new_format, chip));
852 
853  cleanup:
854  return result;
855 }
856 /*----------------------------------------------------------------------------*/
864 /*----------------------------------------------------------------------------*/
865 const char *uves_pfits_get_targ_name(const uves_propertylist * plist)
866 {
867  const char* returnvalue = "";
868 
869  check( uves_get_property_value(plist, UVES_TARG_NAME, CPL_TYPE_STRING, &returnvalue),
870  "Error reading keyword %s", UVES_TARG_NAME);
871 
872  cleanup:
873  return returnvalue;
874 }
875 
876 /*----------------------------------------------------------------------------*/
886 /*----------------------------------------------------------------------------*/
887 double uves_pfits_get_gain(const uves_propertylist * plist, enum uves_chip chip)
888 {
889  double result = 0;
890  double default_gain = 2.1; /* Adopted from MIDAS */
891  bool new_format;
892 
893  check( new_format = uves_format_is_new(plist),
894  "Error determining FITS header format");
895 
896  check( uves_get_property_value(plist, UVES_GAIN(new_format, chip),
897  CPL_TYPE_DOUBLE, &result),
898  "Error reading keyword '%s'", UVES_GAIN(new_format, chip));
899 
900  if (result <= 0)
901  {
902  uves_msg_warning("Gain factor from header is "
903  "non-positive (%e). Using default value %e",
904  result, default_gain);
905  result = default_gain;
906  }
907 
908  cleanup:
909  return result;
910 }
911 /*----------------------------------------------------------------------------*/
921 /*----------------------------------------------------------------------------*/
923 {
924  double result = 0; /* Conversion from electrons to ADUs */
925 
926  check( uves_get_property_value(plist, UVES_EXPTIME, CPL_TYPE_DOUBLE, &result),
927  "Error reading keyword '%s'", UVES_EXPTIME);
928  assure( result >= 0, CPL_ERROR_ILLEGAL_OUTPUT, "Exposure time is negative: %f", result);
929 
930  cleanup:
931  return result;
932 }
933 
934 /*----------------------------------------------------------------------------*/
942 /*----------------------------------------------------------------------------*/
943 cpl_error_code
945 {
946  check(( uves_propertylist_update_double(plist, UVES_EXPTIME, exptime),
947  uves_propertylist_set_comment(plist, UVES_EXPTIME, "Total integration time")),
948  "Error writing keyword '%s'", UVES_EXPTIME);
949  cleanup:
950  return cpl_error_get_code();
951 }
952 
953 
954 /*----------------------------------------------------------------------------*/
962 /*----------------------------------------------------------------------------*/
963 void
965 {
966  check( uves_propertylist_update_double(plist, UVES_DEC, dec),
967  "Error writing keyword '%s'", UVES_DEC);
968  cleanup:
969  return;
970 }
971 
972 /*----------------------------------------------------------------------------*/
980 /*----------------------------------------------------------------------------*/
981 void
983 {
984  check( uves_propertylist_update_double(plist, UVES_RA, ra),
985  "Error writing keyword '%s'", UVES_RA);
986  cleanup:
987  return;
988 }
989 
990 /*----------------------------------------------------------------------------*/
998 /*----------------------------------------------------------------------------*/
999 cpl_error_code
1001 {
1002  check(( uves_propertylist_update_int(plist, UVES_ORD_PRED, nord),
1003  uves_propertylist_set_comment(plist, UVES_ORD_PRED, "Predicted no of orders")),
1004  "Error writing keyword '%s'", UVES_ORD_PRED);
1005  cleanup:
1006  return cpl_error_get_code();
1007 }
1008 
1009 /*----------------------------------------------------------------------------*/
1015 /*----------------------------------------------------------------------------*/
1016 const char *
1018 {
1019  const char *result = "";
1020 
1021  check( uves_get_property_value(plist, UVES_DRS_ID, CPL_TYPE_STRING, &result),
1022  "Error reading keyword '%s'", UVES_DRS_ID);
1023 
1024  cleanup:
1025  if (cpl_error_get_code() != CPL_ERROR_NONE)
1026  {
1027  result = NULL;
1028  }
1029 
1030  return result;
1031 }
1032 
1033 
1034 
1035 /*----------------------------------------------------------------------------*/
1041 /*----------------------------------------------------------------------------*/
1042 const char *
1044 {
1045  const char *result = "";
1046 
1047  check( uves_get_property_value(plist, UVES_TPL_START, CPL_TYPE_STRING, &result),
1048  "Error reading keyword '%s'", UVES_TPL_START);
1049 
1050  cleanup:
1051  if (cpl_error_get_code() != CPL_ERROR_NONE)
1052  {
1053  result = NULL;
1054  }
1055 
1056  return result;
1057 }
1058 
1059 
1060 /*----------------------------------------------------------------------------*/
1066 /*----------------------------------------------------------------------------*/
1068 {
1069  double returnvalue = 0;
1070 
1071  check( uves_get_property_value(plist, UVES_UTC, CPL_TYPE_DOUBLE, &returnvalue),
1072  "Error reading keyword '%s'", UVES_UTC);
1073 
1074  cleanup:
1075  return returnvalue;
1076 }
1077 
1078 
1079 /*----------------------------------------------------------------------------*/
1085 /*----------------------------------------------------------------------------*/
1087 {
1088  double returnvalue = 0;
1089 
1090  check( uves_get_property_value(plist, UVES_MJDOBS, CPL_TYPE_DOUBLE, &returnvalue),
1091  "Error reading keyword '%s'", UVES_MJDOBS);
1092 
1093  cleanup:
1094  return returnvalue;
1095 }
1096 
1097 /*----------------------------------------------------------------------------*/
1103 /*----------------------------------------------------------------------------*/
1105 {
1106  double returnvalue = 0;
1107 
1108  check( uves_get_property_value(plist, UVES_GEOLAT, CPL_TYPE_DOUBLE, &returnvalue),
1109  "Error reading keyword '%s'", UVES_GEOLAT);
1110 
1111  cleanup:
1112  return returnvalue;
1113 }
1114 
1115 /*----------------------------------------------------------------------------*/
1121 /*----------------------------------------------------------------------------*/
1123 {
1124  double returnvalue = 0;
1125 
1126  check( uves_get_property_value(plist, UVES_GEOLON, CPL_TYPE_DOUBLE, &returnvalue),
1127  "Error reading keyword '%s'", UVES_GEOLON);
1128 
1129  cleanup:
1130  return returnvalue;
1131 }
1132 
1133 /*----------------------------------------------------------------------------*/
1139 /*----------------------------------------------------------------------------*/
1141 {
1142  double returnvalue = 0;
1143 
1144  check( uves_get_property_value(plist, UVES_RA, CPL_TYPE_DOUBLE, &returnvalue),
1145  "Error reading keyword '%s'", UVES_RA);
1146 
1147  cleanup:
1148  return returnvalue;
1149 }
1150 
1151 /*----------------------------------------------------------------------------*/
1157 /*----------------------------------------------------------------------------*/
1159 {
1160  double returnvalue = 0;
1161 
1162  check( uves_get_property_value(plist, UVES_DEC, CPL_TYPE_DOUBLE, &returnvalue),
1163  "Error reading keyword '%s'", UVES_DEC);
1164 
1165  cleanup:
1166  return returnvalue;
1167 }
1168 
1169 /*----------------------------------------------------------------------------*/
1175 /*----------------------------------------------------------------------------*/
1177 {
1178  int returnvalue = 0;
1179 
1180  check( uves_get_property_value(plist, UVES_BINX, CPL_TYPE_INT, &returnvalue),
1181  "Error reading keyword '%s'", UVES_BINX);
1182 
1183  cleanup:
1184  return returnvalue;
1185 }
1186 
1187 /*----------------------------------------------------------------------------*/
1193 /*----------------------------------------------------------------------------*/
1195 {
1196  int returnvalue = 0;
1197 
1198  check( uves_get_property_value(plist, UVES_BINY, CPL_TYPE_INT, &returnvalue),
1199  "Error reading keyword '%s'", UVES_BINY);
1200 
1201  cleanup:
1202  return returnvalue;
1203 }
1204 
1205 /*----------------------------------------------------------------------------*/
1211 /*----------------------------------------------------------------------------*/
1213 {
1214  int returnvalue = 0;
1215 
1216  /* This keyword changed name at some point. For support of older products, try to
1217  first new then old FITS card */
1218 
1219  assure( plist != NULL, CPL_ERROR_NULL_INPUT, "Null plist");
1220 
1221  if (uves_propertylist_contains(plist, UVES_DATANCOM))
1222  {
1223  check( uves_get_property_value(plist, UVES_DATANCOM, CPL_TYPE_INT, &returnvalue),
1224  "Error reading keyword '%s'", UVES_DATANCOM);
1225  }
1226  else if( uves_propertylist_contains(plist, UVES_DATANCOM_OLD))
1227  {
1228 
1229  check( uves_get_property_value(plist, UVES_DATANCOM_OLD, CPL_TYPE_INT, &returnvalue),
1230  "Error reading keyword '%s'", UVES_DATANCOM_OLD);
1231  } else {
1232 
1233  uves_msg_warning("Neither %s nor %s found! We assume a value of 5! This may affect noise/error propagation",
1234  UVES_DATANCOM,UVES_DATANCOM_OLD);
1235  returnvalue=5;
1236  }
1237 
1238  cleanup:
1239  return returnvalue;
1240 }
1241 
1242 
1243 
1244 /*----------------------------------------------------------------------------*/
1250 /*----------------------------------------------------------------------------*/
1251 const char* uves_pfits_get_ccdid(const uves_propertylist * plist)
1252 {
1253  const char* result="";
1254 
1255  check( uves_get_property_value(plist, UVES_CCDID, CPL_TYPE_STRING, &result),
1256  "Error reading keyword '%s'", UVES_CCDID);
1257 
1258  cleanup:
1259  return result;
1260 }
1261 
1262 /*----------------------------------------------------------------------------*/
1268 /*----------------------------------------------------------------------------*/
1270 {
1271  double returnvalue;
1272 
1273  check( uves_get_property_value(plist, UVES_PRESSURE, CPL_TYPE_DOUBLE, &returnvalue),
1274  "Error reading keyword '%s'", UVES_PRESSURE);
1275 
1276  cleanup:
1277  return returnvalue;
1278 }
1279 /*----------------------------------------------------------------------------*/
1287 /*----------------------------------------------------------------------------*/
1288 const char * uves_chop_eso_prefix(const char* key)
1289 {
1290  const char *result = NULL;
1291  const char *prefix = "ESO ";
1292  unsigned int pref_len = strlen(prefix);
1293 
1294  assure( strlen(key) >= pref_len &&
1295  strncmp(key, prefix, pref_len) == 0,
1296  CPL_ERROR_ILLEGAL_INPUT,
1297  "Keyword %s does not contain 'ESO ' prefix", key);
1298 
1299  result = key + pref_len;
1300 
1301  cleanup:
1302  return result;
1303 }
1304 
1305 /*----------------------------------------------------------------------------*/
1312 /*----------------------------------------------------------------------------*/
1313 double uves_pfits_get_tempcam(const uves_propertylist * plist, enum uves_chip chip)
1314 {
1315  double returnvalue;
1316 
1317  check( uves_get_property_value(plist, UVES_TEMPCAM(chip), CPL_TYPE_DOUBLE, &returnvalue),
1318  "Error reading keyword '%s'", UVES_TEMPCAM(chip));
1319 
1320  cleanup:
1321  return returnvalue;
1322 }
1323 
1324 
1325 /*----------------------------------------------------------------------------*/
1331 /*----------------------------------------------------------------------------*/
1333 {
1334  double returnvalue;
1335 
1336  check( uves_get_property_value(plist, UVES_HUMIDITY, CPL_TYPE_DOUBLE, &returnvalue),
1337  "Error reading keyword '%s'", UVES_HUMIDITY);
1338 
1339  cleanup:
1340  return returnvalue;
1341 }
1342 
1343 /*----------------------------------------------------------------------------*/
1349 /*----------------------------------------------------------------------------*/
1351 {
1352  double returnvalue;
1353 
1354  check( uves_get_property_value(plist, "WLEN1", CPL_TYPE_DOUBLE, &returnvalue),
1355  "Error reading keyword '%s'", "WLEN1");
1356 
1357  assure(returnvalue > 0, CPL_ERROR_ILLEGAL_INPUT, "Non-positive wavelength: %e", returnvalue);
1358 
1359  cleanup:
1360  return returnvalue;
1361 }
1362 
1363 /*----------------------------------------------------------------------------*/
1370 /*----------------------------------------------------------------------------*/
1371 double uves_pfits_get_gratwlen(const uves_propertylist * plist, enum uves_chip chip)
1372 {
1373  double returnvalue;
1374 
1375  check( uves_get_property_value(plist, UVES_GRATWLEN(chip), CPL_TYPE_DOUBLE, &returnvalue),
1376  "Error reading keyword '%s'", UVES_GRATWLEN(chip));
1377 
1378  assure(returnvalue > 0, CPL_ERROR_ILLEGAL_INPUT, "Non-positive wavelength: %e", returnvalue);
1379 
1380  cleanup:
1381  return returnvalue;
1382 }
1383 
1384 /*----------------------------------------------------------------------------*/
1390 /*----------------------------------------------------------------------------*/
1391 const char* uves_pfits_get_insmode(const uves_propertylist * plist)
1392 {
1393  const char* returnvalue="";
1394 
1395  check( uves_get_property_value(plist, UVES_INSMODE, CPL_TYPE_STRING, &returnvalue),
1396  "Error reading keyword '%s'", UVES_INSMODE);
1397 
1398  cleanup:
1399  return returnvalue;
1400 }
1401 
1402 /*----------------------------------------------------------------------------*/
1408 /*----------------------------------------------------------------------------*/
1409 const char* uves_pfits_get_inspath(const uves_propertylist * plist)
1410 {
1411  const char* returnvalue="";
1412 
1413  check( uves_get_property_value(plist, UVES_INSPATH, CPL_TYPE_STRING, &returnvalue),
1414  "Error reading keyword '%s'", UVES_INSPATH);
1415 
1416  cleanup:
1417  return returnvalue;
1418 }
1419 /*----------------------------------------------------------------------------*/
1426 /*----------------------------------------------------------------------------*/
1427 const char* uves_pfits_get_gratname(const uves_propertylist * plist, enum uves_chip chip)
1428 {
1429  const char* returnvalue="";
1430 
1431  check( uves_get_property_value(plist, UVES_GRATNAME(chip), CPL_TYPE_STRING, &returnvalue),
1432  "Error reading keyword '%s'", UVES_GRATNAME(chip));
1433 
1434  cleanup:
1435  return returnvalue;
1436 }
1437 
1438 /*----------------------------------------------------------------------------*/
1445 /*----------------------------------------------------------------------------*/
1447 {
1448  const char* returnvalue="";
1449 
1450  check( uves_get_property_value(plist, UVES_READ_SPEED, CPL_TYPE_STRING, &returnvalue),
1451  "Error reading keyword '%s'", UVES_READ_SPEED);
1452 
1453  cleanup:
1454  return returnvalue;
1455 }
1456 
1457 /*----------------------------------------------------------------------------*/
1464 /*----------------------------------------------------------------------------*/
1465 const char* uves_pfits_get_gratid(const uves_propertylist * plist, enum uves_chip chip)
1466 {
1467  const char* returnvalue="";
1468 
1469  check( uves_get_property_value(plist, UVES_GRATID(chip), CPL_TYPE_STRING, &returnvalue),
1470  "Error reading keyword '%s'", UVES_GRATID(chip));
1471 
1472  cleanup:
1473  return returnvalue;
1474 }
1475 
1476 /*----------------------------------------------------------------------------*/
1483 /*----------------------------------------------------------------------------*/
1484 double uves_pfits_get_slitlength(const uves_propertylist * plist, enum uves_chip chip)
1485 {
1486  double returnvalue;
1487 
1488  check( uves_get_property_value(plist, UVES_SLITLENGTH(chip), CPL_TYPE_DOUBLE, &returnvalue),
1489  "Error reading keyword '%s'", UVES_SLITLENGTH(chip));
1490 
1491  cleanup:
1492  return returnvalue;
1493 }
1494 
1495 
1496 /*----------------------------------------------------------------------------*/
1503 /*----------------------------------------------------------------------------*/
1504 double uves_pfits_get_slitwidth(const uves_propertylist * plist, enum uves_chip chip)
1505 {
1506  double returnvalue;
1507 
1508  check( uves_get_property_value(plist, UVES_SLITWIDTH(chip), CPL_TYPE_DOUBLE, &returnvalue),
1509  "Error reading keyword '%s'", UVES_SLITWIDTH(chip));
1510 
1511  cleanup:
1512  return returnvalue;
1513 }
1514 
1515 /*----------------------------------------------------------------------------*/
1521 /*----------------------------------------------------------------------------*/
1523 {
1524  cpl_type type;
1525  int returnvalue;
1526 
1527  assure( plist != NULL, CPL_ERROR_NULL_INPUT, "Null plist");
1528 
1529  /* In the UVES calibration data base this keyword
1530  is sometimes integer (e.g. '33'), sometimes a floating
1531  point value (e.g. '33.'), so support both types */
1532 
1533  assure( uves_propertylist_contains(plist, UVES_ORD_PRED),
1534  CPL_ERROR_DATA_NOT_FOUND,
1535  "Keyword %s does not exist", UVES_ORD_PRED);
1536  check ( type = uves_propertylist_get_type(plist, UVES_ORD_PRED),
1537  "Error reading type of property '%s'", UVES_ORD_PRED);
1538 
1539  if (type == CPL_TYPE_INT)
1540  {
1541  check( uves_get_property_value(
1542  plist, UVES_ORD_PRED, CPL_TYPE_INT, &returnvalue),
1543  "Error reading keyword '%s'", UVES_ORD_PRED);
1544  }
1545  else if (type == CPL_TYPE_DOUBLE)
1546  {
1547  double dvalue;
1548  check( uves_get_property_value(
1549  plist, UVES_ORD_PRED, CPL_TYPE_DOUBLE, &dvalue),
1550  "Error reading keyword '%s'", UVES_ORD_PRED);
1551  returnvalue = uves_round_double(dvalue);
1552  }
1553  else
1554  {
1555  assure( false, CPL_ERROR_TYPE_MISMATCH,
1556  "Keyword '%s' has wrong type '%s'",
1557  UVES_ORD_PRED, uves_tostring_cpl_type(type));
1558  }
1559 
1560  cleanup:
1561  return returnvalue;
1562 }
1563 
1564 /*----------------------------------------------------------------------------*/
1577 /*----------------------------------------------------------------------------*/
1578 void
1579 uves_pfits_set_history_val(uves_propertylist *plist, const char *name, const char *format, ...)
1580 {
1581  char *val_str = NULL;
1582  char *number_str = NULL;
1583  cpl_property *existing = NULL;
1584  va_list arglist;
1585  const long int plist_size = uves_propertylist_get_size(plist);
1586  int i;
1587 
1588  for (i = 0;
1589  existing == NULL && i < plist_size; i++)
1590  {
1591  cpl_property *p = uves_propertylist_get(plist, i);
1592  const char *pname = cpl_property_get_name(p);
1593 
1594  if (strcmp(pname, "HISTORY") == 0)
1595  {
1596  const char *pval;
1597  check( pval = cpl_property_get_string(p),
1598  "Error reading property value");
1599 
1600  /* match the string "<name> " */
1601 
1602  if (strlen(pval) > strlen(name) + strlen(" ") &&
1603  strncmp(pval, name, strlen(name)) == 0 &&
1604  pval[strlen(name)] == ' ')
1605  {
1606  /* Remember this one and stop searching */
1607  existing = p;
1608  }
1609  }
1610  }
1611 
1612  va_start(arglist, format);
1613  number_str = cpl_vsprintf(format, arglist);
1614  va_end(arglist);
1615 
1616  val_str = uves_sprintf("%s %s", name, number_str);
1617 
1618  if (existing != NULL)
1619  {
1620  check( cpl_property_set_string(existing, val_str),
1621  "Error updating HISTORY keyword with value '%s'", val_str);
1622  }
1623  else
1624  {
1625  check( uves_propertylist_append_string(plist, "HISTORY", val_str),
1626  "Error writing HISTORY keyword with value '%s'", val_str);
1627  }
1628 
1629  cleanup:
1630  cpl_free(val_str);
1631  cpl_free(number_str);
1632  return;
1633 }
1634 /*----------------------------------------------------------------------------*/
1651 /*----------------------------------------------------------------------------*/
1652 static double
1653 parse_history(const uves_propertylist *plist, const char *name, cpl_type type)
1654 {
1655  double returnvalue = 0;
1656  const long int plist_size = uves_propertylist_get_size(plist);
1657  int i;
1658  bool found;
1659 
1660  found = false;
1661  for (i = 0; !found && i < plist_size; i++) {
1662  const cpl_property *p = uves_propertylist_get_const(plist, i);
1663  const char *value = cpl_property_get_name(p);
1664 
1665  if (strcmp(value, "HISTORY") == 0) {
1666  check( value = cpl_property_get_string(p),
1667  "Error reading property value");
1668 
1669  /* match the string "<name> " */
1670 
1671  if (strlen(value) > strlen(name) + strlen(" ") &&
1672  strncmp(value, name, strlen(name)) == 0 &&
1673  value[strlen(name)] == ' ') {
1674  errno = 0;
1675  switch(type) {
1676  case CPL_TYPE_INT:
1677  returnvalue = atoi(value + strlen(name) + strlen(" "));
1678  assure(errno == 0, CPL_ERROR_ILLEGAL_INPUT,
1679  "Could not parse string '%s' as integer. "
1680  "atoi() returned %d",
1681  value + strlen(name) + strlen(" "), errno);
1682  break;
1683  case CPL_TYPE_DOUBLE:
1684  returnvalue = strtod(value + strlen(name) + strlen(" "), NULL);
1685  assure(errno == 0, CPL_ERROR_ILLEGAL_INPUT,
1686  "Could not parse string '%s' as double. "
1687  "strtod() returned %d",
1688  value + strlen(name) + strlen(" "), errno);
1689  break;
1690  default:
1691  assure( false, CPL_ERROR_UNSUPPORTED_MODE,
1692  "Type is %s", uves_tostring_cpl_type(type));
1693  break;
1694  }
1695  found = true;
1696  }
1697  }
1698  }
1699 
1700  assure( found, CPL_ERROR_DATA_NOT_FOUND, "Missing record 'HISTORY %s '",
1701  name );
1702 
1703  cleanup:
1704  return returnvalue;
1705 }
1706 
1707 /*----------------------------------------------------------------------------*/
1715 /*----------------------------------------------------------------------------*/
1716 void
1718 {
1719  uves_pfits_set_history_val(plist, UVES_FIRSTABSORDER, "%d", first_abs_order);
1720 
1721  return;
1722 }
1723 
1724 
1725 
1726 /*----------------------------------------------------------------------------*/
1732 /*----------------------------------------------------------------------------*/
1733 int
1735 {
1736  return uves_round_double(parse_history(plist, UVES_FIRSTABSORDER, CPL_TYPE_INT));
1737 }
1738 
1739 
1740 /*----------------------------------------------------------------------------*/
1748 /*----------------------------------------------------------------------------*/
1749 void
1751 {
1752  uves_pfits_set_history_val(plist, UVES_LASTABSORDER, "%d", last_abs_order);
1753 
1754  return;
1755 }
1756 /*----------------------------------------------------------------------------*/
1762 /*----------------------------------------------------------------------------*/
1763 int
1765 {
1766  return uves_round_double(parse_history(plist, UVES_LASTABSORDER, CPL_TYPE_INT));
1767 }
1768 
1769 /*---------------------------------------------------------------------------*/
1776 /*---------------------------------------------------------------------------*/
1777 cpl_error_code
1779 {
1780  check(( uves_propertylist_update_double(plist, UVES_PRO_DATAAVG, average),
1781  uves_propertylist_set_comment (plist, UVES_PRO_DATAAVG, "Mean of pixel values")),
1782  "Error writing keyword '%s'", UVES_PRO_DATAAVG);
1783  cleanup:
1784  return cpl_error_get_code();
1785 }
1786 
1787 /*---------------------------------------------------------------------------*/
1794 /*---------------------------------------------------------------------------*/
1795 cpl_error_code
1797 {
1798  check(( uves_propertylist_update_double(plist, UVES_PRO_DATARMS, stddev),
1799  uves_propertylist_set_comment (plist, UVES_PRO_DATARMS,
1800  "Standard deviation of pixel values")),
1801  "Error writing keyword '%s'", UVES_PRO_DATARMS);
1802 
1803  cleanup:
1804  return cpl_error_get_code();
1805 }
1806 
1807 /*---------------------------------------------------------------------------*/
1814 /*---------------------------------------------------------------------------*/
1815 cpl_error_code
1817 {
1818  check(( uves_propertylist_update_double(plist, UVES_PRO_DATAMED, median),
1819  uves_propertylist_set_comment (plist, UVES_PRO_DATAMED, "Median of pixel values")),
1820  "Error writing keyword '%s'", UVES_PRO_DATAMED);
1821 
1822  cleanup:
1823  return cpl_error_get_code();
1824 }
1825 /*---------------------------------------------------------------------------*/
1832 /*---------------------------------------------------------------------------*/
1833 cpl_error_code
1835 {
1836  check(( uves_propertylist_update_double(plist, UVES_DATAMIN, min),
1837  uves_propertylist_set_comment (plist, UVES_DATAMIN, "Minimum of pixel values")),
1838  "Error writing keyword '%s'", UVES_DATAMIN);
1839 
1840  cleanup:
1841  return cpl_error_get_code();
1842 }
1843 /*---------------------------------------------------------------------------*/
1850 /*---------------------------------------------------------------------------*/
1851 cpl_error_code
1853 {
1854  check(( uves_propertylist_update_double(plist, UVES_DATAMAX, max),
1855  uves_propertylist_set_comment (plist, UVES_DATAMAX,
1856  "Maximum of pixel values")),
1857  "Error writing keyword '%s'", UVES_DATAMAX);
1858 
1859  cleanup:
1860  return cpl_error_get_code();
1861 }
1862 
1863 /*----------------------------------------------------------------------------*/
1871 /*----------------------------------------------------------------------------*/
1872 cpl_error_code
1874 {
1875  uves_propertylist_update_double(plist, "WLEN1", wlen1);
1876 
1877  return cpl_error_get_code();
1878 }
1879 /*---------------------------------------------------------------------------*/
1886 /*---------------------------------------------------------------------------*/
1887 void
1889 {
1890  uves_pfits_set_history_val(plist, UVES_TRACEID, "%d", trace_id);
1891  return;
1892 }
1893 
1894 /*---------------------------------------------------------------------------*/
1900 /*---------------------------------------------------------------------------*/
1901 double
1903 {
1904  double offset;
1905  if (uves_propertylist_contains(plist, UVES_TRACE_OFFSET))
1906  /* MIDAS format */
1907  {
1908  check( uves_get_property_value(plist, UVES_TRACE_OFFSET, CPL_TYPE_DOUBLE,
1909  &offset),
1910  "Error reading keyword %s", UVES_TRACE_OFFSET);
1911  }
1912  else
1913  {
1914  offset = parse_history(plist, UVES_TRACE_OFFSET, CPL_TYPE_DOUBLE);
1915  }
1916 
1917  cleanup:
1918  return offset;
1919 }
1920 /*---------------------------------------------------------------------------*/
1927 /*---------------------------------------------------------------------------*/
1928 void
1929 uves_pfits_set_offset(uves_propertylist * plist, double trace_offset)
1930 {
1931  uves_pfits_set_history_val(plist, UVES_TRACE_OFFSET, "%f", trace_offset);
1932  return;
1933 }
1934 
1935 /*---------------------------------------------------------------------------*/
1942 /*---------------------------------------------------------------------------*/
1943 void
1945 {
1946  uves_pfits_set_history_val(plist, UVES_WINDOWNUMBER, "%d", window_number);
1947  return;
1948 }
1949 
1950 
1951 /*---------------------------------------------------------------------------*/
1957 /*---------------------------------------------------------------------------*/
1958 int
1960 {
1961  return uves_round_double(parse_history(plist, UVES_TRACEID, CPL_TYPE_INT));
1962 }
1963 
1964 /*---------------------------------------------------------------------------*/
1970 /*---------------------------------------------------------------------------*/
1971 int
1973 {
1974  return uves_round_double(parse_history(plist, UVES_WINDOWNUMBER, CPL_TYPE_INT));
1975 }
1976 
1977 /*---------------------------------------------------------------------------*/
1983 /*---------------------------------------------------------------------------*/
1984 const char*
1986 {
1987  const char* returnvalue="";
1988 
1989  check( uves_get_property_value(plist, UVES_BUNIT, CPL_TYPE_STRING, &returnvalue),
1990  "Error reading keyword '%s'", UVES_BUNIT);
1991 
1992  cleanup:
1993  return returnvalue;
1994 }
1995 
1996 /*---------------------------------------------------------------------------*/
2002 /*---------------------------------------------------------------------------*/
2003 double
2005 {
2006  double returnvalue = 0;
2007 
2008  check( uves_get_property_value(plist, UVES_BSCALE, CPL_TYPE_DOUBLE, &returnvalue),
2009  "Error reading keyword '%s'", UVES_BSCALE);
2010 
2011  cleanup:
2012  return returnvalue;
2013 }
2014 
2015 
2016 /*---------------------------------------------------------------------------*/
2022 /*---------------------------------------------------------------------------*/
2023 const char*
2025 {
2026  const char* returnvalue="";
2027 
2028  check( uves_get_property_value(plist, UVES_CUNIT1, CPL_TYPE_STRING, &returnvalue),
2029  "Error reading keyword '%s'", UVES_CUNIT1);
2030 
2031  cleanup:
2032  return returnvalue;
2033 }
2034 
2035 /*---------------------------------------------------------------------------*/
2041 /*---------------------------------------------------------------------------*/
2042 const char*
2044 {
2045  const char* returnvalue="";
2046 
2047  check( uves_get_property_value(plist, UVES_CUNIT2, CPL_TYPE_STRING, &returnvalue),
2048  "Error reading keyword '%s'", UVES_CUNIT2);
2049 
2050  cleanup:
2051  return returnvalue;
2052 }
2053 
2054 /*---------------------------------------------------------------------------*/
2060 /*---------------------------------------------------------------------------*/
2061 const char*
2063 {
2064  const char* returnvalue="";
2065 
2066  check( uves_get_property_value(plist, UVES_CTYPE1, CPL_TYPE_STRING, &returnvalue),
2067  "Error reading keyword '%s'", UVES_CTYPE1);
2068 
2069  cleanup:
2070  return returnvalue;
2071 }
2072 
2073 /*---------------------------------------------------------------------------*/
2079 /*---------------------------------------------------------------------------*/
2080 const
2082 {
2083  const char* returnvalue="";
2084 
2085  check( uves_get_property_value(plist, UVES_CTYPE2, CPL_TYPE_STRING, &returnvalue),
2086  "Error reading keyword '%s'", UVES_CTYPE2);
2087 
2088  cleanup:
2089  return returnvalue;
2090 }
2091 
2092 /*---------------------------------------------------------------------------*/
2098 /*---------------------------------------------------------------------------*/
2099 double
2101 {
2102  double returnvalue = 0;
2103  bool new_format;
2104 
2105  check( new_format = uves_format_is_new(plist),
2106  "Error determining FITS header format");
2107 
2108  check( uves_get_property_value(plist, UVES_UIT(new_format), CPL_TYPE_DOUBLE, &returnvalue),
2109  "Error reading keyword %s", UVES_UIT(new_format));
2110 
2111  cleanup:
2112  return returnvalue;
2113 
2114 }
2115 
2116 
2117 /*---------------------------------------------------------------------------*/
2124 /*---------------------------------------------------------------------------*/
2125 int
2126 uves_pfits_get_nx(const uves_propertylist * plist,enum uves_chip chip)
2127 {
2128 
2129  int returnvalue = 0;
2130  bool new_format;
2131 
2132  check( new_format = uves_format_is_new(plist),
2133  "Error determining FITS header format");
2134 
2135  check( uves_get_property_value(plist, UVES_NX(new_format, chip), CPL_TYPE_INT, &returnvalue),
2136  "Error reading keyword %s", UVES_NX(new_format, chip));
2137 
2138  cleanup:
2139  return returnvalue;
2140 
2141 }
2142 
2143 
2144 
2145 
2146 /*---------------------------------------------------------------------------*/
2153 /*---------------------------------------------------------------------------*/
2154 int
2155 uves_pfits_get_ny(const uves_propertylist * plist,enum uves_chip chip)
2156 {
2157 
2158  int returnvalue = 0;
2159  bool new_format;
2160 
2161  check( new_format = uves_format_is_new(plist),
2162  "Error determining FITS header format");
2163 
2164  check( uves_get_property_value(plist, UVES_NY(new_format, chip), CPL_TYPE_INT, &returnvalue),
2165  "Error reading keyword %s", UVES_NY(new_format, chip));
2166 
2167  cleanup:
2168  return returnvalue;
2169 
2170 }
2171 
2172 
2173 
2174 /*---------------------------------------------------------------------------*/
2180 /*---------------------------------------------------------------------------*/
2181 int
2183 {
2184  int returnvalue = 0;
2185 
2186  check( uves_get_property_value(plist, UVES_OUT1NX, CPL_TYPE_INT, &returnvalue),
2187  "Error reading keyword '%s'", UVES_OUT1NX);
2188 
2189  cleanup:
2190  return returnvalue;
2191 }
2192 
2193 /*---------------------------------------------------------------------------*/
2199 /*---------------------------------------------------------------------------*/
2200 int
2202 {
2203  int returnvalue = 0;
2204 
2205  check( uves_get_property_value(plist, UVES_OUT1NY, CPL_TYPE_INT, &returnvalue),
2206  "Error reading keyword '%s'", UVES_OUT1NY);
2207 
2208  cleanup:
2209  return returnvalue;
2210 }
2211 
2212 /*---------------------------------------------------------------------------*/
2218 /*---------------------------------------------------------------------------*/
2219 int
2221 {
2222  int returnvalue = 0;
2223 
2224  check( uves_get_property_value(plist, UVES_OUT4NX, CPL_TYPE_INT, &returnvalue),
2225  "Error reading keyword '%s'", UVES_OUT4NX);
2226 
2227  cleanup:
2228  return returnvalue;
2229 }
2230 
2231 /*---------------------------------------------------------------------------*/
2237 /*---------------------------------------------------------------------------*/
2238 int
2240 {
2241  int returnvalue = 0;
2242 
2243  check( uves_get_property_value(plist, UVES_OUT4NY, CPL_TYPE_INT, &returnvalue),
2244  "Error reading keyword '%s'", UVES_OUT4NY);
2245 
2246  cleanup:
2247  return returnvalue;
2248 }
2249 
2250 
2251 /*---------------------------------------------------------------------------*/
2257 /*---------------------------------------------------------------------------*/
2258 int
2260 {
2261  int returnvalue = 0;
2262 
2263  check( uves_get_property_value(plist, UVES_NAXIS, CPL_TYPE_INT, &returnvalue),
2264  "Error reading keyword '%s'", UVES_NAXIS);
2265 
2266  cleanup:
2267  return returnvalue;
2268 }
2269 
2270 /*---------------------------------------------------------------------------*/
2276 /*---------------------------------------------------------------------------*/
2277 int
2279 {
2280  int returnvalue = 0;
2281 
2282  check( uves_get_property_value(plist, FLAMES_NFLATS, CPL_TYPE_INT, &returnvalue),
2283  "Error reading keyword '%s'", FLAMES_NFLATS);
2284 
2285  cleanup:
2286  return returnvalue;
2287 }
2288 
2289 
2290 /*---------------------------------------------------------------------------*/
2296 /*---------------------------------------------------------------------------*/
2297 int
2299 {
2300  int returnvalue = 0;
2301 
2302  check( uves_get_property_value(plist, UVES_BITPIX, CPL_TYPE_INT, &returnvalue),
2303  "Error reading keyword '%s'", UVES_BITPIX);
2304 
2305  cleanup:
2306  return returnvalue;
2307 }
2308 
2309 /*---------------------------------------------------------------------------*/
2315 /*---------------------------------------------------------------------------*/
2317 {
2318  int returnvalue = 0;
2319 
2320  check( uves_get_property_value(plist, UVES_NAXIS1, CPL_TYPE_INT, &returnvalue),
2321  "Error reading keyword '%s'", UVES_NAXIS1);
2322 
2323  cleanup:
2324  return returnvalue;
2325 }
2326 
2327 
2328 /*---------------------------------------------------------------------------*/
2334 /*---------------------------------------------------------------------------*/
2335 double
2337 {
2338  double returnvalue = 0;
2339 
2340  check( uves_get_property_value(plist, UVES_STARTX, CPL_TYPE_DOUBLE, &returnvalue),
2341  "Error reading keyword '%s'", UVES_STARTX);
2342 
2343  cleanup:
2344  return returnvalue;
2345 }
2346 
2347 
2348 /*---------------------------------------------------------------------------*/
2354 /*---------------------------------------------------------------------------*/
2355 double
2357 {
2358  double returnvalue = 0;
2359 
2360  check( uves_get_property_value(plist, UVES_STARTY, CPL_TYPE_DOUBLE, &returnvalue),
2361  "Error reading keyword '%s'", UVES_STARTY);
2362 
2363  cleanup:
2364  return returnvalue;
2365 }
2366 
2367 /*---------------------------------------------------------------------------*/
2373 /*---------------------------------------------------------------------------*/
2374 int
2376 {
2377  int returnvalue = 0;
2378 
2379  check( uves_get_property_value(plist, UVES_NAXIS2, CPL_TYPE_INT, &returnvalue),
2380  "Error reading keyword '%s'", UVES_NAXIS2);
2381 
2382  cleanup:
2383  return returnvalue;
2384 }
2385 /*---------------------------------------------------------------------------*/
2391 /*---------------------------------------------------------------------------*/
2392 double
2394 {
2395  double returnvalue = 0.0;
2396 
2397  check( uves_get_property_value(plist, UVES_CRVAL1, CPL_TYPE_DOUBLE, &returnvalue),
2398  "Error reading keyword '%s'", UVES_CRVAL1);
2399 
2400  cleanup:
2401  return returnvalue;
2402 }
2403 /*---------------------------------------------------------------------------*/
2409 /*---------------------------------------------------------------------------*/
2410 double
2412 {
2413  double returnvalue = 0.0;
2414 
2415  check( uves_get_property_value(plist, UVES_CRVAL2, CPL_TYPE_DOUBLE, &returnvalue),
2416  "Error reading keyword '%s'", UVES_CRVAL2);
2417 
2418  cleanup:
2419  return returnvalue;
2420 }
2421 /*---------------------------------------------------------------------------*/
2427 /*---------------------------------------------------------------------------*/
2428 double
2430 {
2431  double returnvalue = 0.0;
2432 
2433  check( uves_get_property_value(plist, UVES_CRPIX1, CPL_TYPE_DOUBLE, &returnvalue),
2434  "Error reading keyword '%s'", UVES_CRPIX1);
2435 
2436  cleanup:
2437  return returnvalue;
2438 }
2439 /*---------------------------------------------------------------------------*/
2445 /*---------------------------------------------------------------------------*/
2446 double
2448 {
2449  double returnvalue = 0.0;
2450 
2451  check( uves_get_property_value(plist, UVES_CRPIX2, CPL_TYPE_DOUBLE, &returnvalue),
2452  "Error reading keyword '%s'", UVES_CRPIX2);
2453 
2454  cleanup:
2455  return returnvalue;
2456 }
2457 /*---------------------------------------------------------------------------*/
2463 /*---------------------------------------------------------------------------*/
2464 double
2466 {
2467  double returnvalue = 0.0;
2468 
2469  check( uves_get_property_value(plist, UVES_CDELT1, CPL_TYPE_DOUBLE, &returnvalue),
2470  "Error reading keyword '%s'", UVES_CDELT1);
2471 
2472  cleanup:
2473  return returnvalue;
2474 }
2475 /*---------------------------------------------------------------------------*/
2481 /*---------------------------------------------------------------------------*/
2482 double
2484 {
2485  double returnvalue = 0.0;
2486 
2487  check( uves_get_property_value(plist, UVES_CDELT2, CPL_TYPE_DOUBLE, &returnvalue),
2488  "Error reading keyword '%s'", UVES_CDELT2);
2489 
2490  cleanup:
2491  return returnvalue;
2492 }
2493 
2494 
2495 /*---------------------------------------------------------------------------*/
2502 /*---------------------------------------------------------------------------*/
2503 void
2504 uves_pfits_set_dpr_catg(uves_propertylist * plist, const char *catg)
2505 {
2506  check( uves_propertylist_update_string(plist, UVES_DPR_CATG, catg),
2507  "Error writing %s", UVES_DPR_CATG);
2508  cleanup:
2509  return;
2510 }
2511 
2512 /*---------------------------------------------------------------------------*/
2519 /*---------------------------------------------------------------------------*/
2520 void
2521 uves_pfits_set_dpr_tech(uves_propertylist * plist, const char *tech)
2522 {
2523  check( uves_propertylist_update_string(plist, UVES_DPR_TECH, tech),
2524  "Error writing %s", UVES_DPR_TECH);
2525  cleanup:
2526  return;
2527 }
2528 /*---------------------------------------------------------------------------*/
2535 /*---------------------------------------------------------------------------*/
2536 void
2537 uves_pfits_set_dpr_type(uves_propertylist * plist, const char *type)
2538 {
2539  check( uves_propertylist_update_string(plist, UVES_DPR_TYPE, type),
2540  "Error writing %s", UVES_DPR_TYPE);
2541  cleanup:
2542  return;
2543 }
2544 
2545 /*---------------------------------------------------------------------------*/
2552 /*---------------------------------------------------------------------------*/
2553 cpl_error_code
2554 uves_pfits_set_object(uves_propertylist * plist, const char *object)
2555 {
2556  check( uves_propertylist_update_string(plist, UVES_OBJECT, object),
2557  "Error writing keyword '%s'", UVES_OBJECT);
2558 
2559  cleanup:
2560  return cpl_error_get_code();
2561 }
2562 /*---------------------------------------------------------------------------*/
2569 /*---------------------------------------------------------------------------*/
2570 cpl_error_code
2572 {
2573  check( uves_propertylist_update_string(plist, UVES_QC_BADPIXCORR, corr),
2574  "Error writing keyword '%s'", UVES_QC_BADPIXCORR);
2575 
2576  cleanup:
2577  return cpl_error_get_code();
2578 }
2579 
2580 /*---------------------------------------------------------------------------*/
2587 /*---------------------------------------------------------------------------*/
2588 cpl_error_code
2589 uves_pfits_set_redlevel(uves_propertylist * plist, const char *redlevel)
2590 {
2591  check( uves_propertylist_update_string(plist, UVES_REDLEVEL, redlevel),
2592  "Error writing keyword '%s'", UVES_REDLEVEL);
2593 
2594  cleanup:
2595  return cpl_error_get_code();
2596 }
2597 
2598 /*---------------------------------------------------------------------------*/
2605 /*---------------------------------------------------------------------------*/
2606 cpl_error_code
2607 uves_pfits_set_status(uves_propertylist * plist, const char *status)
2608 {
2609  check( uves_propertylist_update_string(plist, UVES_STATUS, status),
2610  "Error writing keyword '%s'", UVES_STATUS);
2611 
2612  cleanup:
2613  return cpl_error_get_code();
2614 }
2615 
2616 /*---------------------------------------------------------------------------*/
2623 /*---------------------------------------------------------------------------*/
2624 cpl_error_code
2625 uves_pfits_set_starttime(uves_propertylist * plist, const char *start_time)
2626 {
2627  check( uves_propertylist_update_string(plist, UVES_START, start_time),
2628  "Error writing keyword '%s'", UVES_START);
2629 
2630  cleanup:
2631  return cpl_error_get_code();
2632 }
2633 /*---------------------------------------------------------------------------*/
2640 /*---------------------------------------------------------------------------*/
2641 cpl_error_code
2642 uves_pfits_set_stoptime(uves_propertylist * plist, const char *stop_time)
2643 {
2644  check( uves_propertylist_update_string(plist, UVES_STOP, stop_time),
2645  "Error writing keyword '%s'", UVES_STOP);
2646 
2647  cleanup:
2648  return cpl_error_get_code();
2649 }
2650 
2651 /*---------------------------------------------------------------------------*/
2658 /*---------------------------------------------------------------------------*/
2659 cpl_error_code
2660 uves_pfits_set_bunit(uves_propertylist * plist, const char *bunit)
2661 {
2662  check( uves_propertylist_update_string(plist, UVES_BUNIT, bunit),
2663  "Error writing keyword '%s'", UVES_BUNIT);
2664 
2665  cleanup:
2666  return cpl_error_get_code();
2667 }
2668 
2669 /*---------------------------------------------------------------------------*/
2676 /*---------------------------------------------------------------------------*/
2677 cpl_error_code
2678 uves_pfits_set_bscale(uves_propertylist * plist, const double bscale)
2679 {
2680  check( uves_propertylist_update_double(plist, UVES_BSCALE, bscale),
2681  "Error writing keyword '%s'", UVES_BSCALE);
2682 
2683  cleanup:
2684  return cpl_error_get_code();
2685 }
2686 
2687 
2688 /*---------------------------------------------------------------------------*/
2695 /*---------------------------------------------------------------------------*/
2696 cpl_error_code
2697 uves_pfits_set_tunit_no(uves_propertylist * plist, const int col_no, const char *tunit)
2698 {
2699  char key_name[20];
2700  sprintf(key_name,"%s%d",UVES_TUNIT,col_no);
2701  uves_msg("Filling key %s with value %s",key_name,tunit);
2702  check( uves_propertylist_update_string(plist, key_name, tunit),
2703  "Error writing keyword '%s'", key_name);
2704 
2705  cleanup:
2706  return cpl_error_get_code();
2707 }
2708 
2709 /*---------------------------------------------------------------------------*/
2716 /*---------------------------------------------------------------------------*/
2717 cpl_error_code
2718 uves_pfits_set_bunit_no(uves_propertylist * plist, const int axis_no, const char *bunit)
2719 {
2720  check( uves_propertylist_update_string(plist, UVES_BUNIT, bunit),
2721  "Error writing keyword '%s'", UVES_BUNIT);
2722 
2723  cleanup:
2724  return cpl_error_get_code();
2725 }
2726 
2727 /*---------------------------------------------------------------------------*/
2734 /*---------------------------------------------------------------------------*/
2735 cpl_error_code
2736 uves_pfits_set_extname(uves_propertylist * plist, const char *extname)
2737 {
2738 
2739  check( uves_propertylist_append_string(plist, "EXTNAME", extname),
2740  "Error writing EXTNAME keyword with value '%s'", extname);
2741 
2742  cleanup:
2743  return cpl_error_get_code();
2744 }
2745 
2746 
2747 /*---------------------------------------------------------------------------*/
2754 /*---------------------------------------------------------------------------*/
2755 cpl_error_code
2756 uves_pfits_set_ctype1(uves_propertylist * plist, const char *ctype1)
2757 {
2758  check( uves_propertylist_update_string(plist, UVES_CTYPE1, ctype1),
2759  "Error writing keyword '%s'", UVES_CTYPE1);
2760 
2761  cleanup:
2762  return cpl_error_get_code();
2763 }
2764 /*---------------------------------------------------------------------------*/
2771 /*---------------------------------------------------------------------------*/
2772 cpl_error_code
2773 uves_pfits_set_ctype2(uves_propertylist * plist, const char *ctype2)
2774 {
2775  check( uves_propertylist_update_string(plist, UVES_CTYPE2, ctype2),
2776  "Error writing keyword '%s'", UVES_CTYPE2);
2777 
2778  cleanup:
2779  return cpl_error_get_code();
2780 }
2781 
2782 
2783 
2784 /*---------------------------------------------------------------------------*/
2791 /*---------------------------------------------------------------------------*/
2792 cpl_error_code
2793 uves_pfits_set_cunit1(uves_propertylist * plist, const char *cunit1)
2794 {
2795  check( uves_propertylist_update_string(plist, UVES_CUNIT1, cunit1),
2796  "Error writing keyword '%s'", UVES_CUNIT1);
2797 
2798  cleanup:
2799  return cpl_error_get_code();
2800 }
2801 
2802 /*---------------------------------------------------------------------------*/
2809 /*---------------------------------------------------------------------------*/
2810 cpl_error_code
2811 uves_pfits_set_cunit2(uves_propertylist * plist, const char *cunit2)
2812 {
2813  check( uves_propertylist_update_string(plist, UVES_CUNIT2, cunit2),
2814  "Error writing keyword '%s'", UVES_CUNIT2);
2815 
2816  cleanup:
2817  return cpl_error_get_code();
2818 }
2819 
2820 /*---------------------------------------------------------------------------*/
2827 /*---------------------------------------------------------------------------*/
2828 cpl_error_code
2830 {
2831  check( uves_propertylist_update_double(plist, UVES_CRVAL1, crval1),
2832  "Error writing keyword '%s'", UVES_CRVAL1);
2833 
2834  cleanup:
2835  return cpl_error_get_code();
2836 }
2837 
2838 /*---------------------------------------------------------------------------*/
2845 /*---------------------------------------------------------------------------*/
2846 cpl_error_code
2848 {
2849  check( uves_propertylist_update_double(plist, UVES_CRVAL2, crval2),
2850  "Error writing keyword '%s'", UVES_CRVAL2);
2851 
2852  cleanup:
2853  return cpl_error_get_code();
2854 }
2855 /*---------------------------------------------------------------------------*/
2862 /*---------------------------------------------------------------------------*/
2863 cpl_error_code
2865 {
2866  check( uves_propertylist_update_double(plist, UVES_CRPIX1, crpix1),
2867  "Error writing keyword '%s'", UVES_CRPIX1);
2868 
2869  cleanup:
2870  return cpl_error_get_code();
2871 }
2872 
2873 /*---------------------------------------------------------------------------*/
2880 /*---------------------------------------------------------------------------*/
2881 cpl_error_code
2883 {
2884  check( uves_propertylist_update_double(plist, UVES_CRPIX2, crpix2),
2885  "Error writing keyword '%s'", UVES_CRPIX2);
2886 
2887  cleanup:
2888  return cpl_error_get_code();
2889 }
2890 /*---------------------------------------------------------------------------*/
2897 /*---------------------------------------------------------------------------*/
2898 cpl_error_code
2900 {
2901  check( uves_propertylist_update_double(plist, UVES_CDELT1, cdelt1),
2902  "Error writing keyword '%s'", UVES_CDELT1);
2903 
2904  cleanup:
2905  return cpl_error_get_code();
2906 }
2907 
2908 /*---------------------------------------------------------------------------*/
2915 /*---------------------------------------------------------------------------*/
2916 void
2918 {
2919  check( uves_propertylist_update_double(plist, FLAMES_CCFPOSMAX, ccfposmax),
2920  "Error writing keyword '%s'", FLAMES_CCFPOSMAX);
2921 
2922  cleanup:
2923  return;
2924 }
2925 
2926 /*---------------------------------------------------------------------------*/
2933 /*---------------------------------------------------------------------------*/
2934 cpl_error_code
2936 {
2937  check( uves_propertylist_update_double(plist, UVES_CDELT2, cdelt2),
2938  "Error writing keyword '%s'", UVES_CDELT2);
2939 
2940  cleanup:
2941  return cpl_error_get_code();
2942 }
2943 
2944 /*---------------------------------------------------------------------------*/
2950 /*---------------------------------------------------------------------------*/
2951 void
2953 {
2954  check( uves_propertylist_update_int(plist, UVES_HS, hs),
2955  "Error writing keyword '%s'", UVES_HS);
2956 
2957  cleanup:
2958  return;
2959 }
2960 
2961 
2962 /*---------------------------------------------------------------------------*/
2970 /*---------------------------------------------------------------------------*/
2971 cpl_error_code
2972 uves_pfits_set_wstart(uves_propertylist * plist, int order, double wstart)
2973 {
2974  char *wstart_string = NULL;
2975 
2976  assure (1 <= order && order <= 99, CPL_ERROR_ILLEGAL_INPUT,
2977  "Illegal order number: %d. Allowed range is 1 to 99", order);
2978 
2979  /* allocate room for two digits and '\0' */
2980  wstart_string = cpl_malloc( strlen(UVES_WSTART) + 2 + 1);
2981  assure_mem( wstart_string );
2982 
2983  snprintf(wstart_string, strlen(UVES_WSTART)+2+1, UVES_WSTART "%d", order);
2984 
2985  check( uves_propertylist_update_double(plist, wstart_string, wstart ),
2986  "Error updating product header");
2987 
2988  cleanup:
2989  cpl_free(wstart_string);
2990  return cpl_error_get_code();
2991 }
2992 
2993 
2994 /*---------------------------------------------------------------------------*/
3001 /*---------------------------------------------------------------------------*/
3002 
3003 double
3004 uves_pfits_get_wstart(const uves_propertylist * plist, int order)
3005 {
3006  double returnvalue;
3007  char *wstart = NULL;
3008 
3009  assure (1 <= order && order <= 99, CPL_ERROR_ILLEGAL_INPUT,
3010  "Illegal order number: %d. Allowed range is 1 to 99", order);
3011 
3012  /* allocate room for two digits and '\0' */
3013  wstart = cpl_malloc( strlen(UVES_WSTART) + 2 + 1);
3014  assure_mem( wstart );
3015 
3016  snprintf(wstart, strlen(UVES_WSTART)+2+1, UVES_WSTART "%d", order);
3017 
3018  check( uves_get_property_value(plist, wstart, CPL_TYPE_DOUBLE, &returnvalue),
3019  "Error reading keyword '%s'", wstart);
3020 
3021  cleanup:
3022  cpl_free(wstart);
3023  return returnvalue;
3024 }
3025 /*---------------------------------------------------------------------------*/
3033 /*---------------------------------------------------------------------------*/
3034 cpl_error_code
3035 uves_pfits_set_wend(uves_propertylist * plist, int order, double wend)
3036 {
3037  char *wend_string = NULL;
3038 
3039  assure (1 <= order && order <= 99, CPL_ERROR_ILLEGAL_INPUT,
3040  "Illegal order number: %d. Allowed range is 1 to 99", order);
3041 
3042  /* allocate room for two digits and '\0' */
3043  wend_string = cpl_malloc( strlen(UVES_WEND) + 2 + 1);
3044  assure_mem( wend_string );
3045 
3046  snprintf(wend_string, strlen(UVES_WEND)+2+1, UVES_WEND "%d", order);
3047 
3048  check( uves_propertylist_update_double(plist, wend_string, wend ),
3049  "Error updating product header");
3050 
3051  cleanup:
3052  cpl_free(wend_string);
3053  return cpl_error_get_code();
3054 }
3055 
3056 
3057 /*---------------------------------------------------------------------------*/
3064 /*---------------------------------------------------------------------------*/
3065 
3066 double
3067 uves_pfits_get_wend(const uves_propertylist * plist, int order)
3068 {
3069  double returnvalue;
3070  char *wend = NULL;
3071 
3072  assure (1 <= order && order <= 99, CPL_ERROR_ILLEGAL_INPUT,
3073  "Illegal order number: %d. Allowed range is 1 to 99", order);
3074 
3075  /* allocate room for two digits and '\0' */
3076  wend = cpl_malloc( strlen(UVES_WEND) + 2 + 1);
3077  assure_mem( wend );
3078 
3079  snprintf(wend, strlen(UVES_WEND)+2+1, UVES_WEND "%d", order);
3080 
3081  check( uves_get_property_value(plist, wend, CPL_TYPE_DOUBLE, &returnvalue),
3082  "Error reading keyword '%s'", wend);
3083 
3084  cleanup:
3085  cpl_free(wend);
3086  return returnvalue;
3087 }
3088 
3089 /*---------------------------------------------------------------------------*/
3095 /*---------------------------------------------------------------------------*/
3096 double
3098 {
3099  double pixelscale = 0;
3100 
3101  check( uves_get_property_value(plist, UVES_PIXELSCALE, CPL_TYPE_DOUBLE, &pixelscale),
3102  "Error reading keyword '%s'", UVES_PIXELSCALE);
3103 
3104  cleanup:
3105  return pixelscale;
3106 }
3107 
3108 /*---------------------------------------------------------------------------*/
3114 /*---------------------------------------------------------------------------*/
3115 const char*
3117 {
3118  const char* returnvalue = "";
3119 
3120  check( uves_get_property_value(plist, UVES_SLIT1NAME, CPL_TYPE_STRING, &returnvalue),
3121  "Error reading keyword '%s'", UVES_SLIT1NAME);
3122 
3123  cleanup:
3124  return returnvalue;
3125 }
3126 
3127 
3128 /*---------------------------------------------------------------------------*/
3138 /*---------------------------------------------------------------------------*/
3139 
3140 double
3142  enum uves_chip chip)
3143 {
3144  double slitlength_pixels = 0; /* Result */
3145 
3146  const char *slicer_name = "";
3147  double slitlength_arcsecs = 0; /* Slit length in arc-seconds */
3148 
3149  check( slicer_name = uves_pfits_get_slit1_name(plist),
3150  "Could not read slicer id");
3151 
3152  if ( strncmp(slicer_name, "FREE", 4) != 0)
3153  {
3154  /* Slicer inserted */
3155  if (strncmp(slicer_name, "SLIC#1", 6) == 0) slitlength_arcsecs = 8.0;
3156  else if (strncmp(slicer_name, "SLIC#2", 6) == 0) slitlength_arcsecs = 8.0;
3157  else if (strncmp(slicer_name, "SLIC#3", 6) == 0) slitlength_arcsecs = 10.0;
3158  else
3159  {
3160  assure( false, CPL_ERROR_ILLEGAL_INPUT, "Unrecognized slicer name: '%s'. "
3161  "Recognized names are 'FREE', 'SLIC#1', 'SLIC#2', 'SLIC#3'.",
3162  slicer_name);
3163  }
3164  }
3165  else
3166  {
3167  /* slicer_name = 'FREE', no slicer */
3168 
3169  check( uves_get_property_value(
3170  plist, UVES_SLITLENGTH(chip), CPL_TYPE_DOUBLE, &slitlength_arcsecs),
3171  "Error reading keyword '%s'", UVES_SLITLENGTH(chip));
3172  }
3173 
3174  /* Convert from arcseconds to pixels */
3175  {
3176  double pixelscale; /* Arcseconds per pixel */
3177  int binx; /* The x-binning of the raw image
3178  is the y-binning of the extracted/rotated image */
3179 
3180  check_nomsg( pixelscale = uves_pfits_get_pixelscale(plist) );
3181 
3182  check( binx = uves_pfits_get_binx(plist),
3183  "Could not get x-binning");
3184 
3185  slitlength_pixels = slitlength_arcsecs / (pixelscale * binx);
3186  }
3187 
3188  cleanup:
3189  return slitlength_pixels;
3190 }
3191 
3192 
3193 /*---------------------------------------------------------------------------*/
3199 /*---------------------------------------------------------------------------*/
3200 int
3202 {
3203  int plate_no;
3204 
3205  if (uves_propertylist_contains(raw_header,
3206  FLAMES_NEWPLATEID))
3207  {
3208  check( uves_get_property_value(raw_header, FLAMES_NEWPLATEID,
3209  CPL_TYPE_INT, &plate_no),
3210  "Error reading keyword '%s'", FLAMES_NEWPLATEID);
3211  }
3212  else if(uves_propertylist_contains(raw_header,
3213  FLAMES_OBS_PLATE_ID))
3214  {
3215  check( uves_get_property_value(raw_header, FLAMES_OBS_PLATE_ID,
3216  CPL_TYPE_INT, &plate_no),
3217  "Error reading keyword '%s'", FLAMES_NEWPLATEID);
3218  }
3219  else if (uves_propertylist_contains(raw_header,
3220  FLAMES_INS_SHUT09))
3221  {
3222  plate_no = 1;
3223  }
3224  else if (uves_propertylist_contains(raw_header,
3225  FLAMES_INS_SHUT10))
3226  {
3227  plate_no = 2;
3228  }
3229  else
3230  {
3231  plate_no = 0;
3232  uves_msg_warning("Missing raw header keywords %s, %s, %s and %s, "
3233  "setting plate number = %d",
3234  FLAMES_NEWPLATEID,
3235  FLAMES_OBS_PLATE_ID,
3236  FLAMES_INS_SHUT09,
3237  FLAMES_INS_SHUT10,
3238  plate_no);
3239  }
3240 
3241  cleanup:
3242  return plate_no;
3243 }
3244 
3245 
3246 /*---------------------------------------------------------------------------*/
3252 /*---------------------------------------------------------------------------*/
3253 double
3255 {
3256  double returnvalue = 0;
3257 
3258  check( uves_get_property_value(plist, FLAMES_DIT, CPL_TYPE_DOUBLE, &returnvalue),
3259  "Error reading keyword '%s'", FLAMES_DIT);
3260 
3261  cleanup:
3262  return returnvalue;
3263 }
3264 
3265 /*---------------------------------------------------------------------------*/
3271 /*---------------------------------------------------------------------------*/
3272 void
3274 {
3275  check( uves_propertylist_update_int(plist, FLAMES_NEWPLATEID, plate_no),
3276  "Error writing keyword '%s'", FLAMES_NEWPLATEID);
3277  cleanup:
3278  return;
3279 }
3280 
double uves_pfits_get_utc(const uves_propertylist *plist)
Find out the observation time.
Definition: uves_pfits.c:1067
int uves_pfits_get_prescanx(const uves_propertylist *plist, enum uves_chip chip)
Find out the x-prescan.
Definition: uves_pfits.c:594
int uves_pfits_get_firstabsorder(const uves_propertylist *plist)
Get first absolute order number.
Definition: uves_pfits.c:1734
cpl_error_code uves_pfits_set_wstart(uves_propertylist *plist, int order, double wstart)
Write the wstart keyword.
Definition: uves_pfits.c:2972
const cpl_property * uves_propertylist_get_const(const uves_propertylist *self, long position)
Access property list elements by index.
cpl_error_code uves_pfits_set_data_median(uves_propertylist *plist, double median)
Write the median pixel value.
Definition: uves_pfits.c:1816
int uves_pfits_get_datancom(const uves_propertylist *plist)
Find out the number of input raw frames.
Definition: uves_pfits.c:1212
double uves_pfits_get_uit(const uves_propertylist *plist)
Find out the user integration time.
Definition: uves_pfits.c:2100
int uves_flames_pfits_get_nflats(const uves_propertylist *plist)
Find out the NFLATS.
Definition: uves_pfits.c:2278
cpl_error_code uves_pfits_set_crpix2(uves_propertylist *plist, double crpix2)
Write the crpix2 keyword.
Definition: uves_pfits.c:2882
const char * uves_pfits_get_dpr_tech(const uves_propertylist *plist)
find out the data tech as defined by the DataFlow
Definition: uves_pfits.c:513
const char * uves_pfits_get_tpl_start(const uves_propertylist *plist)
Find out the tpl start.
Definition: uves_pfits.c:1043
double uves_pfits_get_tempcam(const uves_propertylist *plist, enum uves_chip chip)
find out the pressure value
Definition: uves_pfits.c:1313
int uves_pfits_get_nx(const uves_propertylist *plist, enum uves_chip chip)
Find out the OUT1 NX or OUT4 NX.
Definition: uves_pfits.c:2126
#define uves_msg_warning(...)
Print an warning message.
Definition: uves_msg.h:87
cpl_error_code uves_pfits_set_data_stddev(uves_propertylist *plist, double stddev)
Write the RMS error of pixel values.
Definition: uves_pfits.c:1796
int uves_flames_pfits_get_plateid(const uves_propertylist *raw_header)
read the plate id
Definition: uves_pfits.c:3201
int uves_pfits_get_ny(const uves_propertylist *plist, enum uves_chip chip)
Find out the OUT1 NY or OUT4 NY.
Definition: uves_pfits.c:2155
cpl_error_code uves_pfits_set_ctype1(uves_propertylist *plist, const char *ctype1)
Write the ctype1 keyword.
Definition: uves_pfits.c:2756
void uves_pfits_set_dpr_tech(uves_propertylist *plist, const char *tech)
Set DPR TECH value.
Definition: uves_pfits.c:2521
int uves_pfits_get_ovrscanx(const uves_propertylist *plist, enum uves_chip chip)
Find out the x-overscan.
Definition: uves_pfits.c:659
void uves_pfits_set_windownumber(uves_propertylist *plist, int window_number)
Write the window number.
Definition: uves_pfits.c:1944
void uves_pfits_set_history_val(uves_propertylist *plist, const char *name, const char *format,...)
Write integer value to HISTORY keyword.
Definition: uves_pfits.c:1579
void uves_pfits_set_hs(uves_propertylist *plist, int hs)
Write the 2d extractino slit length.
Definition: uves_pfits.c:2952
cpl_error_code uves_pfits_set_cdelt1(uves_propertylist *plist, double cdelt1)
Write the cdelt1 keyword.
Definition: uves_pfits.c:2899
char uves_pfits_get_chipchoice(const uves_propertylist *plist)
find out the frame
Definition: uves_pfits.c:212
int uves_pfits_get_ocs_simcal(const uves_propertylist *plist)
Read the SIMCAL flag.
Definition: uves_pfits.c:459
double uves_pfits_get_slitlength_pixels(const uves_propertylist *plist, enum uves_chip chip)
Read the slit length in pixels.
Definition: uves_pfits.c:3141
double uves_pfits_get_tel_alt_start(const uves_propertylist *plist)
Find out the start telescope altitude.
Definition: uves_pfits.c:781
const char * uves_pfits_get_cunit1(const uves_propertylist *plist)
Find out the cunit1.
Definition: uves_pfits.c:2024
double uves_pfits_get_bscale(const uves_propertylist *plist)
Find out the bscale.
Definition: uves_pfits.c:2004
const char * uves_pfits_get_arcfile(const uves_propertylist *plist)
find out the arcfile
Definition: uves_pfits.c:272
cpl_error_code uves_pfits_set_stoptime(uves_propertylist *plist, const char *stop_time)
Write the stop time.
Definition: uves_pfits.c:2642
cpl_error_code uves_pfits_set_tunit_no(uves_propertylist *plist, const int col_no, const char *tunit)
Write the tunit keyword.
Definition: uves_pfits.c:2697
int uves_pfits_get_lastabsorder(const uves_propertylist *plist)
Get last absolute order number.
Definition: uves_pfits.c:1764
const char * uves_pfits_get_cunit2(const uves_propertylist *plist)
Find out the cunit2.
Definition: uves_pfits.c:2043
const char * uves_pfits_get_badpxframe(const uves_propertylist *plist)
find out the frame
Definition: uves_pfits.c:229
int uves_pfits_get_windownumber(const uves_propertylist *plist)
Get the window number.
Definition: uves_pfits.c:1972
double uves_pfits_get_gain(const uves_propertylist *plist, enum uves_chip chip)
Find out the gain.
Definition: uves_pfits.c:887
double uves_pfits_get_geolat(const uves_propertylist *plist)
Find out the telescope latitude.
Definition: uves_pfits.c:1104
#define check_nomsg(CMD)
Definition: uves_error.h:204
int uves_pfits_get_ordpred(const uves_propertylist *plist)
Read the predicted number of orders.
Definition: uves_pfits.c:1522
cpl_error_code uves_pfits_set_crval1(uves_propertylist *plist, double crval1)
Write the crval1 keyword.
Definition: uves_pfits.c:2829
const char * uves_pfits_get_dpr_catg(const uves_propertylist *plist)
find out the data category as defined by the DataFlow
Definition: uves_pfits.c:440
const char * uves_pfits_get_drs_id(const uves_propertylist *plist)
Find out the drs id.
Definition: uves_pfits.c:1017
double uves_pfits_get_geolon(const uves_propertylist *plist)
Find out the telescope longitude.
Definition: uves_pfits.c:1122
double uves_pfits_get_cdelt2(const uves_propertylist *plist)
Find out the cdelt2.
Definition: uves_pfits.c:2483
cpl_error_code uves_pfits_set_bunit_no(uves_propertylist *plist, const int axis_no, const char *bunit)
Write the bunit keyword.
Definition: uves_pfits.c:2718
cpl_error_code uves_pfits_set_badpixcorr(uves_propertylist *plist, const char *corr)
Write the object keyword.
Definition: uves_pfits.c:2571
cpl_error_code uves_pfits_set_cunit2(uves_propertylist *plist, const char *cunit2)
Write the cunit2 keyword.
Definition: uves_pfits.c:2811
cpl_error_code uves_pfits_set_object(uves_propertylist *plist, const char *object)
Write the object keyword.
Definition: uves_pfits.c:2554
int uves_pfits_get_out4nx(const uves_propertylist *plist)
Find out the OUT4 NX.
Definition: uves_pfits.c:2220
double uves_pfits_get_gratwlen(const uves_propertylist *plist, enum uves_chip chip)
find out the central wavelength
Definition: uves_pfits.c:1371
const char * uves_pfits_get_targ_name(const uves_propertylist *plist)
Get target name.
Definition: uves_pfits.c:865
cpl_error_code uves_propertylist_update_string(uves_propertylist *self, const char *name, const char *value)
Update a property list with a string value.
int uves_pfits_get_naxis2(const uves_propertylist *plist)
Find out the NAXIS2.
Definition: uves_pfits.c:2375
int uves_pfits_get_slit3_x2encoder(const uves_propertylist *plist)
find out the value of UVES_ENCODER_REF2
Definition: uves_pfits.c:174
double uves_pfits_get_slitwidth(const uves_propertylist *plist, enum uves_chip chip)
find out the slit width
Definition: uves_pfits.c:1504
double uves_pfits_get_ambipress(const uves_propertylist *plist)
find out the arcfile
Definition: uves_pfits.c:251
void uves_flames_pfits_set_newplateid(uves_propertylist *plist, int plate_no)
Write the plate number.
Definition: uves_pfits.c:3273
const char * uves_pfits_get_pro_catg(const uves_propertylist *plist)
find out the product category as defined by the DataFlow
Definition: uves_pfits.c:494
const char * uves_pfits_get_slit1_name(const uves_propertylist *plist)
Get image slicer name.
Definition: uves_pfits.c:3116
int uves_pfits_get_naxis(const uves_propertylist *plist)
Find out the NAXIS.
Definition: uves_pfits.c:2259
const char * uves_pfits_get_chip_name(const uves_propertylist *plist, enum uves_chip chip)
Find out the chip name.
Definition: uves_pfits.c:639
double uves_pfits_get_wstart(const uves_propertylist *plist, int order)
Read the wstart keyword.
Definition: uves_pfits.c:3004
const char * uves_pfits_get_origfile(const uves_propertylist *plist)
find out the origfile
Definition: uves_pfits.c:334
const char * uves_flames_pfits_get_object(const uves_propertylist *plist)
find out the OBJECT
Definition: uves_pfits.c:314
double uves_pfits_get_crpix2(const uves_propertylist *plist)
Find out the crpix2.
Definition: uves_pfits.c:2447
cpl_error_code uves_pfits_set_bscale(uves_propertylist *plist, const double bscale)
Write the bscale keyword.
Definition: uves_pfits.c:2678
cpl_type uves_propertylist_get_type(const uves_propertylist *self, const char *name)
Get the the type of a property list entry.
long uves_propertylist_get_size(const uves_propertylist *self)
Get the current size of a property list.
int uves_pfits_get_binx(const uves_propertylist *plist)
Find out the x binning factor.
Definition: uves_pfits.c:1176
static double parse_history(const uves_propertylist *plist, const char *name, cpl_type type)
Parse the value of a HISTORY keyword.
Definition: uves_pfits.c:1653
#define uves_msg(...)
Print a message on 'info' or 'debug' level.
Definition: uves_msg.h:119
void uves_pfits_set_dpr_catg(uves_propertylist *plist, const char *catg)
Set DPR CATG value.
Definition: uves_pfits.c:2504
cpl_error_code uves_propertylist_set_comment(uves_propertylist *self, const char *name, const char *comment)
Modify the comment field of the given property list entry.
const char * uves_propertylist_get_string(const uves_propertylist *self, const char *name)
Get the string value of the given property list entry.
double uves_pfits_get_ra(const uves_propertylist *plist)
Find out the right ascension.
Definition: uves_pfits.c:1140
void uves_pfits_set_traceid(uves_propertylist *plist, int trace_id)
Write the trace ID.
Definition: uves_pfits.c:1888
cpl_error_code uves_pfits_set_ctype2(uves_propertylist *plist, const char *ctype2)
Write the ctype2 keyword.
Definition: uves_pfits.c:2773
const char * uves_pfits_get_bunit(const uves_propertylist *plist)
Find out the bunit.
Definition: uves_pfits.c:1985
double uves_pfits_get_mjdobs(const uves_propertylist *plist)
Find out the modified julian observation date.
Definition: uves_pfits.c:1086
int uves_pfits_get_slit3_x1encoder(const uves_propertylist *plist)
find out the value of UVES_ENCODER_REF1
Definition: uves_pfits.c:156
cpl_error_code uves_pfits_set_crpix1(uves_propertylist *plist, double crpix1)
Write the crpix1 keyword.
Definition: uves_pfits.c:2864
int uves_pfits_get_biny(const uves_propertylist *plist)
Find out the y binning factor.
Definition: uves_pfits.c:1194
double uves_pfits_get_starty(const uves_propertylist *plist)
Find out the STARTY.
Definition: uves_pfits.c:2356
cpl_error_code uves_pfits_set_data_max(uves_propertylist *plist, double max)
Write the max pixel value.
Definition: uves_pfits.c:1852
void uves_pfits_set_cd11(uves_propertylist *plist, double value)
Write the CD1_1 value.
Definition: uves_pfits.c:95
double uves_flames_pfits_get_dit(const uves_propertylist *plist)
Find out the integration time.
Definition: uves_pfits.c:3254
char uves_propertylist_get_char(const uves_propertylist *self, const char *name)
Get the character value of the given property list entry.
double uves_pfits_get_dec(const uves_propertylist *plist)
Find out the declination.
Definition: uves_pfits.c:1158
int uves_pfits_get_out1nx(const uves_propertylist *plist)
Find out the OUT1 NX.
Definition: uves_pfits.c:2182
bool uves_ccd_is_new(const uves_propertylist *plist)
Find out if CCD header is new.
Definition: uves_pfits.c:553
cpl_error_code uves_pfits_set_starttime(uves_propertylist *plist, const char *start_time)
Write the start time.
Definition: uves_pfits.c:2625
const char * uves_pfits_get_gratname(const uves_propertylist *plist, enum uves_chip chip)
find out the grating name value
Definition: uves_pfits.c:1427
double uves_pfits_get_pressure(const uves_propertylist *plist)
find out the pressure value
Definition: uves_pfits.c:1269
double uves_pfits_get_exptime(const uves_propertylist *plist)
Find out the exposure time in seconds.
Definition: uves_pfits.c:922
cpl_error_code uves_pfits_set_redlevel(uves_propertylist *plist, const char *redlevel)
Write the reduction level.
Definition: uves_pfits.c:2589
#define assure_mem(PTR)
Definition: uves_error.h:181
void uves_pfits_set_cd12(uves_propertylist *plist, double value)
Write the CD1_2 value.
Definition: uves_pfits.c:110
const char * uves_pfits_get_ccdid(const uves_propertylist *plist)
find out the ccd id
Definition: uves_pfits.c:1251
const char * uves_pfits_get_insmode(const uves_propertylist *plist)
find out the chip name value
Definition: uves_pfits.c:1391
const char * uves_pfits_get_inspath(const uves_propertylist *plist)
find out the chip name value
Definition: uves_pfits.c:1409
cpl_error_code uves_pfits_set_cdelt2(uves_propertylist *plist, double cdelt2)
Write the cdelt2 keyword.
Definition: uves_pfits.c:2935
const char * uves_pfits_get_readspeed(const uves_propertylist *plist)
find out the readout speed
Definition: uves_pfits.c:1446
void uves_pfits_set_ra(uves_propertylist *plist, double ra)
Write the right ascension.
Definition: uves_pfits.c:982
double uves_pfits_get_startx(const uves_propertylist *plist)
Find out the START1.
Definition: uves_pfits.c:2336
cpl_error_code uves_pfits_set_extname(uves_propertylist *plist, const char *extname)
Write the EXTNAME keyword.
Definition: uves_pfits.c:2736
int uves_pfits_get_prescany(const uves_propertylist *plist, enum uves_chip chip)
Find out the y-prescan.
Definition: uves_pfits.c:684
int uves_propertylist_get_int(const uves_propertylist *self, const char *name)
Get the integer value of the given property list entry.
cpl_error_code uves_pfits_set_status(uves_propertylist *plist, const char *status)
Write the status.
Definition: uves_pfits.c:2607
cpl_error_code uves_pfits_set_data_average(uves_propertylist *plist, double average)
Write the average pixel value.
Definition: uves_pfits.c:1778
const char * uves_tostring_cpl_type(cpl_type t)
Convert a CPL type to a string.
Definition: uves_dump.c:378
const char * uves_pfits_get_date_obs(const uves_propertylist *plist)
find out the date of observation
Definition: uves_pfits.c:421
double uves_pfits_get_airmass_end(const uves_propertylist *plist)
Find out the end airmass.
Definition: uves_pfits.c:820
cpl_error_code uves_pfits_set_exptime(uves_propertylist *plist, double exptime)
Write the exposure time.
Definition: uves_pfits.c:944
int uves_pfits_get_out4ny(const uves_propertylist *plist)
Find out the OUT4 NY.
Definition: uves_pfits.c:2239
bool uves_format_is_new(const uves_propertylist *plist)
Find out FITS header format.
Definition: uves_pfits.c:573
void uves_pfits_set_lastabsorder(uves_propertylist *plist, int last_abs_order)
Write the last absolute order number.
Definition: uves_pfits.c:1750
cpl_error_code uves_pfits_set_cunit1(uves_propertylist *plist, const char *cunit1)
Write the cunit1 keyword.
Definition: uves_pfits.c:2793
double uves_pfits_get_pixelscale(const uves_propertylist *plist)
Get pixel scale.
Definition: uves_pfits.c:3097
const char * uves_pfits_get_dpr_type(const uves_propertylist *plist)
find out the data type as defined by the DataFlow
Definition: uves_pfits.c:532
double uves_pfits_get_cdelt1(const uves_propertylist *plist)
Find out the cdelt1.
Definition: uves_pfits.c:2465
double uves_pfits_get_humidity(const uves_propertylist *plist)
find out the humidity value
Definition: uves_pfits.c:1332
const char * uves_flames_pfits_get_ident(const uves_propertylist *plist)
find out the ident
Definition: uves_pfits.c:294
double uves_pfits_get_crval1(const uves_propertylist *plist)
Find out the crval1.
Definition: uves_pfits.c:2393
cpl_error_code uves_pfits_set_bunit(uves_propertylist *plist, const char *bunit)
Write the bunit keyword.
Definition: uves_pfits.c:2660
int uves_pfits_get_maxfibres(const uves_propertylist *plist)
find out the frame
Definition: uves_pfits.c:193
void uves_pfits_set_cd1(uves_propertylist *plist, double value)
Write the CD1 value.
Definition: uves_pfits.c:79
cpl_error_code uves_pfits_set_wend(uves_propertylist *plist, int order, double wend)
Write the wend keyword.
Definition: uves_pfits.c:3035
const char * uves_pfits_get_gratid(const uves_propertylist *plist, enum uves_chip chip)
find out the grating ID value
Definition: uves_pfits.c:1465
int uves_pfits_get_out1ny(const uves_propertylist *plist)
Find out the OUT1 NY.
Definition: uves_pfits.c:2201
int uves_pfits_get_naxis1(const uves_propertylist *plist)
Find out the NAXIS1.
Definition: uves_pfits.c:2316
cpl_error_code uves_pfits_set_wlen1(uves_propertylist *plist, double wlen1)
Write the WLEN1 value.
Definition: uves_pfits.c:1873
cpl_error_code uves_pfits_set_ordpred(uves_propertylist *plist, int nord)
Write the predicted number of order.
Definition: uves_pfits.c:1000
const char * uves_pfits_get_templateid(const uves_propertylist *plist)
find out the template id
Definition: uves_pfits.c:399
int uves_propertylist_contains(const uves_propertylist *self, const char *name)
Check whether a property is present in a property list.
const char * uves_pfits_get_rec1raw1name(const uves_propertylist *plist)
find out the arcfile
Definition: uves_pfits.c:380
cpl_error_code uves_pfits_set_data_min(uves_propertylist *plist, double min)
Write the min pixel value.
Definition: uves_pfits.c:1834
int uves_pfits_get_traceid(const uves_propertylist *plist)
Get the trace ID number.
Definition: uves_pfits.c:1959
#define check(CMD,...)
Definition: uves_error.h:198
double uves_pfits_get_crval2(const uves_propertylist *plist)
Find out the crval2.
Definition: uves_pfits.c:2411
void uves_pfits_set_dec(uves_propertylist *plist, double dec)
Write the declination.
Definition: uves_pfits.c:964
cpl_error_code uves_propertylist_update_int(uves_propertylist *self, const char *name, int value)
Update a property list with a integer value.
const char * uves_chop_eso_prefix(const char *key)
chop the "ESO " prefix
Definition: uves_pfits.c:1288
void uves_pfits_set_ocs_simcal(uves_propertylist *plist, int simcal)
Set the SIMCAL flag.
Definition: uves_pfits.c:477
int uves_pfits_get_bitpix(const uves_propertylist *plist)
Find out the BITPIX.
Definition: uves_pfits.c:2298
void uves_pfits_set_cd22(uves_propertylist *plist, double value)
Write the CD2_2 value.
Definition: uves_pfits.c:140
const char * uves_pfits_get_chipid(const uves_propertylist *plist, enum uves_chip chip)
Find out the chip ID.
Definition: uves_pfits.c:619
void uves_pfits_set_firstabsorder(uves_propertylist *plist, int first_abs_order)
Write the first absolute order number.
Definition: uves_pfits.c:1717
void uves_pfits_set_cd21(uves_propertylist *plist, double value)
Write the CD2_1 value.
Definition: uves_pfits.c:125
double uves_pfits_get_slitlength(const uves_propertylist *plist, enum uves_chip chip)
find out the slit length
Definition: uves_pfits.c:1484
double uves_pfits_get_offset(const uves_propertylist *plist)
Get the trace offset.
Definition: uves_pfits.c:1902
double uves_pfits_get_crpix1(const uves_propertylist *plist)
Find out the crpix1.
Definition: uves_pfits.c:2429
double uves_pfits_get_wlen1(const uves_propertylist *plist)
find out the WLEN1 wavelength value
Definition: uves_pfits.c:1350
void uves_flames_pfits_set_ccfposmax(uves_propertylist *plist, double ccfposmax)
Write the ccfposmax keyword (what is it?)
Definition: uves_pfits.c:2917
const char * uves_pfits_get_ctype2(const uves_propertylist *plist)
Find out the ctype2.
Definition: uves_pfits.c:2081
const char * uves_pfits_get_pipefile(const uves_propertylist *plist)
find out the pipefile
Definition: uves_pfits.c:355
void uves_pfits_set_dpr_type(uves_propertylist *plist, const char *type)
Set DPR TYPE value.
Definition: uves_pfits.c:2537
double uves_pfits_get_airmass_start(const uves_propertylist *plist)
Find out the start airmass.
Definition: uves_pfits.c:801
double uves_pfits_get_ron_adu(const uves_propertylist *plist, enum uves_chip chip)
Find out the readout noise in ADU.
Definition: uves_pfits.c:740
void uves_pfits_set_offset(uves_propertylist *plist, double trace_offset)
Write the trace offset.
Definition: uves_pfits.c:1929
double uves_pfits_get_wend(const uves_propertylist *plist, int order)
Read the wend keyword.
Definition: uves_pfits.c:3067
cpl_error_code uves_propertylist_update_double(uves_propertylist *self, const char *name, double value)
Update a property list with a double value.
double uves_pfits_get_conad(const uves_propertylist *plist, enum uves_chip chip)
Find out the conad.
Definition: uves_pfits.c:840
const char * uves_pfits_get_ctype1(const uves_propertylist *plist)
Find out the ctype1.
Definition: uves_pfits.c:2062
int uves_pfits_get_ovrscany(const uves_propertylist *plist, enum uves_chip chip)
Find out the y-overscan.
Definition: uves_pfits.c:710
cpl_error_code uves_pfits_set_crval2(uves_propertylist *plist, double crval2)
Write the crval2 keyword.
Definition: uves_pfits.c:2847