28#include <cxstrutils.h>
30#include <cxmessages.h>
32#include <cpl_propertylist.h>
40#include "gimessages.h"
42#include "gifiberutils.h"
54_giraffe_compare_int(cxcptr first, cxcptr second)
57 cxint *_first = (cxint *)first;
58 cxint *_second = (cxint *)second;
60 return *_first - *_second;
90 const cxchar *
const fctid =
"giraffe_fiberlist_create";
103 cx_string *slit_name = NULL;
105 cpl_table *fibers = NULL;
107 cpl_table *_ozpoz = NULL;
109 cpl_propertylist *properties = NULL;
110 cpl_propertylist *ozproperties = NULL;
111 cpl_propertylist *sorting_order = NULL;
113 GiTable *slits = NULL;
114 GiTable *ozpoz = NULL;
116 GiInstrumentMode mode;
130 properties = cpl_propertylist_load(filename, 0);
132 if (properties == NULL) {
133 cpl_msg_error(fctid,
"Cannot load properties of data set 0 "
134 "from `%s'!", filename);
135 cpl_propertylist_delete(properties);
140 if (!cpl_propertylist_has(properties, GIALIAS_STSCFF) &&
141 !cpl_propertylist_has(properties, GIALIAS_STSCTAL)) {
142 cpl_msg_warning(fctid,
"%s: Properties (%s, %s) not found! "
143 "Simultaneous calibration lamps assumed to "
144 "be off!", filename, GIALIAS_STSCFF,
150 cxint scff = cpl_propertylist_get_bool(properties,
152 cxint sctal= cpl_propertylist_get_bool(properties,
157 cpl_msg_info(fctid,
"Simultaneous calibration lamps "
162 cpl_msg_info(fctid,
"Simultaneous calibration lamps "
171 cx_string_create(cpl_propertylist_get_string(properties,
174 cpl_msg_error(fctid,
"%s: Property (%s) not found!", filename,
176 cpl_propertylist_delete(properties);
180 cx_string_strip(slit_name);
185 if (mode == GIMODE_NONE) {
186 cpl_msg_error(fctid,
"Invalid instrument mode!");
188 cx_string_delete(slit_name);
189 cpl_propertylist_delete(properties);
194 cpl_propertylist_delete(properties);
204 ozproperties = cpl_propertylist_load(filename, GIOZPOZ_EXTENSION);
208 if (ozproperties && cpl_propertylist_has(ozproperties, GIALIAS_EXTNAME)) {
211 magic = cpl_propertylist_get_string(ozproperties, GIALIAS_EXTNAME);
213 if (strcmp(GIOZPOZ_MAGIC, magic) == 0) {
215 fiberext = GIFIBER_EXTENSION;
218 if (strcmp(GIFIBER_MAGIC, magic) == 0) {
220 fiberext = GIOZPOZ_EXTENSION;
225 cpl_propertylist_delete(ozproperties);
234 cx_assert(ozpoz != NULL);
236 giraffe_error_push();
243 if (cpl_error_get_code() == CPL_ERROR_BAD_FILE_FORMAT)
245 cpl_msg_error(fctid,
"Data set %d in `%s' is not an "
247 GIOZPOZ_EXTENSION, filename);
249 cpl_table_delete(fibers);
257 cpl_msg_error(fctid,
"No OzPoz table found in `%s'!",
263 cpl_msg_warning(fctid,
"Empty OzPoz table found in `%s'.",
278 cx_assert(slits != NULL);
280 giraffe_error_push();
284 if (cpl_error_get_code() == CPL_ERROR_BAD_FILE_FORMAT) {
285 cpl_msg_error(fctid,
"Data set %d in `%s' is not a fiber table!",
286 GIFIBER_EXTENSION, filename);
291 cpl_msg_error(fctid,
"Cannot load data set %d (fiber table) "
292 "from `%s'!", GIFIBER_EXTENSION, filename);
307 cpl_table_select_all(_slits);
308 cpl_table_and_selected_string(_slits,
"Slit", CPL_NOT_EQUAL_TO,
309 cx_string_get(slit_name));
311 giraffe_error_push();
313 cpl_table_erase_selected(_slits);
315 if (cpl_error_get_code() != CPL_ERROR_NONE) {
316 cpl_msg_error(fctid,
"Invalid slit `%s' selected. No fibers found.",
317 cx_string_get(slit_name));
319 cx_string_delete(slit_name);
330 cx_string_delete(slit_name);
339 nfibers = cpl_table_get_nrow(_slits);
340 fibers = cpl_table_new(nfibers);
342 giraffe_error_push();
344 cpl_table_new_column(fibers,
"INDEX", CPL_TYPE_INT);
345 cpl_table_new_column(fibers,
"FPS", CPL_TYPE_INT);
346 cpl_table_new_column(fibers,
"SSN", CPL_TYPE_INT);
347 cpl_table_new_column(fibers,
"PSSN", CPL_TYPE_INT);
348 cpl_table_new_column(fibers,
"RP", CPL_TYPE_INT);
350 for (i = 0; i < nfibers; i++) {
354 cxint fps = strtol(cpl_table_get_string(_slits,
"FPS", i), NULL, 10);
355 cxint ssn = strtol(cpl_table_get_string(_slits,
"SSN", i), NULL, 10);
356 cxint pssn = strtol(cpl_table_get_string(_slits,
"PSSN", i),
361 s = (cxchar*) cpl_table_get_string(_slits,
"RP", i);
364 rp = strtol(s, NULL, 10);
367 if (mode == GIMODE_ARGUS) {
369 const cxchar *rpid = cpl_table_get_string(_slits,
372 if (cx_strncasecmp(rpid,
"Cal", 3) != 0) {
379 cpl_table_set_int(fibers,
"FPS", i, fps);
380 cpl_table_set_int(fibers,
"SSN", i, ssn);
381 cpl_table_set_int(fibers,
"PSSN", i, pssn);
382 cpl_table_set_int(fibers,
"RP", i, rp);
386 if (mode == GIMODE_IFU || mode == GIMODE_ARGUS) {
388 if (cpl_table_has_column(_slits,
"X") &&
389 cpl_table_has_column(_slits,
"Y")) {
391 cpl_table_new_column(fibers,
"X", CPL_TYPE_INT);
392 cpl_table_new_column(fibers,
"Y", CPL_TYPE_INT);
394 for (i = 0; i < nfibers; i++) {
401 s = cpl_table_get_string(_slits,
"X", i);
404 x = strtol(s, NULL, 10);
407 s = cpl_table_get_string(_slits,
"Y", i);
410 y = strtol(s, NULL, 10);
413 cpl_table_set_int(fibers,
"X", i, x);
414 cpl_table_set_int(fibers,
"Y", i, y);
421 cpl_table_move_column(fibers,
"Retractor", _slits);
423 if (cpl_error_get_code() != CPL_ERROR_NONE) {
424 cpl_msg_error(fctid,
"Data set %d in `%s' is not a valid "
425 "fiber table!", GIFIBER_EXTENSION, filename);
427 cpl_table_delete(fibers);
442 if (mode == GIMODE_ARGUS) {
444 sorting_order = cpl_propertylist_new();
446 cpl_propertylist_append_bool(sorting_order,
"FPS", 1);
447 cpl_table_sort(fibers, sorting_order);
449 cpl_propertylist_delete(sorting_order);
450 sorting_order = NULL;
459 for (i = 0; i < nfibers; i++) {
461 const cxchar *s = cpl_table_get_string(fibers,
"Retractor", i);
464 if (strstr(s,
"Calibration")) {
465 cpl_table_set_int(fibers,
"RP", i, -1);
468 cpl_table_set_int(fibers,
"INDEX", i, i + 1);
472 if (!cpl_table_has_column(fibers,
"FPD")) {
473 cpl_table_duplicate_column(fibers,
"FPD", fibers,
"INDEX");
476 cpl_table_new_column(fibers,
"OBJECT", CPL_TYPE_STRING);
477 cpl_table_new_column(fibers,
"R", CPL_TYPE_DOUBLE);
478 cpl_table_new_column(fibers,
"THETA", CPL_TYPE_DOUBLE);
479 cpl_table_new_column(fibers,
"ORIENT", CPL_TYPE_DOUBLE);
480 cpl_table_new_column(fibers,
"TYPE", CPL_TYPE_STRING);
482 cpl_table_fill_column_window_double(fibers,
"R", 0, nfibers, 0.);
483 cpl_table_fill_column_window_double(fibers,
"THETA", 0, nfibers, 0.);
484 cpl_table_fill_column_window_double(fibers,
"ORIENT", 0, nfibers, 0.);
486 if (_ozpoz != NULL) {
487 if (cpl_table_has_column(_ozpoz,
"RA")) {
488 cpl_table_new_column(fibers,
"RA", CPL_TYPE_DOUBLE);
489 cpl_table_fill_column_window_double(fibers,
"RA", 0,
493 if (cpl_table_has_column(_ozpoz,
"DEC")) {
494 cpl_table_new_column(fibers,
"DEC", CPL_TYPE_DOUBLE);
495 cpl_table_fill_column_window_double(fibers,
"DEC", 0,
499 if (cpl_table_has_column(_ozpoz,
"MAGNITUDE")) {
500 cpl_table_new_column(fibers,
"MAGNITUDE", CPL_TYPE_DOUBLE);
501 cpl_table_fill_column_window_double(fibers,
"MAGNITUDE", 0,
505 if (cpl_table_has_column(_ozpoz,
"B_V")) {
506 cpl_table_new_column(fibers,
"B_V", CPL_TYPE_DOUBLE);
507 cpl_table_fill_column_window_double(fibers,
"B_V", 0,
521 nbuttons = _ozpoz == NULL ? 0 : cpl_table_get_nrow(_ozpoz);
523 cpl_table_select_all(fibers);
525 for (i = 0; i < nfibers; i++) {
527 cxbool missing = TRUE;
529 cxint fiber = cpl_table_get_int(fibers,
"RP", i, NULL);
538 if (fiber == -1 && calsim == TRUE) {
539 cpl_table_set_string(fibers,
"OBJECT", i,
"CALSIM");
540 cpl_table_unselect_row(fibers, i);
543 else if (ozstatus==1 && fiber == 0 && mode == GIMODE_ARGUS) {
544 cpl_table_unselect_row(fibers, i);
552 for (j = 0; j < nbuttons; j++) {
554 cxint button = cpl_table_get_int(_ozpoz,
"BUTTON", j, NULL);
557 if (fiber == button) {
558 const cxchar *object;
561 cxdouble r, theta, orient;
569 object = cpl_table_get_string(_ozpoz,
"OBJECT", j);
570 otype = cpl_table_get_string(_ozpoz,
"TYPE", j);
572 r = cpl_table_get_double(_ozpoz,
"R", j, NULL);
573 theta = cpl_table_get_double(_ozpoz,
"THETA", j, NULL);
574 orient = cpl_table_get_double(_ozpoz,
"ORIENT", j, NULL);
576 if (cpl_table_has_column(_ozpoz,
"RA")) {
577 ra = cpl_table_get_double(_ozpoz,
"RA", j, NULL);
580 if (cpl_table_has_column(_ozpoz,
"DEC")) {
581 dec = cpl_table_get_double(_ozpoz,
"DEC", j, NULL);
584 if (cpl_table_has_column(_ozpoz,
"MAGNITUDE")) {
585 mag = cpl_table_get_float(_ozpoz,
"MAGNITUDE", j,
589 if (cpl_table_has_column(_ozpoz,
"B_V")) {
590 b_v = cpl_table_get_double(_ozpoz,
"B_V", j, NULL);
591 b_v = CX_CLAMP(b_v, -5., 5.);
594 cpl_table_set_string(fibers,
"OBJECT", i,
object);
595 cpl_table_set_string(fibers,
"TYPE", i, otype);
597 cpl_table_set_double(fibers,
"R", i, r);
598 cpl_table_set_double(fibers,
"THETA", i, theta);
599 cpl_table_set_double(fibers,
"ORIENT", i, orient);
601 if (cpl_table_has_column(fibers,
"RA")) {
602 cpl_table_set_double(fibers,
"RA", i, ra);
605 if (cpl_table_has_column(fibers,
"DEC")) {
606 cpl_table_set_double(fibers,
"DEC", i, dec);
609 if (cpl_table_has_column(fibers,
"MAGNITUDE")) {
610 cpl_table_set_double(fibers,
"MAGNITUDE", i, mag);
613 if (cpl_table_has_column(fibers,
"B_V")) {
614 cpl_table_set_double(fibers,
"B_V", i, b_v);
617 cpl_table_unselect_row(fibers, i);
624 if (missing == TRUE) {
626 cxint _fps = cpl_table_get_int(fibers,
"FPS", i, NULL);
627 cpl_msg_debug(fctid,
"Fiber at FPS = %d and RP = %d is not used", _fps, fiber);
634 giraffe_error_push();
636 cpl_table_erase_selected(fibers);
638 if (cpl_error_get_code() != CPL_ERROR_NONE) {
639 cpl_table_delete(fibers);
655 if (spectra && nspec > 0) {
657 register cxint rows = cpl_table_get_nrow(fibers);
660 cx_assert(cpl_table_get_column_type(fibers,
"FPD") == CPL_TYPE_INT);
662 cpl_table_select_all(fibers);
664 for (i = 0; i < rows; i++) {
667 register cxint selected = 0;
668 register cxint idx = cpl_table_get_int(fibers,
"FPD", i, NULL);
671 for (j = 0; j < nspec; j++) {
672 if (idx == spectra[j]) {
679 cpl_table_unselect_row(fibers, i);
682 cpl_table_select_row(fibers, i);
687 giraffe_error_push();
689 cpl_table_erase_selected(fibers);
691 if (cpl_error_get_code() != CPL_ERROR_NONE) {
692 cpl_table_delete(fibers);
705 for (i = 0; i < cpl_table_get_nrow(fibers); i++) {
706 cpl_table_set_int(fibers,
"INDEX", i, i + 1);
714 cx_assert(sorting_order == NULL);
716 sorting_order = cpl_propertylist_new();
717 cpl_propertylist_append_bool(sorting_order,
"INDEX", 0);
719 cpl_table_sort(fibers, sorting_order);
721 cpl_propertylist_delete(sorting_order);
722 sorting_order = NULL;
758 const cxchar *fctid =
"giraffe_fiberlist_load";
764 cx_assert(fibers != NULL);
766 giraffe_error_push();
769 if (cpl_error_get_code() == CPL_ERROR_BAD_FILE_FORMAT) {
770 cpl_msg_error(fctid,
"Data set %d in `%s' is not a fiber table!",
776 cpl_msg_error(fctid,
"Cannot load data set %d (fiber table) "
777 "from `%s'!", dataset, filename);
810 const cxchar *fctid =
"giraffe_fiberlist_save";
812 cxbool created = FALSE;
816 cpl_propertylist *properties = NULL;
817 cpl_table *table = NULL;
820 if (fibers == NULL || filename == NULL) {
821 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
828 cpl_error_set(fctid, CPL_ERROR_DATA_NOT_FOUND);
834 if (properties == NULL) {
835 properties = cpl_propertylist_new();
837 cpl_propertylist_append_string(properties, GIALIAS_EXTNAME,
838 GIFRAME_FIBER_SETUP);
844 if (cpl_propertylist_has(properties, GIALIAS_EXTNAME)) {
845 cpl_propertylist_set_string(properties, GIALIAS_EXTNAME,
846 GIFRAME_FIBER_SETUP);
849 cpl_propertylist_append_string(properties, GIALIAS_EXTNAME,
850 GIFRAME_FIBER_SETUP);
853 cpl_propertylist_set_comment(properties, GIALIAS_EXTNAME,
854 "FITS Extension name");
856 code = cpl_table_save(table, NULL, properties, filename, CPL_IO_EXTEND);
858 if (created == TRUE) {
859 cpl_propertylist_delete(properties);
862 return code == CPL_ERROR_NONE ? 0 : 1;
887 const cxchar *fctid =
"giraffe_fiberlist_attach";
890 cxbool created = FALSE;
894 cpl_propertylist *properties = NULL;
896 GiTable *_fibers = NULL;
899 if (frame == NULL || fibers == NULL) {
900 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
908 if (properties == NULL) {
909 properties = cpl_propertylist_new();
921 if (created == TRUE) {
922 cpl_propertylist_delete(properties);
953 const GiTable *reference)
963 if (_fibers == NULL || _reference == NULL) {
967 if (!cpl_table_has_column(_fibers,
"FPS") ||
968 !cpl_table_has_column(_reference,
"FPS")) {
973 for (i = 0; i < cpl_table_get_nrow(_reference); i++) {
975 cxbool found = FALSE;
978 cxint fps = cpl_table_get_int(_reference,
"FPS", i, NULL);
980 for (j = 0; j < cpl_table_get_nrow(_fibers); j++) {
981 cxint _fps = cpl_table_get_int(_fibers,
"FPS", j, NULL);
989 if (found == FALSE) {
1025 const cxchar *fctid =
"giraffe_fiberlist_associate";
1032 cpl_table *_fibers = NULL;
1033 cpl_table *_reference = NULL;
1036 if (fibers == NULL) {
1037 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
1041 if (reference == NULL) {
1042 cpl_error_set(fctid, CPL_ERROR_NULL_INPUT);
1049 if (!cpl_table_has_column(_fibers,
"FPS")) {
1050 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
1054 if (!cpl_table_has_column(_reference,
"FPS")) {
1055 cpl_error_set(fctid, CPL_ERROR_ILLEGAL_INPUT);
1066 if (!cpl_table_has_column(_fibers,
"RINDEX")) {
1068 cxint size = cpl_table_get_nrow(_fibers);
1070 cxint status = cpl_table_duplicate_column(_fibers,
"RINDEX",
1073 if (status != CPL_ERROR_NONE) {
1077 status = cpl_table_fill_column_window_int(_fibers,
"RINDEX", 0,
1080 if (status != CPL_ERROR_NONE) {
1093 nf = cpl_table_get_nrow(_fibers);
1094 nr = cpl_table_get_nrow(_reference);
1096 cpl_table_unselect_all(_fibers);
1098 for (i = 0; i < nf; i++) {
1102 cxint fps = cpl_table_get_int(_fibers,
"FPS", i, NULL);
1105 for (j = 0; j < nr; j++) {
1107 cxint _fps = cpl_table_get_int(_reference,
"FPS", j, NULL);
1112 cxint ridx = cpl_table_get_int(_reference,
"INDEX", j, NULL);
1114 cpl_table_set_int(_fibers,
"RINDEX", i, ridx);
1115 cpl_table_select_row(_fibers, i);
1129 _fibers = cpl_table_extract_selected(_fibers);
1136 for (i = 0; i < cpl_table_get_nrow(_fibers); i++) {
1137 cpl_table_set_int(_fibers,
"INDEX", i, i + 1);
1143 cpl_table_delete(_fibers);
1167 cpl_table* _fibers = NULL;
1169 if (fibers == NULL) {
1175 if (_fibers == NULL) {
1179 giraffe_error_push();
1181 if (cpl_table_has_column(_fibers,
"RINDEX") == TRUE) {
1182 cpl_table_erase_column(_fibers,
"RINDEX");
1185 if (cpl_error_get_code() != CPL_ERROR_NONE) {
1189 giraffe_error_pop();
1213 const cxchar *names[] = {
"RINDEX",
"INDEX", NULL};
1214 const cxchar **idx = names;
1217 while (*idx != NULL) {
1219 if (cpl_table_has_column((cpl_table *)fibers, *idx) != 0) {
1252 cpl_array* subslits = NULL;
1255 cx_assert(fibers != NULL);
1257 nfibers = cpl_table_get_nrow(fibers);
1267 subslits = cpl_array_new(nfibers, CPL_TYPE_INT);
1268 cpl_array_fill_window(subslits, 0, nfibers, 0);
1270 ssn = cpl_array_get_data_int(subslits);
1277 for (i = 0; i < nfibers; ++i) {
1278 ssn[i] = cpl_table_get_int(fibers,
"SSN", i, NULL);
1281 qsort(ssn, nfibers,
sizeof(cxint), _giraffe_compare_int);
1288 for (i = 1; i < nfibers; ++i) {
1289 if (ssn[i] != ssn[nss]) {
1290 ssn[++nss] = ssn[i];
1295 cpl_array_set_size(subslits, nss);
1337 cxchar **lists = NULL;
1338 cxchar **ranges = NULL;
1343 cxint *fibers = NULL;
1344 cxint *_fibers = NULL;
1346 cx_slist *fl = NULL;
1348 cx_slist_iterator pos;
1353 lists = cx_strsplit(selection,
";", 2);
1355 if (lists == NULL) {
1359 if (lists[1] != NULL) {
1360 gi_warning(
"Usage of fiber exclusion lists is not supported! "
1361 "The given exclusion list is ignored!");
1364 ranges = cx_strsplit(lists[0],
",", -1);
1366 if (ranges == NULL) {
1372 while (ranges[i] != NULL) {
1374 cxchar **bounds = cx_strsplit(ranges[i],
"-", 2);
1379 if (bounds == NULL) {
1380 cx_strfreev(ranges);
1397 lower = strtol(bounds[0], &last, 10);
1399 if (*last !=
'\0') {
1400 cx_strfreev(bounds);
1401 cx_strfreev(ranges);
1411 if (bounds[1] != NULL) {
1413 upper = strtol(bounds[1], &last, 10);
1415 if (*last !=
'\0') {
1416 cx_strfreev(bounds);
1417 cx_strfreev(ranges);
1428 upper = upper > 0 ? upper : lower;
1430 if (lower <= 0 || upper <= 0 || upper < lower) {
1431 cx_strfreev(bounds);
1432 cx_strfreev(ranges);
1444 if (upper > lower) {
1445 nfibers += upper - lower;
1448 fibers = cx_realloc(fibers, nfibers *
sizeof(cxint));
1450 for (j = first; j < nfibers; j++) {
1451 fibers[j] = lower + j - first;
1458 cx_strfreev(bounds);
1465 cx_strfreev(ranges);
1468 qsort(fibers, nfibers,
sizeof(cxint), _giraffe_compare_int);
1475 fl = cx_slist_new();
1477 for (i = 0; i < nfibers; i++) {
1478 cx_slist_push_back(fl, fibers + i);
1481 cx_slist_unique(fl, _giraffe_compare_int);
1483 nfibers = cx_slist_size(fl);
1484 _fibers = cx_malloc(nfibers *
sizeof(cxint));
1488 pos = cx_slist_begin(fl);
1489 while (pos != cx_slist_end(fl)) {
1491 cxint *fn = cx_slist_get(fl, pos);
1493 cx_assert(fn != NULL);
1496 pos = cx_slist_next(fl, pos);
1499 cx_slist_delete(fl);
1521 const GiTable *reference, cxint *nspec)
1529 cxint nfibers = cpl_table_get_nrow(fibers);
1530 cxint nactive = cpl_table_get_nrow(_reference);
1531 cxint *spectra = NULL;
1534 if (fibers == NULL) {
1538 if (!cpl_table_has_column(fibers,
"FPS") ||
1539 !cpl_table_has_column(fibers,
"FPD")) {
1540 cpl_table_delete(fibers);
1544 if (!cpl_table_has_column(_reference,
"FPS")) {
1545 cpl_table_delete(fibers);
1549 if (nactive > nfibers) {
1550 cpl_table_delete(fibers);
1555 spectra = cx_malloc(nactive *
sizeof(cxint));
1557 for (i = 0; i < nactive; ++i) {
1560 cxint fps = cpl_table_get_int(_reference,
"FPS", i, NULL);
1562 for (j = 0; j < nfibers; ++j) {
1564 cxint _fps = cpl_table_get_int(fibers,
"FPS", j, NULL);
1565 cxint _fpd = cpl_table_get_int(fibers,
"FPD", j, NULL);
1568 spectra[nspectra] = _fpd;
1577 cpl_table_delete(fibers);
1579 if (nspectra < nactive) {
1580 spectra = cx_realloc(spectra, nspectra *
sizeof(cxint));
1583 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.