28#include <cxstrutils.h>
29#include <cxmessages.h>
31#include <cpl_propertylist.h>
39#include "gimessages.h"
41#include "gifiberutils.h"
53_giraffe_compare_int(cxcptr first, cxcptr second)
56 cxint *_first = (cxint *)first;
57 cxint *_second = (cxint *)second;
59 return *_first - *_second;
89 const cxchar *
const fctid =
"giraffe_fiberlist_create";
102 cx_string *slit_name = NULL;
104 cpl_table *fibers = NULL;
106 cpl_table *_ozpoz = NULL;
108 cpl_propertylist *properties = NULL;
109 cpl_propertylist *ozproperties = NULL;
110 cpl_propertylist *sorting_order = NULL;
112 GiTable *slits = NULL;
113 GiTable *ozpoz = NULL;
115 GiInstrumentMode mode;
129 properties = cpl_propertylist_load(filename, 0);
131 if (properties == NULL) {
132 cpl_msg_error(fctid,
"Cannot load properties of data set 0 "
133 "from `%s'!", filename);
134 cpl_propertylist_delete(properties);
139 if (!cpl_propertylist_has(properties, GIALIAS_STSCFF) &&
140 !cpl_propertylist_has(properties, GIALIAS_STSCTAL)) {
141 cpl_msg_warning(fctid,
"%s: Properties (%s, %s) not found! "
142 "Simultaneous calibration lamps assumed to "
143 "be off!", filename, GIALIAS_STSCFF,
149 cxint scff = cpl_propertylist_get_bool(properties,
151 cxint sctal= cpl_propertylist_get_bool(properties,
156 cpl_msg_info(fctid,
"Simultaneous calibration lamps "
161 cpl_msg_info(fctid,
"Simultaneous calibration lamps "
170 cx_string_create(cpl_propertylist_get_string(properties,
173 cpl_msg_error(fctid,
"%s: Property (%s) not found!", filename,
175 cpl_propertylist_delete(properties);
179 cx_string_strip(slit_name);
184 if (mode == GIMODE_NONE) {
185 cpl_msg_error(fctid,
"Invalid instrument mode!");
187 cx_string_delete(slit_name);
188 cpl_propertylist_delete(properties);
193 cpl_propertylist_delete(properties);
203 ozproperties = cpl_propertylist_load(filename, GIOZPOZ_EXTENSION);
207 if (ozproperties && cpl_propertylist_has(ozproperties, GIALIAS_EXTNAME)) {
210 magic = cpl_propertylist_get_string(ozproperties, GIALIAS_EXTNAME);
212 if (strcmp(GIOZPOZ_MAGIC, magic) == 0) {
214 fiberext = GIFIBER_EXTENSION;
217 if (strcmp(GIFIBER_MAGIC, magic) == 0) {
219 fiberext = GIOZPOZ_EXTENSION;
224 cpl_propertylist_delete(ozproperties);
233 cx_assert(ozpoz != NULL);
235 giraffe_error_push();
242 if (cpl_error_get_code() == CPL_ERROR_BAD_FILE_FORMAT)
244 cpl_msg_error(fctid,
"Data set %d in `%s' is not an "
246 GIOZPOZ_EXTENSION, filename);
248 cpl_table_delete(fibers);
256 cpl_msg_error(fctid,
"No OzPoz table found in `%s'!",
262 cpl_msg_warning(fctid,
"Empty OzPoz table found in `%s'.",
277 cx_assert(slits != NULL);
279 giraffe_error_push();
283 if (cpl_error_get_code() == CPL_ERROR_BAD_FILE_FORMAT) {
284 cpl_msg_error(fctid,
"Data set %d in `%s' is not a fiber table!",
285 GIFIBER_EXTENSION, filename);
290 cpl_msg_error(fctid,
"Cannot load data set %d (fiber table) "
291 "from `%s'!", GIFIBER_EXTENSION, filename);
306 cpl_table_select_all(_slits);
307 cpl_table_and_selected_string(_slits,
"Slit", CPL_NOT_EQUAL_TO,
308 cx_string_get(slit_name));
310 giraffe_error_push();
312 cpl_table_erase_selected(_slits);
314 if (cpl_error_get_code() != CPL_ERROR_NONE) {
315 cpl_msg_error(fctid,
"Invalid slit `%s' selected. No fibers found.",
316 cx_string_get(slit_name));
318 cx_string_delete(slit_name);
329 cx_string_delete(slit_name);
338 nfibers = cpl_table_get_nrow(_slits);
339 fibers = cpl_table_new(nfibers);
341 giraffe_error_push();
343 cpl_table_new_column(fibers,
"INDEX", CPL_TYPE_INT);
344 cpl_table_new_column(fibers,
"FPS", CPL_TYPE_INT);
345 cpl_table_new_column(fibers,
"SSN", CPL_TYPE_INT);
346 cpl_table_new_column(fibers,
"PSSN", CPL_TYPE_INT);
347 cpl_table_new_column(fibers,
"RP", CPL_TYPE_INT);
349 for (i = 0; i < nfibers; i++) {
353 cxint fps = strtol(cpl_table_get_string(_slits,
"FPS", i), NULL, 10);
354 cxint ssn = strtol(cpl_table_get_string(_slits,
"SSN", i), NULL, 10);
355 cxint pssn = strtol(cpl_table_get_string(_slits,
"PSSN", i),
360 s = (cxchar*) cpl_table_get_string(_slits,
"RP", i);
363 rp = strtol(s, NULL, 10);
366 if (mode == GIMODE_ARGUS) {
368 const cxchar *rpid = cpl_table_get_string(_slits,
371 if (cx_strncasecmp(rpid,
"Cal", 3) != 0) {
378 cpl_table_set_int(fibers,
"FPS", i, fps);
379 cpl_table_set_int(fibers,
"SSN", i, ssn);
380 cpl_table_set_int(fibers,
"PSSN", i, pssn);
381 cpl_table_set_int(fibers,
"RP", i, rp);
385 if (mode == GIMODE_IFU || mode == GIMODE_ARGUS) {
387 if (cpl_table_has_column(_slits,
"X") &&
388 cpl_table_has_column(_slits,
"Y")) {
390 cpl_table_new_column(fibers,
"X", CPL_TYPE_INT);
391 cpl_table_new_column(fibers,
"Y", CPL_TYPE_INT);
393 for (i = 0; i < nfibers; i++) {
400 s = cpl_table_get_string(_slits,
"X", i);
403 x = strtol(s, NULL, 10);
406 s = cpl_table_get_string(_slits,
"Y", i);
409 y = strtol(s, NULL, 10);
412 cpl_table_set_int(fibers,
"X", i, x);
413 cpl_table_set_int(fibers,
"Y", i, y);
420 cpl_table_move_column(fibers,
"Retractor", _slits);
422 if (cpl_error_get_code() != CPL_ERROR_NONE) {
423 cpl_msg_error(fctid,
"Data set %d in `%s' is not a valid "
424 "fiber table!", GIFIBER_EXTENSION, filename);
426 cpl_table_delete(fibers);
441 if (mode == GIMODE_ARGUS) {
443 sorting_order = cpl_propertylist_new();
445 cpl_propertylist_append_bool(sorting_order,
"FPS", 1);
446 cpl_table_sort(fibers, sorting_order);
448 cpl_propertylist_delete(sorting_order);
449 sorting_order = NULL;
458 for (i = 0; i < nfibers; i++) {
460 const cxchar *s = cpl_table_get_string(fibers,
"Retractor", i);
463 if (strstr(s,
"Calibration")) {
464 cpl_table_set_int(fibers,
"RP", i, -1);
467 cpl_table_set_int(fibers,
"INDEX", i, i + 1);
471 if (!cpl_table_has_column(fibers,
"FPD")) {
472 cpl_table_duplicate_column(fibers,
"FPD", fibers,
"INDEX");
475 cpl_table_new_column(fibers,
"OBJECT", CPL_TYPE_STRING);
476 cpl_table_new_column(fibers,
"R", CPL_TYPE_DOUBLE);
477 cpl_table_new_column(fibers,
"THETA", CPL_TYPE_DOUBLE);
478 cpl_table_new_column(fibers,
"ORIENT", CPL_TYPE_DOUBLE);
479 cpl_table_new_column(fibers,
"TYPE", CPL_TYPE_STRING);
481 cpl_table_fill_column_window_double(fibers,
"R", 0, nfibers, 0.);
482 cpl_table_fill_column_window_double(fibers,
"THETA", 0, nfibers, 0.);
483 cpl_table_fill_column_window_double(fibers,
"ORIENT", 0, nfibers, 0.);
485 if (_ozpoz != NULL) {
486 if (cpl_table_has_column(_ozpoz,
"RA")) {
487 cpl_table_new_column(fibers,
"RA", CPL_TYPE_DOUBLE);
488 cpl_table_fill_column_window_double(fibers,
"RA", 0,
492 if (cpl_table_has_column(_ozpoz,
"DEC")) {
493 cpl_table_new_column(fibers,
"DEC", CPL_TYPE_DOUBLE);
494 cpl_table_fill_column_window_double(fibers,
"DEC", 0,
498 if (cpl_table_has_column(_ozpoz,
"MAGNITUDE")) {
499 cpl_table_new_column(fibers,
"MAGNITUDE", CPL_TYPE_DOUBLE);
500 cpl_table_fill_column_window_double(fibers,
"MAGNITUDE", 0,
504 if (cpl_table_has_column(_ozpoz,
"B_V")) {
505 cpl_table_new_column(fibers,
"B_V", CPL_TYPE_DOUBLE);
506 cpl_table_fill_column_window_double(fibers,
"B_V", 0,
520 nbuttons = _ozpoz == NULL ? 0 : cpl_table_get_nrow(_ozpoz);
522 cpl_table_select_all(fibers);
524 for (i = 0; i < nfibers; i++) {
526 cxbool missing = TRUE;
528 cxint fiber = cpl_table_get_int(fibers,
"RP", i, NULL);
537 if (fiber == -1 && calsim == TRUE) {
538 cpl_table_set_string(fibers,
"OBJECT", i,
"CALSIM");
539 cpl_table_unselect_row(fibers, i);
542 else if (ozstatus==1 && fiber == 0 && mode == GIMODE_ARGUS) {
543 cpl_table_unselect_row(fibers, i);
551 for (j = 0; j < nbuttons; j++) {
553 cxint button = cpl_table_get_int(_ozpoz,
"BUTTON", j, NULL);
556 if (fiber == button) {
557 const cxchar *object;
560 cxdouble r, theta, orient;
568 object = cpl_table_get_string(_ozpoz,
"OBJECT", j);
569 otype = cpl_table_get_string(_ozpoz,
"TYPE", j);
571 r = cpl_table_get_double(_ozpoz,
"R", j, NULL);
572 theta = cpl_table_get_double(_ozpoz,
"THETA", j, NULL);
573 orient = cpl_table_get_double(_ozpoz,
"ORIENT", j, NULL);
575 if (cpl_table_has_column(_ozpoz,
"RA")) {
576 ra = cpl_table_get_double(_ozpoz,
"RA", j, NULL);
579 if (cpl_table_has_column(_ozpoz,
"DEC")) {
580 dec = cpl_table_get_double(_ozpoz,
"DEC", j, NULL);
583 if (cpl_table_has_column(_ozpoz,
"MAGNITUDE")) {
584 mag = cpl_table_get_float(_ozpoz,
"MAGNITUDE", j,
588 if (cpl_table_has_column(_ozpoz,
"B_V")) {
589 b_v = cpl_table_get_double(_ozpoz,
"B_V", j, NULL);
590 b_v = CX_CLAMP(b_v, -5., 5.);
593 cpl_table_set_string(fibers,
"OBJECT", i,
object);
594 cpl_table_set_string(fibers,
"TYPE", i, otype);
596 cpl_table_set_double(fibers,
"R", i, r);
597 cpl_table_set_double(fibers,
"THETA", i, theta);
598 cpl_table_set_double(fibers,
"ORIENT", i, orient);
600 if (cpl_table_has_column(fibers,
"RA")) {
601 cpl_table_set_double(fibers,
"RA", i, ra);
604 if (cpl_table_has_column(fibers,
"DEC")) {
605 cpl_table_set_double(fibers,
"DEC", i, dec);
608 if (cpl_table_has_column(fibers,
"MAGNITUDE")) {
609 cpl_table_set_double(fibers,
"MAGNITUDE", i, mag);
612 if (cpl_table_has_column(fibers,
"B_V")) {
613 cpl_table_set_double(fibers,
"B_V", i, b_v);
616 cpl_table_unselect_row(fibers, i);
623 if (missing == TRUE) {
625 cxint _fps = cpl_table_get_int(fibers,
"FPS", i, NULL);
626 cpl_msg_debug(fctid,
"Fiber at FPS = %d and RP = %d is not used", _fps, fiber);
633 giraffe_error_push();
635 cpl_table_erase_selected(fibers);
637 if (cpl_error_get_code() != CPL_ERROR_NONE) {
638 cpl_table_delete(fibers);
654 if (spectra && nspec > 0) {
656 register cxint rows = cpl_table_get_nrow(fibers);
659 cx_assert(cpl_table_get_column_type(fibers,
"FPD") == CPL_TYPE_INT);
661 cpl_table_select_all(fibers);
663 for (i = 0; i < rows; i++) {
666 register cxint selected = 0;
667 register cxint idx = cpl_table_get_int(fibers,
"FPD", i, NULL);
670 for (j = 0; j < nspec; j++) {
671 if (idx == spectra[j]) {
678 cpl_table_unselect_row(fibers, i);
681 cpl_table_select_row(fibers, i);
686 giraffe_error_push();
688 cpl_table_erase_selected(fibers);
690 if (cpl_error_get_code() != CPL_ERROR_NONE) {
691 cpl_table_delete(fibers);
704 for (i = 0; i < cpl_table_get_nrow(fibers); i++) {
705 cpl_table_set_int(fibers,
"INDEX", i, i + 1);
713 cx_assert(sorting_order == NULL);
715 sorting_order = cpl_propertylist_new();
716 cpl_propertylist_append_bool(sorting_order,
"INDEX", 0);
718 cpl_table_sort(fibers, sorting_order);
720 cpl_propertylist_delete(sorting_order);
721 sorting_order = NULL;
757 const cxchar *fctid =
"giraffe_fiberlist_load";
763 cx_assert(fibers != NULL);
765 giraffe_error_push();
768 if (cpl_error_get_code() == CPL_ERROR_BAD_FILE_FORMAT) {
769 cpl_msg_error(fctid,
"Data set %d in `%s' is not a fiber table!",
775 cpl_msg_error(fctid,
"Cannot load data set %d (fiber table) "
776 "from `%s'!", dataset, filename);
809 const cxchar *fctid =
"giraffe_fiberlist_save";
811 cxbool created = FALSE;
815 cpl_propertylist *properties = NULL;
816 cpl_table *table = NULL;
819 if (fibers == NULL || filename == NULL) {
820 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
827 cpl_error_set(fctid, CPL_ERROR_DATA_NOT_FOUND);
833 if (properties == NULL) {
834 properties = cpl_propertylist_new();
836 cpl_propertylist_append_string(properties, GIALIAS_EXTNAME,
837 GIFRAME_FIBER_SETUP);
843 if (cpl_propertylist_has(properties, GIALIAS_EXTNAME)) {
844 cpl_propertylist_set_string(properties, GIALIAS_EXTNAME,
845 GIFRAME_FIBER_SETUP);
848 cpl_propertylist_append_string(properties, GIALIAS_EXTNAME,
849 GIFRAME_FIBER_SETUP);
852 cpl_propertylist_set_comment(properties, GIALIAS_EXTNAME,
853 "FITS Extension name");
855 code = cpl_table_save(table, NULL, properties, filename, CPL_IO_EXTEND);
857 if (created == TRUE) {
858 cpl_propertylist_delete(properties);
861 return code == CPL_ERROR_NONE ? 0 : 1;
886 const cxchar *fctid =
"giraffe_fiberlist_attach";
889 cxbool created = FALSE;
893 cpl_propertylist *properties = NULL;
895 GiTable *_fibers = NULL;
898 if (frame == NULL || fibers == NULL) {
899 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
907 if (properties == NULL) {
908 properties = cpl_propertylist_new();
920 if (created == TRUE) {
921 cpl_propertylist_delete(properties);
952 const GiTable *reference)
962 if (_fibers == NULL || _reference == NULL) {
966 if (!cpl_table_has_column(_fibers,
"FPS") ||
967 !cpl_table_has_column(_reference,
"FPS")) {
972 for (i = 0; i < cpl_table_get_nrow(_reference); i++) {
974 cxbool found = FALSE;
977 cxint fps = cpl_table_get_int(_reference,
"FPS", i, NULL);
979 for (j = 0; j < cpl_table_get_nrow(_fibers); j++) {
980 cxint _fps = cpl_table_get_int(_fibers,
"FPS", j, NULL);
988 if (found == FALSE) {
1024 const cxchar *fctid =
"giraffe_fiberlist_associate";
1031 cpl_table *_fibers = NULL;
1032 cpl_table *_reference = NULL;
1035 if (fibers == NULL) {
1036 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
1040 if (reference == NULL) {
1041 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
1048 if (!cpl_table_has_column(_fibers,
"FPS")) {
1049 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
1053 if (!cpl_table_has_column(_reference,
"FPS")) {
1054 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
1065 if (!cpl_table_has_column(_fibers,
"RINDEX")) {
1067 cxint size = cpl_table_get_nrow(_fibers);
1069 cxint status = cpl_table_duplicate_column(_fibers,
"RINDEX",
1072 if (status != CPL_ERROR_NONE) {
1076 status = cpl_table_fill_column_window_int(_fibers,
"RINDEX", 0,
1079 if (status != CPL_ERROR_NONE) {
1092 nf = cpl_table_get_nrow(_fibers);
1093 nr = cpl_table_get_nrow(_reference);
1095 cpl_table_unselect_all(_fibers);
1097 for (i = 0; i < nf; i++) {
1101 cxint fps = cpl_table_get_int(_fibers,
"FPS", i, NULL);
1104 for (j = 0; j < nr; j++) {
1106 cxint _fps = cpl_table_get_int(_reference,
"FPS", j, NULL);
1111 cxint ridx = cpl_table_get_int(_reference,
"INDEX", j, NULL);
1113 cpl_table_set_int(_fibers,
"RINDEX", i, ridx);
1114 cpl_table_select_row(_fibers, i);
1128 _fibers = cpl_table_extract_selected(_fibers);
1135 for (i = 0; i < cpl_table_get_nrow(_fibers); i++) {
1136 cpl_table_set_int(_fibers,
"INDEX", i, i + 1);
1142 cpl_table_delete(_fibers);
1166 cpl_table* _fibers = NULL;
1168 if (fibers == NULL) {
1174 if (_fibers == NULL) {
1178 giraffe_error_push();
1180 if (cpl_table_has_column(_fibers,
"RINDEX") == TRUE) {
1181 cpl_table_erase_column(_fibers,
"RINDEX");
1184 if (cpl_error_get_code() != CPL_ERROR_NONE) {
1188 giraffe_error_pop();
1212 const cxchar *names[] = {
"RINDEX",
"INDEX", NULL};
1213 const cxchar **idx = names;
1216 while (*idx != NULL) {
1218 if (cpl_table_has_column((cpl_table *)fibers, *idx) != 0) {
1251 cpl_array* subslits = NULL;
1254 cx_assert(fibers != NULL);
1256 nfibers = cpl_table_get_nrow(fibers);
1266 subslits = cpl_array_new(nfibers, CPL_TYPE_INT);
1267 cpl_array_fill_window(subslits, 0, nfibers, 0);
1269 ssn = cpl_array_get_data_int(subslits);
1276 for (i = 0; i < nfibers; ++i) {
1277 ssn[i] = cpl_table_get_int(fibers,
"SSN", i, NULL);
1280 qsort(ssn, nfibers,
sizeof(cxint), _giraffe_compare_int);
1287 for (i = 1; i < nfibers; ++i) {
1288 if (ssn[i] != ssn[nss]) {
1289 ssn[++nss] = ssn[i];
1294 cpl_array_set_size(subslits, nss);
1336 cxchar **lists = NULL;
1337 cxchar **ranges = NULL;
1342 cxint *fibers = NULL;
1343 cxint *_fibers = NULL;
1345 cx_slist *fl = NULL;
1347 cx_slist_iterator pos;
1352 lists = cx_strsplit(selection,
";", 2);
1354 if (lists == NULL) {
1358 if (lists[1] != NULL) {
1359 gi_warning(
"Usage of fiber exclusion lists is not supported! "
1360 "The given exclusion list is ignored!");
1363 ranges = cx_strsplit(lists[0],
",", -1);
1365 if (ranges == NULL) {
1371 while (ranges[i] != NULL) {
1373 cxchar **bounds = cx_strsplit(ranges[i],
"-", 2);
1378 if (bounds == NULL) {
1379 cx_strfreev(ranges);
1396 lower = strtol(bounds[0], &last, 10);
1398 if (*last !=
'\0') {
1399 cx_strfreev(bounds);
1400 cx_strfreev(ranges);
1410 if (bounds[1] != NULL) {
1412 upper = strtol(bounds[1], &last, 10);
1414 if (*last !=
'\0') {
1415 cx_strfreev(bounds);
1416 cx_strfreev(ranges);
1427 upper = upper > 0 ? upper : lower;
1429 if (lower <= 0 || upper <= 0 || upper < lower) {
1430 cx_strfreev(bounds);
1431 cx_strfreev(ranges);
1443 if (upper > lower) {
1444 nfibers += upper - lower;
1447 fibers = cx_realloc(fibers, nfibers *
sizeof(cxint));
1449 for (j = first; j < nfibers; j++) {
1450 fibers[j] = lower + j - first;
1457 cx_strfreev(bounds);
1464 cx_strfreev(ranges);
1467 qsort(fibers, nfibers,
sizeof(cxint), _giraffe_compare_int);
1474 fl = cx_slist_new();
1476 for (i = 0; i < nfibers; i++) {
1477 cx_slist_push_back(fl, fibers + i);
1480 cx_slist_unique(fl, _giraffe_compare_int);
1482 nfibers = cx_slist_size(fl);
1483 _fibers = cx_malloc(nfibers *
sizeof(cxint));
1487 pos = cx_slist_begin(fl);
1488 while (pos != cx_slist_end(fl)) {
1490 cxint *fn = cx_slist_get(fl, pos);
1492 cx_assert(fn != NULL);
1495 pos = cx_slist_next(fl, pos);
1498 cx_slist_delete(fl);
1520 const GiTable *reference, cxint *nspec)
1528 cxint nfibers = cpl_table_get_nrow(fibers);
1529 cxint nactive = cpl_table_get_nrow(_reference);
1530 cxint *spectra = NULL;
1533 if (fibers == NULL) {
1537 if (!cpl_table_has_column(fibers,
"FPS") ||
1538 !cpl_table_has_column(fibers,
"FPD")) {
1539 cpl_table_delete(fibers);
1543 if (!cpl_table_has_column(_reference,
"FPS")) {
1544 cpl_table_delete(fibers);
1548 if (nactive > nfibers) {
1549 cpl_table_delete(fibers);
1554 spectra = cx_malloc(nactive *
sizeof(cxint));
1556 for (i = 0; i < nactive; ++i) {
1559 cxint fps = cpl_table_get_int(_reference,
"FPS", i, NULL);
1561 for (j = 0; j < nfibers; ++j) {
1563 cxint _fps = cpl_table_get_int(fibers,
"FPS", j, NULL);
1564 cxint _fpd = cpl_table_get_int(fibers,
"FPD", j, NULL);
1567 spectra[nspectra] = _fpd;
1576 cpl_table_delete(fibers);
1578 if (nspectra < nactive) {
1579 spectra = cx_realloc(spectra, nspectra *
sizeof(cxint));
1582 qsort(spectra, nspectra,
sizeof(cxint), _giraffe_compare_int);
GiTable * giraffe_fiberlist_load(const cxchar *filename, cxint dataset, const cxchar *tag)
Load a fiber table from a file.
cpl_table * giraffe_fiberlist_create(const cxchar *filename, cxint nspec, const cxint *spectra)
Creates the fiber table.
cxint giraffe_fiberlist_save(GiTable *fibers, const cxchar *filename)
Save a fiber table to a file.
cxint giraffe_fiberlist_compare(const GiTable *fibers, const GiTable *reference)
Compare two fiber lists.
cxint giraffe_fiberlist_attach(cpl_frame *frame, GiTable *fibers)
Attach a fiber table to a frame.
cpl_array * giraffe_fiberlist_get_subslits(const cpl_table *fibers)
Get the list of subslit identifiers from a fiber setup.
const cxchar * giraffe_fiberlist_query_index(const cpl_table *fibers)
Query a fiber list for the name of the fiber reference index column.
cxint * giraffe_parse_spectrum_selection(const cxchar *selection, cxint *nspec)
Parses a spectrum selection string.
cxint * giraffe_create_spectrum_selection(const cxchar *filename, const GiTable *reference, cxint *nspec)
Create a spectrum selection from a reference table.
cxint giraffe_fiberlist_associate(GiTable *fibers, const GiTable *reference)
Associate a fiberlist with a reference list.
cxint giraffe_fiberlist_clear_index(GiTable *fibers)
Remove the reference index column from a fiber list.
cxint giraffe_frame_attach_table(cpl_frame *frame, GiTable *table, const cxchar *tag, cxbool update)
Attach a table to a product frame.
void gi_warning(const cxchar *format,...)
Log a warning.
cxint giraffe_table_set(GiTable *self, cpl_table *table)
Sets the table data.
GiTable * giraffe_table_new(void)
Creates a new, empty Giraffe table.
GiTable * giraffe_table_duplicate(const GiTable *src)
Duplicate a Giraffe table.
cxint giraffe_table_load(GiTable *self, const cxchar *filename, cxint position, const cxchar *id)
Reads a data set from a file into a Giraffe table.
void giraffe_table_delete(GiTable *self)
Destroys a Giraffe table.
cpl_table * giraffe_table_get(const GiTable *self)
Get the table data from a Giraffe table.
cpl_propertylist * giraffe_table_get_properties(const GiTable *self)
Gets the table properties.
cxint giraffe_table_set_properties(GiTable *self, cpl_propertylist *properties)
Attaches a property list to an table.
GiInstrumentMode giraffe_get_mode(cpl_propertylist *properties)
Determines the instrument mode from a property list.