24 #ifdef HAVE_SYS_TYPES_H
25 # include <sys/types.h>
32 #include <cxstrutils.h>
35 #include <cpl_error.h>
36 #include <cpl_matrix.h>
37 #include <cpl_version.h>
40 #include "gimessages.h"
57 static const cxchar *_giraffe_license =
58 " This file is part of the GIRAFFE Instrument Pipeline\n"
59 " Copyright (C) 2002-2014 European Southern Observatory\n"
61 " This program is free software; you can redistribute it and/or modify\n"
62 " it under the terms of the GNU General Public License as published by\n"
63 " the Free Software Foundation; either version 2 of the License, or\n"
64 " (at your option) any later version.\n"
66 " This program is distributed in the hope that it will be useful,\n"
67 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
68 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
69 " GNU General Public License for more details.\n"
71 " You should have received a copy of the GNU General Public License\n"
72 " along with this program; if not, write to the Free Software\n"
73 " Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301"
78 _giraffe_plist_append(cpl_propertylist *
self, cpl_property *p)
81 const cxchar *name = cpl_property_get_name(p);
82 const cxchar *comment = cpl_property_get_comment(p);
85 switch (cpl_property_get_type(p)) {
88 cxbool value = cpl_property_get_bool(p);
90 cpl_propertylist_append_bool(
self, name, value);
96 cxchar value = cpl_property_get_char(p);
98 cpl_propertylist_append_char(
self, name, value);
104 cxint value = cpl_property_get_int(p);
106 cpl_propertylist_append_int(
self, name, value);
112 cxlong value = cpl_property_get_long(p);
114 cpl_propertylist_append_long(
self, name, value);
120 cxfloat value = cpl_property_get_float(p);
122 cpl_propertylist_append_float(
self, name, value);
126 case CPL_TYPE_DOUBLE:
128 cxdouble value = cpl_property_get_double(p);
130 cpl_propertylist_append_double(
self, name, value);
134 case CPL_TYPE_STRING:
136 const cxchar *value = cpl_property_get_string(p);
138 cpl_propertylist_append_string(
self, name, value);
154 if (comment != NULL) {
155 cpl_propertylist_set_comment(
self, name, comment);
164 _giraffe_add_frame_info(cpl_propertylist *plist,
const cxchar *name,
165 const cxchar *tag, cxint sequence, cxint frame_index,
169 const cxchar *
id = NULL;
170 const cxchar *group = NULL;
174 cx_string *key = NULL;
175 cx_string *comment = NULL;
190 group =
"calibration";
198 key = cx_string_new();
199 comment = cx_string_new();
206 cx_string_sprintf(key,
"%s%-d %s%-d %s",
"ESO PRO REC", sequence,
id,
207 frame_index,
"NAME");
208 cx_string_sprintf(comment,
"%s %s %s",
"File name of", group,
"frame");
210 status = cpl_propertylist_update_string(plist, cx_string_get(key), name);
212 if (status != CPL_ERROR_NONE) {
213 cx_string_delete(key);
214 cx_string_delete(comment);
219 status = cpl_propertylist_set_comment(plist, cx_string_get(key),
220 cx_string_get(comment));
223 cx_string_delete(key);
224 cx_string_delete(comment);
234 cx_string_sprintf(key,
"%s%-d %s%-d %s",
"ESO PRO REC", sequence,
id,
235 frame_index,
"CATG");
236 cx_string_sprintf(comment,
"%s %s %s",
"Frame category of", group,
239 status = cpl_propertylist_update_string(plist, cx_string_get(key), tag);
241 if (status != CPL_ERROR_NONE) {
242 cx_string_delete(key);
243 cx_string_delete(comment);
248 status = cpl_propertylist_set_comment(plist, cx_string_get(key),
249 cx_string_get(comment));
252 cx_string_delete(key);
253 cx_string_delete(comment);
258 cx_string_delete(key);
259 cx_string_delete(comment);
267 _giraffe_add_option_info(cpl_propertylist *plist,
268 const cpl_parameterlist *options, cxint sequence)
270 cx_assert(plist != NULL);
271 cx_assert(options != NULL);
272 cx_assert(sequence >= 1);
274 cx_string *key = cx_string_new();
275 cx_string *comment = cx_string_new();
278 const cpl_parameter *p = cpl_parameterlist_get_first_const(options);
281 cx_string_delete(key);
282 cx_string_delete(comment);
289 const cxchar *alias = cpl_parameter_get_alias(p, CPL_PARAMETER_MODE_CLI);
290 cx_string *value = cx_string_new();
291 cx_string *preset = cx_string_new();
293 switch (cpl_parameter_get_type(p)) {
296 int bval = cpl_parameter_get_bool(p);
297 cx_string_sprintf(value,
"%s", (bval == 1) ?
"true" :
"false");
299 bval = cpl_parameter_get_default_bool(p);
300 cx_string_sprintf(preset,
"%s", (bval == 1) ?
"true" :
"false");
305 cx_string_sprintf(value,
"%d", cpl_parameter_get_int(p));
306 cx_string_sprintf(preset,
"%d", cpl_parameter_get_default_int(p));
309 case CPL_TYPE_DOUBLE:
311 cx_string_sprintf(value,
"%g", cpl_parameter_get_double(p));
312 cx_string_sprintf(preset,
"%g", cpl_parameter_get_default_double(p));
315 case CPL_TYPE_STRING:
317 cx_string_sprintf(value,
"%s", cpl_parameter_get_string(p));
318 cx_string_sprintf(preset,
"%s", cpl_parameter_get_default_string(p));
330 cx_string_delete(key);
331 cx_string_delete(comment);
332 cx_string_delete(value);
333 cx_string_delete(preset);
339 cx_string_sprintf(key,
"%s%-d %s%-d %s",
"ESO PRO REC", sequence,
340 "PARAM", pcount,
"NAME");
341 status = cpl_propertylist_update_string(plist, cx_string_get(key), alias);
344 cx_string_delete(key);
345 cx_string_delete(comment);
346 cx_string_delete(value);
347 cx_string_delete(preset);
352 status = cpl_propertylist_set_comment(plist, cx_string_get(key),
353 cpl_parameter_get_help(p));
356 cx_string_delete(key);
357 cx_string_delete(comment);
358 cx_string_delete(value);
359 cx_string_delete(preset);
365 cx_string_sprintf(key,
"%s%-d %s%-d %s",
"ESO PRO REC", sequence,
366 "PARAM", pcount,
"VALUE");
367 cx_string_sprintf(comment,
"Default: %s", cx_string_get(preset));
369 status = cpl_propertylist_update_string(plist, cx_string_get(key),
370 cx_string_get(value));
373 cx_string_delete(key);
374 cx_string_delete(comment);
375 cx_string_delete(value);
376 cx_string_delete(preset);
381 status = cpl_propertylist_set_comment(plist, cx_string_get(key),
382 cx_string_get(comment));
385 cx_string_delete(key);
386 cx_string_delete(comment);
387 cx_string_delete(value);
388 cx_string_delete(preset);
393 cx_string_delete(value);
394 cx_string_delete(preset);
396 p = cpl_parameterlist_get_next_const(options);
400 cx_string_delete(key);
401 cx_string_delete(comment);
421 return _giraffe_license;
443 const cxchar *fctid =
"giraffe_get_mode";
448 GiInstrumentMode insmode;
452 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
457 if (!cpl_propertylist_has(properties, GIALIAS_INSMODE)) {
458 gi_warning(
"%s: Property (%s) not found\n", fctid, GIALIAS_INSMODE);
460 if (!cpl_propertylist_has(properties, GIALIAS_SLITNAME)) {
461 cx_warning(
"%s: Property (%s) not found\n", fctid,
466 mode = cpl_propertylist_get_string(properties, GIALIAS_SLITNAME);
470 mode = cpl_propertylist_get_string(properties, GIALIAS_SLITNAME);
473 if (!mode || strlen(mode) == 0) {
474 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
479 s = cx_string_create(mode);
482 if (strncmp(cx_string_get(s),
"med", 3) == 0) {
483 insmode = GIMODE_MEDUSA;
485 else if (strncmp(cx_string_get(s),
"ifu", 3) == 0) {
486 insmode = GIMODE_IFU;
488 else if (strncmp(cx_string_get(s),
"arg", 3) == 0) {
489 insmode = GIMODE_ARGUS;
492 cpl_error_set(fctid, CPL_ERROR_UNSUPPORTED_MODE);
493 insmode = GIMODE_NONE;
521 register cxssize base;
522 register cxssize last_nonslash;
533 if (path[0] ==
'\0') {
534 return cx_strdup(
".");
537 last_nonslash = strlen(path) - 1;
539 while (last_nonslash >= 0 && path[last_nonslash] ==
'/') {
546 if (last_nonslash == -1) {
547 return cx_strdup(
"/");
550 base = last_nonslash;
552 while (base >=0 && path[base] !=
'/') {
556 len = last_nonslash - base;
558 result = cx_malloc(len + 1);
559 memcpy(result, path + base + 1, len);
585 time_t seconds = time(NULL);
587 cxchar *sdate = NULL;
589 cxulong milliseconds = 0;
591 cx_string *
self = cx_string_new();
594 cx_assert(
self != NULL);
596 ts = localtime(&seconds);
598 cx_string_sprintf(
self,
"%4d-%02d-%02dT%02d:%02d:%02d.%03ld",
607 sdate = cx_strdup(cx_string_get(
self));
608 cx_string_delete(
self);
634 cx_string *name = cx_string_new();
635 cx_string *value = cx_string_new();
638 cx_string_sprintf(name,
"%s%-d %s",
"ESO PRO REC", info->sequence,
640 cx_string_sprintf(value,
"%s", info->recipe);
642 status = cpl_propertylist_update_string(plist, cx_string_get(name),
643 cx_string_get(value));
646 if (status != CPL_ERROR_NONE) {
647 cx_string_delete(name);
648 cx_string_delete(value);
653 status = cpl_propertylist_set_comment(plist, cx_string_get(name),
654 "Pipeline recipe (unique) identifier");
657 cx_string_delete(name);
658 cx_string_delete(value);
663 cx_string_sprintf(name,
"%s%-d %s",
"ESO PRO REC", info->sequence,
665 cx_string_sprintf(value,
"%s/%s", PACKAGE, VERSION);
667 status = cpl_propertylist_update_string(plist, cx_string_get(name),
668 cx_string_get(value));
671 if (status != CPL_ERROR_NONE) {
672 cx_string_delete(name);
673 cx_string_delete(value);
678 status = cpl_propertylist_set_comment(plist, cx_string_get(name),
679 "Pipeline (unique) identifier");
682 cx_string_delete(name);
683 cx_string_delete(value);
688 cx_string_sprintf(name,
"%s%-d %s",
"ESO PRO REC", info->sequence,
690 cx_string_sprintf(value,
"cpl-%s", cpl_version_get_version());
692 status = cpl_propertylist_update_string(plist, cx_string_get(name),
693 cx_string_get(value));
696 if (status != CPL_ERROR_NONE) {
697 cx_string_delete(name);
698 cx_string_delete(value);
703 status = cpl_propertylist_set_comment(plist, cx_string_get(name),
704 "Data Reduction System identifier");
707 cx_string_delete(name);
708 cx_string_delete(value);
713 if (info->start != NULL) {
714 cx_string_sprintf(name,
"%s%-d %s",
"ESO PRO REC",
715 info->sequence,
"START");
716 status = cpl_propertylist_update_string(plist,
720 if (status != CPL_ERROR_NONE) {
721 cx_string_delete(name);
722 cx_string_delete(value);
727 status = cpl_propertylist_set_comment(plist, cx_string_get(name),
728 "Date when recipe execution "
732 cx_string_delete(name);
733 cx_string_delete(value);
739 cx_string_delete(name);
740 cx_string_delete(value);
747 status = _giraffe_add_option_info(plist, info->options, info->sequence);
795 cx_string *key = cx_string_new();
797 const cpl_frame *frame = NULL;
799 cpl_frameset_iterator *it = cpl_frameset_iterator_new(set);
802 while ((frame = cpl_frameset_iterator_get_const(it)) != NULL) {
804 cpl_frame_group group = cpl_frame_get_group(frame);
806 const cxchar *name = cpl_frame_get_filename(frame);
807 const cxchar *tag = cpl_frame_get_tag(frame);
811 cx_assert(base != NULL);
814 case CPL_FRAME_GROUP_RAW:
827 if (!cpl_propertylist_has(plist, GIALIAS_ANCESTOR)) {
831 cpl_propertylist *_plist = cpl_propertylist_load(name, 0);
833 if (_plist == NULL) {
836 cx_free((cxchar *)base);
839 cpl_frameset_iterator_delete(it);
840 cx_string_delete(key);
846 if (cpl_propertylist_has(_plist, GIALIAS_ANCESTOR)) {
847 cpl_propertylist_copy_property(plist, _plist,
853 cpl_propertylist_get_string(_plist,
855 const cxchar *c =
"Inherited archive file name "
856 "of the first raw data frame";
859 cpl_propertylist_append_string(plist,
860 GIALIAS_ANCESTOR, s);
861 cpl_propertylist_set_comment(plist,
862 GIALIAS_ANCESTOR, c);
867 cpl_propertylist_delete(_plist);
874 status = _giraffe_add_frame_info(plist, base, tag,
879 cx_free((cxchar *)base);
882 cpl_frameset_iterator_delete(it);
883 cx_string_delete(key);
892 case CPL_FRAME_GROUP_CALIB:
895 cpl_propertylist *_plist = NULL;
899 cxint status = _giraffe_add_frame_info(plist, base, tag,
900 sequence, ncalib, 1);
904 cx_free((cxchar *)base);
907 cpl_frameset_iterator_delete(it);
908 cx_string_delete(key);
913 _plist = cpl_propertylist_load(name, 0);
915 if (_plist == NULL) {
917 cx_free((cxchar *)base);
920 cpl_frameset_iterator_delete(it);
921 cx_string_delete(key);
927 if (cpl_propertylist_has(_plist, GIALIAS_DATAMD5)) {
930 cpl_propertylist_get_string(_plist, GIALIAS_DATAMD5);
932 if (strcmp(s,
"Not computed") != 0) {
934 cx_string* md5 = cx_string_new();
936 cx_string_sprintf(md5,
"%s%d %s%"
937 CX_PRINTF_FORMAT_SIZE_TYPE
"%s",
938 "ESO PRO REC", sequence,
"CAL",
942 cpl_propertylist_update_string(plist,
946 if (status != CPL_ERROR_NONE) {
947 cx_string_delete(md5);
948 cpl_propertylist_delete(_plist);
951 cx_free((cxchar *)base);
954 cpl_frameset_iterator_delete(it);
955 cx_string_delete(key);
960 cx_string_delete(md5);
965 cpl_propertylist_delete(_plist);
975 cx_free((cxchar *)base);
978 cpl_frameset_iterator_advance(it, 1);
982 cpl_frameset_iterator_delete(it);
983 cx_string_delete(key);
1014 cpl_propertylist *properties,
1015 const cxchar *regexp)
1018 const cxchar *fctid =
"giraffe_propertylist_update";
1024 cx_assert(
self != NULL);
1026 if (properties == NULL) {
1027 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
1031 sz = cpl_propertylist_get_size(properties);
1033 if (regexp == NULL || regexp[0] ==
'\0') {
1035 for (i = 0; i < sz; i++) {
1037 cpl_property *p = cpl_propertylist_get(properties, i);
1038 const cxchar *name = cpl_property_get_name(p);
1041 if (!cpl_propertylist_has(
self, name)) {
1043 cxint status = _giraffe_plist_append(
self, p);
1046 cpl_error_set(fctid, CPL_ERROR_INVALID_TYPE);
1059 status = regcomp(&re, regexp, REG_EXTENDED | REG_NOSUB);
1062 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
1066 for (i = 0; i < sz; i++) {
1068 cpl_property *p = cpl_propertylist_get(properties, i);
1069 const cxchar *name = cpl_property_get_name(p);
1072 if (regexec(&re, name, (
size_t)0, NULL, 0) == REG_NOMATCH) {
1076 if (!cpl_propertylist_has(
self, name)) {
1078 status = _giraffe_plist_append(
self, p);
1081 cpl_error_set(fctid, CPL_ERROR_INVALID_TYPE);
1106 const cpl_propertylist *other,
1107 const cxchar *othername)
1110 const cxchar *fctid =
"giraffe_propertylist_copy";
1114 const cxchar *comment;
1120 cx_assert(
self != NULL);
1122 if (other == NULL) {
1126 if (othername == NULL) {
1130 if (!cpl_propertylist_has(other, othername)) {
1134 type = cpl_propertylist_get_type(other, othername);
1141 s = name == NULL ? othername : name;
1151 cxchar value = cpl_propertylist_get_char(other, othername);
1153 if (cpl_propertylist_has(
self, s)) {
1154 cpl_propertylist_set_char(
self, s, value);
1157 cpl_propertylist_append_char(
self, s, value);
1164 cxbool value = cpl_propertylist_get_bool(other, othername);
1166 if (cpl_propertylist_has(
self, s)) {
1167 cpl_propertylist_set_bool(
self, s, value);
1170 cpl_propertylist_append_bool(
self, s, value);
1177 cxint value = cpl_propertylist_get_int(other, othername);
1179 if (cpl_propertylist_has(
self, s)) {
1180 cpl_propertylist_set_int(
self, s, value);
1183 cpl_propertylist_append_int(
self, s, value);
1190 cxlong value = cpl_propertylist_get_long(other, othername);
1192 if (cpl_propertylist_has(
self, s)) {
1193 cpl_propertylist_set_long(
self, s, value);
1196 cpl_propertylist_append_long(
self, s, value);
1201 case CPL_TYPE_FLOAT:
1203 cxfloat value = cpl_propertylist_get_float(other, othername);
1205 if (cpl_propertylist_has(
self, s)) {
1206 cpl_propertylist_set_float(
self, s, value);
1209 cpl_propertylist_append_float(
self, s, value);
1214 case CPL_TYPE_DOUBLE:
1216 cxdouble value = cpl_propertylist_get_double(other, othername);
1218 if (cpl_propertylist_has(
self, s)) {
1219 cpl_propertylist_set_double(
self, s, value);
1222 cpl_propertylist_append_double(
self, s, value);
1227 case CPL_TYPE_STRING:
1229 const cxchar *value = cpl_propertylist_get_string(other,
1232 if (cpl_propertylist_has(
self, s)) {
1233 cpl_propertylist_set_string(
self, s, value);
1236 cpl_propertylist_append_string(
self, s, value);
1242 cpl_error_set(fctid, CPL_ERROR_INVALID_TYPE);
1247 comment = cpl_propertylist_get_comment(other, othername);
1249 if (comment != NULL) {
1250 cpl_propertylist_set_comment(
self, s, comment);
1259 giraffe_propertylist_update_wcs(cpl_propertylist* properties, cxsize naxis,
1260 const cxdouble* crpix,
const cxdouble* crval,
1261 const cxchar** ctype,
const cxchar** cunit,
1262 const cpl_matrix* cd)
1265 if (properties == NULL) {
1269 cpl_propertylist_erase_regexp(properties,
"^CRPIX[0-9]", 0);
1270 cpl_propertylist_erase_regexp(properties,
"^CRVAL[0-9]", 0);
1271 cpl_propertylist_erase_regexp(properties,
"^CDELT[0-9]", 0);
1272 cpl_propertylist_erase_regexp(properties,
"^CTYPE[0-9]", 0);
1273 cpl_propertylist_erase_regexp(properties,
"^CUNIT[0-9]", 0);
1274 cpl_propertylist_erase_regexp(properties,
"^CROTA[0-9]", 0);
1275 cpl_propertylist_erase_regexp(properties,
"^CD[0-9]*_[0-9]", 0);
1276 cpl_propertylist_erase_regexp(properties,
"^PC[0-9]*_[0-9]", 0);
1282 register cxsize i = 0;
1284 cx_string* keyword = cx_string_new();
1285 cx_string* comment = cx_string_new();
1288 cx_assert(cpl_matrix_get_nrow(cd) == cpl_matrix_get_ncol(cd));
1290 for (i = 0; i < naxis; i++) {
1292 cx_string_sprintf(keyword,
"CTYPE%-" CX_PRINTF_FORMAT_SIZE_TYPE,
1294 cx_string_sprintf(comment,
"Coordinate system of axis %"
1295 CX_PRINTF_FORMAT_SIZE_TYPE, i + 1);
1296 cpl_propertylist_append_string(properties,
1297 cx_string_get(keyword), ctype[i]);
1298 cpl_propertylist_set_comment(properties, cx_string_get(keyword),
1299 cx_string_get(comment));
1303 for (i = 0; i < naxis; i++) {
1305 cx_string_sprintf(keyword,
"CRPIX%-" CX_PRINTF_FORMAT_SIZE_TYPE,
1307 cx_string_sprintf(comment,
"Reference pixel of axis %"
1308 CX_PRINTF_FORMAT_SIZE_TYPE, i + 1);
1309 cpl_propertylist_append_double(properties,
1310 cx_string_get(keyword), crpix[i]);
1311 cpl_propertylist_set_comment(properties, cx_string_get(keyword),
1312 cx_string_get(comment));
1316 for (i = 0; i < naxis; i++) {
1318 cx_string_sprintf(keyword,
"CRVAL%-" CX_PRINTF_FORMAT_SIZE_TYPE,
1320 cx_string_sprintf(comment,
"Coordinate of axis %"
1321 CX_PRINTF_FORMAT_SIZE_TYPE
" at reference "
1323 cpl_propertylist_append_double(properties,
1324 cx_string_get(keyword), crval[i]);
1325 cpl_propertylist_set_comment(properties, cx_string_get(keyword),
1326 cx_string_get(comment));
1330 for (i = 0; i < naxis; i++) {
1332 if (cunit[i] != NULL) {
1333 cx_string_sprintf(keyword,
"CUNIT%-"
1334 CX_PRINTF_FORMAT_SIZE_TYPE, i + 1);
1335 cx_string_sprintf(comment,
"Unit of coordinate axis %"
1336 CX_PRINTF_FORMAT_SIZE_TYPE, i + 1);
1337 cpl_propertylist_append_string(properties,
1338 cx_string_get(keyword),
1340 cpl_propertylist_set_comment(properties,
1341 cx_string_get(keyword),
1342 cx_string_get(comment));
1352 for (i = 0; i < naxis; i++) {
1354 register cxsize j = 0;
1357 for (j = 0; j < naxis; j++) {
1359 cx_string_sprintf(keyword,
"CD%-" CX_PRINTF_FORMAT_SIZE_TYPE
1360 "_%-" CX_PRINTF_FORMAT_SIZE_TYPE, i + 1,
1362 cx_string_sprintf(comment,
"Coordinate transformation matrix "
1364 cpl_propertylist_append_double(properties,
1365 cx_string_get(keyword),
1366 cpl_matrix_get(cd, i, j));
1367 cpl_propertylist_set_comment(properties,
1368 cx_string_get(keyword),
1369 cx_string_get(comment));
1374 cx_string_delete(keyword);
1377 cx_string_delete(comment);
1388 giraffe_frameset_set_groups(cpl_frameset* set, GiGroupInfo *groups)
1391 cpl_frame* frame = NULL;
1393 cpl_frameset_iterator *it = NULL;
1400 if (groups == NULL || groups->tag == NULL) {
1404 it = cpl_frameset_iterator_new(set);
1406 while ((frame = cpl_frameset_iterator_get(it)) != NULL) {
1408 const cxchar* tag = cpl_frame_get_tag(frame);
1411 cpl_frame_get_group(frame) == CPL_FRAME_GROUP_NONE) {
1413 const GiGroupInfo* g = groups;
1415 while (g->tag != NULL) {
1416 if (strcmp(tag, g->tag) == 0) {
1417 cpl_frame_set_group(frame, g->group);
1425 cpl_frameset_iterator_advance(it, 1);
1429 cpl_frameset_iterator_delete(it);
1472 const cxchar*
const fctid =
"giraffe_propertylist_get_conad";
1474 const cxchar *names[2] = {GIALIAS_CONAD, GIALIAS_CONAD_LEGACY};
1475 const cxchar *name = NULL;
1477 cxdouble conad = 1.;
1480 cx_assert(properties != NULL);
1483 if (!cpl_propertylist_has(properties, GIALIAS_CONAD)) {
1485 if (!cpl_propertylist_has(properties, GIALIAS_CONAD_LEGACY)) {
1487 cpl_msg_error(fctid,
"Missing detector gain property (%s, %s)! ",
1488 GIALIAS_CONAD, GIALIAS_CONAD_LEGACY);
1489 cpl_error_set(fctid, CPL_ERROR_DATA_NOT_FOUND);
1504 conad = cpl_propertylist_get_double(properties, name);
1508 cpl_msg_error(fctid,
"Invalid conversion factor (%s) %.3g "
1509 "[e-/ADU]", name, conad);
1510 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
1556 const cxchar*
const fctid =
"giraffe_propertylist_get_ron";
1562 cx_assert(properties != NULL);
1564 if (!cpl_propertylist_has(properties, GIALIAS_BIASSIGMA)) {
1565 if (!cpl_propertylist_has(properties, GIALIAS_RON)) {
1566 cpl_msg_error(fctid,
"Missing detector read-out noise "
1567 "property (%s)!", GIALIAS_RON);
1568 cpl_error_set(fctid, CPL_ERROR_DATA_NOT_FOUND);
1579 cpl_msg_warning(fctid,
"Missing bias RMS property (%s)! "
1580 "Using detector read-out noise property (%s).",
1581 GIALIAS_BIASSIGMA, GIALIAS_RON);
1582 ron = cpl_propertylist_get_double(properties, GIALIAS_RON);
1587 cxdouble conad = 0.;
1595 giraffe_error_push();
1599 if (cpl_error_get_code() != CPL_ERROR_NONE) {
1603 giraffe_error_pop();
1605 ron = cpl_propertylist_get_double(properties, GIALIAS_BIASSIGMA) *
void gi_warning(const cxchar *format,...)
Log a warning.
cxint giraffe_add_recipe_info(cpl_propertylist *plist, const GiRecipeInfo *info)
Add recipe specific information to a property list.
cxint giraffe_add_frameset_info(cpl_propertylist *plist, const cpl_frameset *set, cxint sequence)
Add frameset specific information to a property list.
cxchar * giraffe_path_get_basename(const cxchar *path)
Gets the name of a file without any leading directory components.
cxchar * giraffe_localtime_iso8601(void)
Get the current date and time in ISO 8601 format.
cxint giraffe_propertylist_copy(cpl_propertylist *self, const cxchar *name, const cpl_propertylist *other, const cxchar *othername)
Copy a property from one list to another.
cxdouble giraffe_propertylist_get_conad(const cpl_propertylist *properties)
Retrieve the ADU to electrons conversion factor from the given properties.
cxint giraffe_propertylist_update(cpl_propertylist *self, cpl_propertylist *properties, const cxchar *regexp)
Update a property list.
const cxchar * giraffe_get_license(void)
Get the pipeline copyright and license.
cxdouble giraffe_propertylist_get_ron(const cpl_propertylist *properties)
Retrieve the read-out noise from the given properties.
GiInstrumentMode giraffe_get_mode(cpl_propertylist *properties)
Determines the instrument mode from a property list.