30 #if defined(HAVE_LIBCFITSIO)
34 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
36 #pragma GCC diagnostic pop
39 #if !defined(HAVE_FFFREE)
40 #undef fits_free_memory
41 #define fits_free_memory(ptr, status) free(ptr)
44 #elif defined(HAVE_DECL_FFFREE) && !HAVE_DECL_FFFREE
45 int fffree(
void *,
int * );
46 #undef fits_free_memory
47 #define fits_free_memory fffree
53 #include <lal/FITSFileIO.h>
54 #include <lal/LALString.h>
55 #include <lal/StringVector.h>
57 #include <lal/UserInput.h>
58 #include <lal/GSLHelpers.h>
61 #define UNUSED __attribute__ ((unused))
66 #if defined(HAVE_LIBCFITSIO)
69 #define CHECK_FITS_VAL(errnum, function) \
72 CHAR _check_fits_buf_[FLEN_STATUS + FLEN_ERRMSG]; \
73 fits_get_errstatus(status, _check_fits_buf_); \
74 XLAL_PRINT_ERROR("%s() failed: %s", #function, _check_fits_buf_); \
75 while (fits_read_errmsg(_check_fits_buf_) > 0) { \
76 XLAL_PRINT_ERROR("%s() error: %s", #function, _check_fits_buf_); \
78 XLAL_ERROR_FAIL(errnum); \
81 #define CHECK_FITS(function) \
82 CHECK_FITS_VAL(XLAL_EIO, function)
83 #define CALL_FITS_VAL(errnum, function, ...) \
85 function(__VA_ARGS__, &status); \
86 CHECK_FITS_VAL(errnum, function); \
88 #define CALL_FITS(function, ...) \
89 CALL_FITS_VAL(XLAL_EIO, function, __VA_ARGS__)
96 CHAR hduname[FLEN_VALUE];
97 CHAR hducomment[FLEN_COMMENT];
126 static int WriteFormattedString(
FITSFile *
file,
const CHAR *format, va_list
ap,
int ( *fcn )( fitsfile *,
const char *,
int * ) )
138 XLAL_CHECK_FAIL( vsnprintf( buf,
sizeof( buf ), format,
ap ) < (
int )
sizeof( buf ),
XLAL_EERR,
"Formatted string is too long" );
143 while (
t != NULL ) {
146 for (
CHAR *u =
t; *
u !=
'\0'; ++
u ) {
147 if ( !isprint( *u ) ) {
153 CALL_FITS( fcn,
file->ff,
t );
177 strcpy(
name, name_unit );
180 if ( unit != NULL ) {
182 CHAR *unit_start = strchr(
name,
'[' );
183 if ( unit_start != NULL ) {
184 CHAR *unit_end = strchr( unit_start,
']' );
187 *unit_start = *unit_end =
'\0';
188 strcpy( unit, unit_start + 1 );
189 while ( --unit_start >
name && isspace( *unit_start ) ) {
205 static int CheckFITSKeyword(
const CHAR *key,
CHAR *keyword,
CHAR *unit )
221 if ( strlen( keyword ) <= 8 && strchr( keyword,
' ' ) == NULL ) {
224 CALL_FITS( fits_test_keyword, keyword );
230 CHAR buf[FLEN_KEYWORD - 9];
231 strncpy( buf, keyword,
sizeof( buf ) );
232 snprintf( keyword, FLEN_KEYWORD,
"HIERARCH %s", buf );
247 #if !defined(HAVE_LIBCFITSIO)
252 if (
file != NULL ) {
253 if (
file->ff != NULL ) {
265 #if !defined(HAVE_LIBCFITSIO)
292 CALL_FITS( fits_create_img,
file->ff, SHORT_IMG, 0, NULL );
293 file->hdutype = INT_MAX;
296 CALL_FITS( fits_write_key_longwarn,
file->ff );
299 CALL_FITS( fits_write_date,
file->ff );
307 if (
file != NULL ) {
308 if (
file->ff != NULL ) {
322 #if !defined(HAVE_LIBCFITSIO)
363 if (
file != NULL ) {
364 if (
file->ff != NULL ) {
380 #if !defined(HAVE_LIBCFITSIO)
390 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
402 #if !defined(HAVE_LIBCFITSIO)
414 file->hdutype = ANY_HDU;
415 strncpy(
file->hduname,
name,
sizeof(
file->hduname ) - 1 );
418 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
419 CALL_FITS( fits_movnam_hdu,
file->ff,
file->hdutype,
file->hduname, 0 );
431 #if !defined(HAVE_LIBCFITSIO)
443 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
447 va_start(
ap, format );
456 if (
file != NULL &&
file->ff != NULL ) {
468 #if !defined(HAVE_LIBCFITSIO)
480 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
483 for (
size_t i = 0; vcs_list[
i] != NULL; ++
i ) {
484 CHAR keyword[FLEN_KEYWORD];
485 snprintf( keyword,
sizeof( keyword ),
"%s version", vcs_list[
i]->
name );
487 snprintf( keyword,
sizeof( keyword ),
"%s commit", vcs_list[
i]->
name );
489 snprintf( keyword,
sizeof( keyword ),
"%s status", vcs_list[
i]->
name );
498 if (
file != NULL &&
file->ff != NULL ) {
510 #if !defined(HAVE_LIBCFITSIO)
515 CHAR *cmd_line = NULL;
522 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
532 CALL_FITS( fits_write_key_longstr,
file->ff,
"PROGNAME",
t,
"name of program which created this file" );
536 while (
t != NULL ) {
537 CHAR *v = strchr(
t,
'\t' );
540 CHAR keyword[FLEN_KEYWORD];
541 snprintf( keyword,
sizeof( keyword ),
"PROGARG %s",
t );
542 CALL_FITS( fits_write_key_longstr,
file->ff, keyword, v,
"argument to program" );
552 if (
file != NULL &&
file->ff != NULL ) {
565 #if !defined(HAVE_LIBCFITSIO)
578 CHAR card[FLEN_CARD];
579 CALL_FITS( fits_read_record,
file->ff, 0, card );
583 } bad_cast = { .cc =
key };
584 CHAR *inclist[] = { bad_cast.c };
586 if (
status == KEY_NO_EXIST ) {
589 CHECK_FITS( fits_find_nextkey );
603 #if !defined(HAVE_LIBCFITSIO)
616 va_start(
ap, format );
625 if (
file != NULL &&
file->ff != NULL ) {
637 #if !defined(HAVE_LIBCFITSIO)
646 CHAR keyword[FLEN_KEYWORD];
651 CALL_FITS( fits_write_key_log,
file->ff, keyword, value ? 1 : 0,
comment );
658 if (
file != NULL &&
file->ff != NULL ) {
670 #if !defined(HAVE_LIBCFITSIO)
679 CHAR keyword[FLEN_KEYWORD];
686 CALL_FITS( fits_read_key_log,
file->ff, keyword, &val,
comment );
687 *value = val ? 1 : 0;
699 #if !defined(HAVE_LIBCFITSIO)
708 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
713 LONGLONG val = value;
714 CALL_FITS( fits_write_key_lng,
file->ff, keyword, val,
comment );
715 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
722 if (
file != NULL &&
file->ff != NULL ) {
734 #if !defined(HAVE_LIBCFITSIO)
743 CHAR keyword[FLEN_KEYWORD];
750 CALL_FITS( fits_read_key_lnglng,
file->ff, keyword, &val,
comment );
764 #if !defined(HAVE_LIBCFITSIO)
773 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
778 LONGLONG val = value;
779 CALL_FITS( fits_write_key_lng,
file->ff, keyword, val,
comment );
780 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
787 if (
file != NULL &&
file->ff != NULL ) {
799 #if !defined(HAVE_LIBCFITSIO)
808 CHAR keyword[FLEN_KEYWORD];
815 CALL_FITS( fits_read_key_lnglng,
file->ff, keyword, &val,
comment );
829 #if !defined(HAVE_LIBCFITSIO)
838 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
844 LONGLONG val = value;
845 CALL_FITS( fits_write_key_lng,
file->ff, keyword, val,
comment );
846 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
853 if (
file != NULL &&
file->ff != NULL ) {
865 #if !defined(HAVE_LIBCFITSIO)
874 CHAR keyword[FLEN_KEYWORD];
881 CALL_FITS( fits_read_key_lnglng,
file->ff, keyword, &val,
comment );
895 #if !defined(HAVE_LIBCFITSIO)
904 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
909 LONGLONG val = value;
910 CALL_FITS( fits_write_key_lng,
file->ff, keyword, val,
comment );
911 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
918 if (
file != NULL &&
file->ff != NULL ) {
930 #if !defined(HAVE_LIBCFITSIO)
939 CHAR keyword[FLEN_KEYWORD];
946 CALL_FITS( fits_read_key_lnglng,
file->ff, keyword, &val,
comment );
960 #if !defined(HAVE_LIBCFITSIO)
969 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
974 LONGLONG val = value;
975 CALL_FITS( fits_write_key_lng,
file->ff, keyword, val,
comment );
976 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
983 if (
file != NULL &&
file->ff != NULL ) {
995 #if !defined(HAVE_LIBCFITSIO)
1004 CHAR keyword[FLEN_KEYWORD];
1011 CALL_FITS( fits_read_key_lnglng,
file->ff, keyword, &val,
comment );
1025 #if !defined(HAVE_LIBCFITSIO)
1034 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
1040 LONGLONG val = value;
1041 CALL_FITS( fits_write_key_lng,
file->ff, keyword, val,
comment );
1042 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
1049 if (
file != NULL &&
file->ff != NULL ) {
1061 #if !defined(HAVE_LIBCFITSIO)
1070 CHAR keyword[FLEN_KEYWORD];
1077 CALL_FITS( fits_read_key_lnglng,
file->ff, keyword, &val,
comment );
1091 #if !defined(HAVE_LIBCFITSIO)
1100 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
1105 CALL_FITS( fits_write_key_flt,
file->ff, keyword, value, FLT_DIG,
comment );
1106 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
1113 if (
file != NULL &&
file->ff != NULL ) {
1125 #if !defined(HAVE_LIBCFITSIO)
1134 CHAR keyword[FLEN_KEYWORD];
1140 CALL_FITS( fits_read_key_flt,
file->ff, keyword, value,
comment );
1152 #if !defined(HAVE_LIBCFITSIO)
1161 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
1166 CALL_FITS( fits_write_key_dbl,
file->ff, keyword, value, DBL_DIG,
comment );
1167 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
1174 if (
file != NULL &&
file->ff != NULL ) {
1186 #if !defined(HAVE_LIBCFITSIO)
1195 CHAR keyword[FLEN_KEYWORD];
1201 CALL_FITS( fits_read_key_dbl,
file->ff, keyword, value,
comment );
1213 #if !defined(HAVE_LIBCFITSIO)
1222 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
1227 REAL4 val[2] = {crealf( value ), cimagf( value )};
1228 CALL_FITS( fits_write_key_cmp,
file->ff, keyword, val, FLT_DIG,
comment );
1229 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
1236 if (
file != NULL &&
file->ff != NULL ) {
1248 #if !defined(HAVE_LIBCFITSIO)
1257 CHAR keyword[FLEN_KEYWORD];
1263 REAL4 val[2] = {0, 0};
1264 CALL_FITS( fits_read_key_cmp,
file->ff, keyword, val,
comment );
1265 *value =
crectf( val[0], val[1] );
1277 #if !defined(HAVE_LIBCFITSIO)
1286 CHAR keyword[FLEN_KEYWORD],
unit[FLEN_VALUE];
1291 REAL8 val[2] = {creal( value ), cimag( value )};
1292 CALL_FITS( fits_write_key_dblcmp,
file->ff, keyword, val, DBL_DIG,
comment );
1293 CALL_FITS( fits_write_key_unit,
file->ff, keyword,
unit );
1300 if (
file != NULL &&
file->ff != NULL ) {
1312 #if !defined(HAVE_LIBCFITSIO)
1321 CHAR keyword[FLEN_KEYWORD];
1327 REAL8 val[2] = {0, 0};
1328 CALL_FITS( fits_read_key_dblcmp,
file->ff, keyword, val,
comment );
1329 *value =
crect( val[0], val[1] );
1341 #if !defined(HAVE_LIBCFITSIO)
1350 CHAR keyword[FLEN_KEYWORD];
1359 } bad_cast = { .cc = value };
1360 CALL_FITS( fits_write_key_longstr,
file->ff, keyword, bad_cast.c,
comment );
1367 if (
file != NULL &&
file->ff != NULL ) {
1379 #if !defined(HAVE_LIBCFITSIO)
1389 CHAR keyword[FLEN_KEYWORD];
1395 CALL_FITS( fits_read_key_longstr,
file->ff, keyword, &val,
comment );
1398 if ( val != NULL ) {
1399 fits_free_memory( val, &
status );
1404 if ( val != NULL ) {
1405 fits_free_memory( val, &
status );
1414 #if !defined(HAVE_LIBCFITSIO)
1423 CHAR keyword[FLEN_KEYWORD];
1434 } bad_casts[values->length];
1435 for (
size_t i = 0;
i < values->length; ++
i ) {
1438 CALL_FITS( fits_write_keys_str,
file->ff, keyword, 1, values->length, values->data, (
CHAR ** ) &bad_casts[0] );
1446 if (
file != NULL &&
file->ff != NULL ) {
1458 #if !defined(HAVE_LIBCFITSIO)
1467 CHAR keyword[FLEN_KEYWORD];
1478 CALL_FITS( fits_read_keys_str,
file->ff, keyword, 1,
FFIO_MAX, vals_ptr, &nfound );
1481 for (
int i = 0;
i < nfound; ++
i ) {
1496 #if !defined(HAVE_LIBCFITSIO)
1505 CHAR keyword[FLEN_KEYWORD];
1517 utc.tm_year += 1900;
1519 CHAR utc_str[FLEN_VALUE];
1520 CALL_FITS( fits_time2str, utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ( gps.
gpsNanoSeconds /
XLAL_BILLION_REAL8 ), 9, utc_str );
1521 CALL_FITS( fits_write_key_str,
file->ff, keyword, utc_str,
comment );
1525 CHAR buf[FLEN_KEYWORD - 4];
1526 strncpy( buf, keyword,
sizeof( buf ) );
1527 snprintf( keyword, FLEN_KEYWORD,
"%s GPS", buf );
1528 CHAR gps_str[FLEN_VALUE];
1530 CALL_FITS( fits_write_key_str,
file->ff, keyword, gps_str,
"UTC value takes precedence" );
1537 if (
file != NULL &&
file->ff != NULL ) {
1549 #if !defined(HAVE_LIBCFITSIO)
1554 CHAR *utc_str = NULL;
1559 CHAR keyword[FLEN_KEYWORD];
1566 double sec = 0, int_sec = 0, frac_sec = 0;
1567 CALL_FITS( fits_str2time, utc_str, &utc.tm_year, &utc.tm_mon, &utc.tm_mday, &utc.tm_hour, &utc.tm_min, &sec );
1568 frac_sec = modf( sec, &int_sec );
1569 utc.tm_year -= 1900;
1571 utc.tm_sec = lrint( int_sec );
1589 #if !defined(HAVE_LIBCFITSIO)
1603 file->hdutype = IMAGE_HDU;
1604 strncpy(
file->hduname,
name,
sizeof(
file->hduname ) - 1 );
1609 file->array.bitpix = INT_MAX;
1610 file->array.datatype = INT_MAX;
1613 file->array.naxis = ndim;
1614 for (
int i = 0;
i <
file->array.naxis; ++
i ) {
1616 file->array.naxes[
i] = dims[
i];
1624 if (
file != NULL &&
file->ff != NULL ) {
1636 #if !defined(HAVE_LIBCFITSIO)
1650 file->hdutype = IMAGE_HDU;
1651 strncpy(
file->hduname,
name,
sizeof(
file->hduname ) - 1 );
1655 file->array.bitpix = INT_MAX;
1656 file->array.datatype = INT_MAX;
1659 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
1660 CALL_FITS( fits_movnam_hdu,
file->ff,
file->hdutype,
file->hduname, 0 );
1663 CALL_FITS( fits_get_img_dim,
file->ff, &
file->array.naxis );
1664 *ndim =
file->array.naxis;
1666 CALL_FITS( fits_get_img_size,
file->ff,
file->array.naxis,
file->array.naxes );
1667 for (
int i = 0;
i <
file->array.naxis; ++
i ) {
1669 dims[
i] =
file->array.naxes[
i];
1682 #if !defined(HAVE_LIBCFITSIO)
1686 const size_t dims[1] = { dim0 };
1695 #if !defined(HAVE_LIBCFITSIO)
1702 if ( dim0 != NULL ) {
1712 #if !defined(HAVE_LIBCFITSIO)
1716 const size_t dims[2] = { dim0, dim1 };
1725 #if !defined(HAVE_LIBCFITSIO)
1732 if ( dim0 != NULL ) {
1735 if ( dim1 != NULL ) {
1745 #if !defined(HAVE_LIBCFITSIO)
1761 for (
int i = 0;
i <
file->array.naxis; ++
i ) {
1766 if (
file->array.bitpix == INT_MAX ||
file->array.datatype == INT_MAX ) {
1767 file->array.bitpix = bitpix;
1768 file->array.datatype = datatype;
1771 CALL_FITS( fits_create_img,
file->ff, bitpix,
file->array.naxis,
file->array.naxes );
1772 CALL_FITS( fits_write_key_str,
file->ff,
"HDUNAME",
file->hduname,
file->hducomment );
1773 CALL_FITS( fits_write_key_str,
file->ff,
"EXTNAME",
file->hduname,
file->hducomment );
1781 for (
int i = 0;
i <
file->array.naxis; ++
i ) {
1782 fpixel[
i] = 1 + idx[
i];
1787 } bad_cast = { .cv =
elem };
1788 CALL_FITS( fits_write_pix,
file->ff,
file->array.datatype, fpixel, 1, bad_cast.c );
1795 if (
file != NULL &&
file->ff != NULL ) {
1805 static int UNUSED
XLALFITSArrayRead(
FITSFile UNUSED *
file,
const size_t UNUSED idx[],
const int UNUSED bitpix,
const int UNUSED datatype,
void UNUSED *
elem,
void UNUSED *nulelem )
1807 #if !defined(HAVE_LIBCFITSIO)
1824 for (
int i = 0;
i <
file->array.naxis; ++
i ) {
1829 if (
file->array.bitpix == INT_MAX ||
file->array.datatype == INT_MAX ) {
1830 file->array.bitpix = bitpix;
1831 file->array.datatype = datatype;
1838 for (
int i = 0;
i <
file->array.naxis; ++
i ) {
1839 fpixel[
i] = 1 + idx[
i];
1842 CALL_FITS( fits_read_pix,
file->ff, datatype, fpixel, 1, nulelem,
elem, &anynul );
1854 #if !defined(HAVE_LIBCFITSIO)
1858 const unsigned short e =
elem;
1867 #if !defined(HAVE_LIBCFITSIO)
1871 unsigned short e = 0, ne = 0;
1881 #if !defined(HAVE_LIBCFITSIO)
1885 const unsigned long e =
elem;
1894 #if !defined(HAVE_LIBCFITSIO)
1898 unsigned long e = 0, ne = 0;
1908 #if !defined(HAVE_LIBCFITSIO)
1913 const LONGLONG
e =
elem;
1922 #if !defined(HAVE_LIBCFITSIO)
1926 LONGLONG
e = 0, ne = 0;
1937 #if !defined(HAVE_LIBCFITSIO)
1941 const short e =
elem;
1950 #if !defined(HAVE_LIBCFITSIO)
1954 short e = 0, ne = 0;
1964 #if !defined(HAVE_LIBCFITSIO)
1968 const long e =
elem;
1977 #if !defined(HAVE_LIBCFITSIO)
1991 #if !defined(HAVE_LIBCFITSIO)
1995 const LONGLONG
e =
elem;
2004 #if !defined(HAVE_LIBCFITSIO)
2008 LONGLONG
e = 0, ne = 0;
2018 #if !defined(HAVE_LIBCFITSIO)
2022 const float e =
elem;
2031 #if !defined(HAVE_LIBCFITSIO)
2035 float e = 0, ne = 0;
2045 #if !defined(HAVE_LIBCFITSIO)
2049 const double e =
elem;
2058 #if !defined(HAVE_LIBCFITSIO)
2062 double e = 0, ne = 0;
2072 #if !defined(HAVE_LIBCFITSIO)
2086 XLAL_CHECK_FAIL( elems->size1 == (
size_t )
file->array.naxes[0],
XLAL_EINVAL,
"Number of 'elems' rows (%zu) does not match array dimension 0 (%li)", elems->size1,
file->array.naxes[0] );
2087 XLAL_CHECK_FAIL( elems->size2 == (
size_t )
file->array.naxes[1],
XLAL_EINVAL,
"Number of 'elems' rows (%zu) does not match array dimension 1 (%li)", elems->size2,
file->array.naxes[1] );
2091 if ( idx != NULL ) {
2092 memcpy(
i, idx,
file->array.naxis *
sizeof(
i[0] ) );
2096 for (
i[0] = 0;
i[0] < ( size_t )
file->array.naxes[0]; ++
i[0] ) {
2097 for (
i[1] = 0;
i[1] < ( size_t )
file->array.naxes[1]; ++
i[1] ) {
2098 const REAL8 elem = gsl_matrix_get( elems,
i[0],
i[1] );
2108 if (
file != NULL &&
file->ff != NULL ) {
2120 #if !defined(HAVE_LIBCFITSIO)
2137 GAMAT( *elems,
file->array.naxes[0],
file->array.naxes[1] );
2141 if ( idx != NULL ) {
2142 memcpy(
i, idx,
file->array.naxis *
sizeof(
i[0] ) );
2146 for (
i[0] = 0;
i[0] < ( size_t )
file->array.naxes[0]; ++
i[0] ) {
2147 for (
i[1] = 0;
i[1] < ( size_t )
file->array.naxes[1]; ++
i[1] ) {
2150 gsl_matrix_set( *elems,
i[0],
i[1],
elem );
2164 #if !defined(HAVE_LIBCFITSIO)
2176 file->hdutype = BINARY_TBL;
2177 strncpy(
file->hduname,
name,
sizeof(
file->hduname ) - 1 );
2188 if (
file != NULL &&
file->ff != NULL ) {
2200 #if !defined(HAVE_LIBCFITSIO)
2212 file->hdutype = BINARY_TBL;
2213 strncpy(
file->hduname,
name,
sizeof(
file->hduname ) - 1 );
2219 CALL_FITS( fits_movabs_hdu,
file->ff, 1, NULL );
2220 CALL_FITS( fits_movnam_hdu,
file->ff,
file->hdutype,
file->hduname, 0 );
2223 CALL_FITS( fits_get_num_rowsll,
file->ff, &
file->table.nrows );
2224 if ( nrows != NULL ) {
2225 *nrows =
file->table.nrows;
2236 static int UNUSED
XLALFITSTableColumnAdd(
FITSFile UNUSED *
file,
const CHAR UNUSED *
name,
const CHAR UNUSED *unit,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const void UNUSED *field,
const size_t UNUSED field_size,
const size_t UNUSED elem_size,
const int UNUSED typechar,
const int UNUSED datatype )
2238 #if !defined(HAVE_LIBCFITSIO)
2245 const int save_tfields = (
file != NULL ) ?
file->table.tfields : 0;
2258 XLAL_CHECK_FAIL( ( ( intptr_t ) field ) + field_size <= ( ( intptr_t ) record ) + record_size,
XLAL_EINVAL,
"Invalid field pointer" );
2266 const int i =
file->table.tfields++;
2269 file->table.field_size[
i] = field_size;
2272 file->table.noffsets[
i] = noffsets;
2273 memcpy(
file->table.offsets[
i], offsets,
sizeof(
file->table.offsets[
i] ) );
2274 file->table.offsets[
i][noffsets - 1] = ( size_t )( ( ( intptr_t ) field ) - ( ( intptr_t ) record ) );
2277 snprintf(
file->table.ttype[
i],
sizeof(
file->table.ttype[
i] ),
"%s",
name );
2280 snprintf(
file->table.tunit[
i],
sizeof(
file->table.tunit[
i] ),
"%s",
unit );
2283 snprintf(
file->table.tform[
i],
sizeof(
file->table.tform[
i] ),
"%zu%c", field_size / elem_size, typechar );
2286 file->table.datatype[
i] = datatype;
2287 file->table.nelements[
i] = ( datatype == TSTRING ) ? 1 : field_size / elem_size;
2289 if (
file->write ) {
2292 file->table.colnum[
i] = 1 +
i;
2297 CALL_FITS( fits_get_colnum,
file->ff, CASEINSEN,
file->table.ttype[
i], &
file->table.colnum[
i] );
2301 int datatype_chk = 0;
2302 long repeat_chk = 0, width_chk = 0;
2303 CALL_FITS( fits_get_coltype,
file->ff,
file->table.colnum[
i], &datatype_chk, &repeat_chk, &width_chk );
2304 if ( datatype_chk == TLONG ) {
2305 datatype_chk = TINT;
2307 XLAL_CHECK_FAIL( datatype_chk == datatype,
XLAL_EIO,
"Inconsistent column #%i datatype %i; should be %i",
i, datatype_chk, datatype );
2308 const size_t elem_size_chk = ( datatype_chk == TSTRING ) ? 1 : width_chk;
2309 const size_t field_size_chk = repeat_chk * elem_size_chk;
2310 XLAL_CHECK_FAIL( field_size_chk == field_size,
XLAL_EIO,
"Inconsistent column #%i field size %zu; should be %zu",
i, field_size_chk, field_size );
2311 XLAL_CHECK_FAIL( elem_size_chk == elem_size,
XLAL_EIO,
"Inconsistent column #%i element size %zu; should be %zu",
i, elem_size_chk, elem_size );
2320 if (
file != NULL ) {
2321 file->table.tfields = save_tfields;
2331 #if !defined(HAVE_LIBCFITSIO)
2337 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2338 XLAL_CHECK(
XLALFITSTableColumnAdd(
file, col_name,
"", noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'L', TLOGICAL ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2344 int XLALFITSTableColumnAddUINT2(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const UINT2 UNUSED *field,
const size_t UNUSED field_size )
2346 #if !defined(HAVE_LIBCFITSIO)
2352 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2355 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'U', TUSHORT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2361 int XLALFITSTableColumnAddUINT4(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const UINT4 UNUSED *field,
const size_t UNUSED field_size )
2363 #if !defined(HAVE_LIBCFITSIO)
2369 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2372 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'V', TINT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2378 int XLALFITSTableColumnAddUINT8(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const UINT8 UNUSED *field,
const size_t UNUSED field_size )
2380 #if !defined(HAVE_LIBCFITSIO)
2386 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2389 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'K', TLONGLONG ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2395 int XLALFITSTableColumnAddINT2(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const INT2 UNUSED *field,
const size_t UNUSED field_size )
2397 #if !defined(HAVE_LIBCFITSIO)
2403 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2406 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'I', TSHORT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2412 int XLALFITSTableColumnAddINT4(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const INT4 UNUSED *field,
const size_t UNUSED field_size )
2414 #if !defined(HAVE_LIBCFITSIO)
2420 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2423 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'J', TINT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2429 int XLALFITSTableColumnAddINT8(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const INT8 UNUSED *field,
const size_t UNUSED field_size )
2431 #if !defined(HAVE_LIBCFITSIO)
2437 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2440 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'K', TLONGLONG ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2446 int XLALFITSTableColumnAddREAL4(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const REAL4 UNUSED *field,
const size_t UNUSED field_size )
2448 #if !defined(HAVE_LIBCFITSIO)
2454 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2457 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'E', TFLOAT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2463 int XLALFITSTableColumnAddREAL8(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const REAL8 UNUSED *field,
const size_t UNUSED field_size )
2465 #if !defined(HAVE_LIBCFITSIO)
2471 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2474 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'D', TDOUBLE ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2482 #if !defined(HAVE_LIBCFITSIO)
2488 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2491 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'C', TCOMPLEX ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2499 #if !defined(HAVE_LIBCFITSIO)
2505 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2508 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
unit, noffsets, offsets, record, record_size, field, field_size,
sizeof( *field ),
'M', TDBLCOMPLEX ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2514 int XLALFITSTableColumnAddCHAR(
FITSFile UNUSED *
file,
const CHAR UNUSED *col_name,
const size_t UNUSED noffsets,
const size_t UNUSED offsets[2],
const void UNUSED *record,
const size_t UNUSED record_size,
const void UNUSED *field,
const size_t UNUSED field_size )
2516 #if !defined(HAVE_LIBCFITSIO)
2522 XLAL_CHECK( strlen( col_name ) < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2523 XLAL_CHECK(
XLALFITSTableColumnAdd(
file, col_name,
"", noffsets, offsets, record, record_size, field, field_size,
sizeof(
CHAR ),
'A', TSTRING ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2531 #if !defined(HAVE_LIBCFITSIO)
2538 XLAL_CHECK( strlen( col_name ) + 3 < FLEN_VALUE,
XLAL_EINVAL,
"Column name '%s' is too long", col_name );
2541 snprintf(
name,
sizeof(
name ),
"%s_s", col_name );
2542 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
"s", noffsets, offsets, record, record_size, &( field->gpsSeconds ),
sizeof( field->gpsSeconds ),
sizeof( field->gpsSeconds ),
'J', TINT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2543 snprintf(
name,
sizeof(
name ),
"%s_ns", col_name );
2544 XLAL_CHECK(
XLALFITSTableColumnAdd(
file,
name,
"ns", noffsets, offsets, record, record_size, &( field->gpsNanoSeconds ),
sizeof( field->gpsNanoSeconds ),
sizeof( field->gpsNanoSeconds ),
'J', TINT ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
2552 #if !defined(HAVE_LIBCFITSIO)
2567 if (
file->table.irow == 0 ) {
2569 for (
int i = 0;
i <
file->table.tfields; ++
i ) {
2570 ttype_ptr[
i] =
file->table.ttype[
i];
2571 tform_ptr[
i] =
file->table.tform[
i];
2572 tunit_ptr[
i] =
file->table.tunit[
i];
2574 CALL_FITS( fits_create_tbl,
file->ff,
file->hdutype, 0,
file->table.tfields, ttype_ptr, tform_ptr, tunit_ptr, NULL );
2575 CALL_FITS( fits_write_key_str,
file->ff,
"HDUNAME",
file->hduname,
file->hducomment );
2576 CALL_FITS( fits_write_key_str,
file->ff,
"EXTNAME",
file->hduname,
file->hducomment );
2583 for (
int i = 0;
i <
file->table.tfields; ++
i ) {
2589 } bad_cast = { .cv = record };
2590 void *value = bad_cast.v;
2591 for (
size_t n = 0;
n <
file->table.noffsets[
i]; ++
n ) {
2593 value = *( (
void ** ) value );
2595 value = (
void * )( ( ( intptr_t ) value ) +
file->table.offsets[
i][
n] );
2600 void *pvalue = (
file->table.datatype[
i] == TSTRING ) ? (
void * ) &value : value;
2601 CALL_FITS( fits_write_col,
file->ff,
file->table.datatype[
i],
file->table.colnum[
i],
file->table.irow, 1,
file->table.nelements[
i], pvalue );
2611 if (
file != NULL &&
file->ff != NULL ) {
2623 #if !defined(HAVE_LIBCFITSIO)
2638 if (
file->table.irow ==
file->table.nrows ) {
2644 if ( rem_nrows != NULL ) {
2645 *rem_nrows =
file->table.nrows -
file->table.irow;
2649 for (
int i = 0;
i <
file->table.tfields; ++
i ) {
2653 const size_t req_buf_size = 2 *
file->table.field_size[
i];
2654 if (
file->buf_size < req_buf_size ) {
2657 file->buf_size = req_buf_size;
2659 memset(
file->buf, 0, req_buf_size );
2663 void *pbuf = (
file->table.datatype[
i] == TSTRING ) ? (
void * ) &
file->buf :
file->buf;
2664 CALL_FITS( fits_read_col,
file->ff,
file->table.datatype[
i],
file->table.colnum[
i],
file->table.irow, 1,
file->table.nelements[
i], NULL, pbuf, NULL );
2668 void *value = record;
2669 for (
size_t n = 0;
n <
file->table.noffsets[
i]; ++
n ) {
2671 value = *( (
void ** ) value );
2673 value = (
void * )( ( ( intptr_t ) value ) +
file->table.offsets[
i][
n] );
2677 memcpy( value,
file->buf,
file->table.field_size[
i] );
#define __func__
log an I/O error, i.e.
#define XLAL_BILLION_REAL8
int XLALFITSArrayReadINT4(FITSFile UNUSED *file, const size_t UNUSED idx[], INT4 UNUSED *elem)
int XLALFITSHeaderReadREAL8(FITSFile UNUSED *file, const CHAR UNUSED *key, REAL8 UNUSED *value)
int XLALFITSArrayOpenWrite1(FITSFile UNUSED *file, const CHAR UNUSED *name, const size_t UNUSED dim0, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteUINT4(FITSFile UNUSED *file, const CHAR UNUSED *key, const UINT4 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSArrayOpenWrite(FITSFile UNUSED *file, const CHAR UNUSED *name, const size_t UNUSED ndim, const size_t UNUSED dims[], const CHAR UNUSED *comment)
int XLALFITSFileSeekNamedHDU(FITSFile UNUSED *file, const CHAR UNUSED *name)
int XLALFITSTableWriteRow(FITSFile UNUSED *file, const void UNUSED *record)
int XLALFITSHeaderWriteStringVector(FITSFile UNUSED *file, const CHAR UNUSED *key, const LALStringVector UNUSED *values, const CHAR UNUSED *comment)
int XLALFITSTableColumnAddCOMPLEX16(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const COMPLEX16 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSFileSeekPrimaryHDU(FITSFile UNUSED *file)
int XLALFITSHeaderWriteGPSTime(FITSFile UNUSED *file, const CHAR UNUSED *key, const LIGOTimeGPS UNUSED *value, const CHAR UNUSED *comment)
int XLALFITSTableColumnAddINT8(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const INT8 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayReadINT2(FITSFile UNUSED *file, const size_t UNUSED idx[], INT2 UNUSED *elem)
int XLALFITSHeaderWriteBOOLEAN(FITSFile UNUSED *file, const CHAR UNUSED *key, const BOOLEAN UNUSED value, const CHAR UNUSED *comment)
int XLALFITSArrayWriteREAL8(FITSFile UNUSED *file, const size_t UNUSED idx[], const REAL8 UNUSED elem)
int XLALFITSTableColumnAddUINT2(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const UINT2 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSTableReadRow(FITSFile UNUSED *file, void UNUSED *record, UINT8 UNUSED *rem_nrows)
int XLALFITSArrayReadGSLMatrix(FITSFile UNUSED *file, const size_t UNUSED idx[], gsl_matrix UNUSED **elems)
int XLALFITSHeaderReadINT2(FITSFile UNUSED *file, const CHAR UNUSED *key, INT2 UNUSED *value)
int XLALFITSHeaderQueryKeyExists(FITSFile UNUSED *file, const CHAR UNUSED *key, BOOLEAN UNUSED *exists)
FITSFile * XLALFITSFileOpenWrite(const CHAR UNUSED *file_name)
int XLALFITSHeaderReadCOMPLEX16(FITSFile UNUSED *file, const CHAR UNUSED *key, COMPLEX16 UNUSED *value)
int XLALFITSHeaderReadBOOLEAN(FITSFile UNUSED *file, const CHAR UNUSED *key, BOOLEAN UNUSED *value)
int XLALFITSHeaderReadREAL4(FITSFile UNUSED *file, const CHAR UNUSED *key, REAL4 UNUSED *value)
int XLALFITSHeaderReadCOMPLEX8(FITSFile UNUSED *file, const CHAR UNUSED *key, COMPLEX8 UNUSED *value)
int XLALFITSTableColumnAddCOMPLEX8(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const COMPLEX8 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayWriteINT2(FITSFile UNUSED *file, const size_t UNUSED idx[], const INT2 UNUSED elem)
int XLALFITSHeaderReadGPSTime(FITSFile UNUSED *file, const CHAR UNUSED *key, LIGOTimeGPS UNUSED *value)
int XLALFITSArrayWriteUINT8(FITSFile UNUSED *file, const size_t UNUSED idx[], const UINT8 UNUSED elem)
int XLALFITSArrayOpenRead2(FITSFile UNUSED *file, const CHAR UNUSED *name, size_t UNUSED *dim0, size_t UNUSED *dim1)
int XLALFITSHeaderReadINT8(FITSFile UNUSED *file, const CHAR UNUSED *key, INT8 UNUSED *value)
int XLALFITSHeaderWriteComment(FITSFile UNUSED *file, const CHAR UNUSED *format,...)
int XLALFITSFileWriteVCSInfo(FITSFile UNUSED *file, const LALVCSInfoList UNUSED vcs_list)
int XLALFITSArrayReadUINT4(FITSFile UNUSED *file, const size_t UNUSED idx[], UINT4 UNUSED *elem)
int XLALFITSFileWriteUVarCmdLine(FITSFile UNUSED *file)
int XLALFITSTableColumnAddINT2(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const INT2 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayOpenRead(FITSFile UNUSED *file, const CHAR UNUSED *name, size_t UNUSED *ndim, size_t UNUSED dims[])
int XLALFITSTableColumnAddUINT4(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const UINT4 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayReadINT8(FITSFile UNUSED *file, const size_t UNUSED idx[], INT8 UNUSED *elem)
int XLALFITSHeaderWriteINT2(FITSFile UNUSED *file, const CHAR UNUSED *key, const INT2 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteCOMPLEX16(FITSFile UNUSED *file, const CHAR UNUSED *key, const COMPLEX16 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSTableOpenWrite(FITSFile UNUSED *file, const CHAR UNUSED *name, const CHAR UNUSED *comment)
FITSFile * XLALFITSFileOpenRead(const CHAR UNUSED *file_name)
static int UNUSED XLALFITSArrayRead(FITSFile UNUSED *file, const size_t UNUSED idx[], const int UNUSED bitpix, const int UNUSED datatype, void UNUSED *elem, void UNUSED *nulelem)
int XLALFITSArrayWriteUINT2(FITSFile UNUSED *file, const size_t UNUSED idx[], const UINT2 UNUSED elem)
static int UNUSED XLALFITSTableColumnAdd(FITSFile UNUSED *file, const CHAR UNUSED *name, const CHAR UNUSED *unit, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const void UNUSED *field, const size_t UNUSED field_size, const size_t UNUSED elem_size, const int UNUSED typechar, const int UNUSED datatype)
int XLALFITSArrayWriteUINT4(FITSFile UNUSED *file, const size_t UNUSED idx[], const UINT4 UNUSED elem)
int XLALFITSHeaderWriteUINT2(FITSFile UNUSED *file, const CHAR UNUSED *key, const UINT2 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSArrayWriteREAL4(FITSFile UNUSED *file, const size_t UNUSED idx[], const REAL4 UNUSED elem)
int XLALFITSHeaderWriteINT8(FITSFile UNUSED *file, const CHAR UNUSED *key, const INT8 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSArrayReadREAL4(FITSFile UNUSED *file, const size_t UNUSED idx[], REAL4 UNUSED *elem)
int XLALFITSHeaderReadINT4(FITSFile UNUSED *file, const CHAR UNUSED *key, INT4 UNUSED *value)
int XLALFITSArrayOpenRead1(FITSFile UNUSED *file, const CHAR UNUSED *name, size_t UNUSED *dim0)
int XLALFITSArrayOpenWrite2(FITSFile UNUSED *file, const CHAR UNUSED *name, const size_t UNUSED dim0, const size_t UNUSED dim1, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteUINT8(FITSFile UNUSED *file, const CHAR UNUSED *key, const UINT8 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSArrayReadUINT2(FITSFile UNUSED *file, const size_t UNUSED idx[], UINT2 UNUSED *elem)
int XLALFITSArrayWriteINT8(FITSFile UNUSED *file, const size_t UNUSED idx[], const INT8 UNUSED elem)
int XLALFITSHeaderReadUINT2(FITSFile UNUSED *file, const CHAR UNUSED *key, UINT2 UNUSED *value)
void XLALFITSFileClose(FITSFile UNUSED *file)
int XLALFITSTableColumnAddREAL8(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const REAL8 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayWriteGSLMatrix(FITSFile UNUSED *file, const size_t UNUSED idx[], const gsl_matrix UNUSED *elems)
int XLALFITSTableColumnAddREAL4(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const REAL4 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSHeaderWriteINT4(FITSFile UNUSED *file, const CHAR UNUSED *key, const INT4 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSTableColumnAddGPSTime(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const LIGOTimeGPS UNUSED *field, const size_t UNUSED field_size)
int XLALFITSHeaderReadStringVector(FITSFile UNUSED *file, const CHAR UNUSED *key, LALStringVector UNUSED **values)
int XLALFITSTableColumnAddINT4(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const INT4 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayReadREAL8(FITSFile UNUSED *file, const size_t UNUSED idx[], REAL8 UNUSED *elem)
int XLALFITSHeaderWriteREAL4(FITSFile UNUSED *file, const CHAR UNUSED *key, const REAL4 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSHeaderWriteREAL8(FITSFile UNUSED *file, const CHAR UNUSED *key, const REAL8 UNUSED value, const CHAR UNUSED *comment)
static int UNUSED XLALFITSArrayWrite(FITSFile UNUSED *file, const size_t UNUSED idx[], const int UNUSED bitpix, const int UNUSED datatype, const void UNUSED *elem)
int XLALFITSHeaderReadUINT8(FITSFile UNUSED *file, const CHAR UNUSED *key, UINT8 UNUSED *value)
int XLALFITSHeaderWriteCOMPLEX8(FITSFile UNUSED *file, const CHAR UNUSED *key, const COMPLEX8 UNUSED value, const CHAR UNUSED *comment)
int XLALFITSArrayWriteINT4(FITSFile UNUSED *file, const size_t UNUSED idx[], const INT4 UNUSED elem)
int XLALFITSTableColumnAddCHAR(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const void UNUSED *field, const size_t UNUSED field_size)
int XLALFITSArrayReadUINT8(FITSFile UNUSED *file, const size_t UNUSED idx[], UINT8 UNUSED *elem)
int XLALFITSHeaderReadUINT4(FITSFile UNUSED *file, const CHAR UNUSED *key, UINT4 UNUSED *value)
int XLALFITSTableColumnAddUINT8(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const UINT8 UNUSED *field, const size_t UNUSED field_size)
int XLALFITSTableColumnAddBOOLEAN(FITSFile UNUSED *file, const CHAR UNUSED *col_name, const size_t UNUSED noffsets, const size_t UNUSED offsets[2], const void UNUSED *record, const size_t UNUSED record_size, const BOOLEAN UNUSED *field, const size_t UNUSED field_size)
int XLALFITSTableOpenRead(FITSFile UNUSED *file, const CHAR UNUSED *name, UINT8 UNUSED *nrows)
int XLALFITSHeaderReadString(FITSFile UNUSED *file, const CHAR UNUSED *key, CHAR UNUSED **value)
int XLALFITSHeaderWriteString(FITSFile UNUSED *file, const CHAR UNUSED *key, const CHAR UNUSED *value, const CHAR UNUSED *comment)
int XLALFITSFileWriteHistory(FITSFile UNUSED *file, const CHAR UNUSED *format,...)
char * XLALGPSToStr(char *s, const LIGOTimeGPS *t)
#define FFIO_MAX
Maximum possible number of FITS array dimensions, and FITS table columns.
struct tagFITSFile FITSFile
Representation of a FITS file.
#define XLAL_INIT_DECL(var,...)
void * XLALCalloc(size_t m, size_t n)
void * XLALRealloc(void *p, size_t n)
char char * XLALStringDuplicate(const char *s)
char * XLALStringAppendFmt(char *s, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(2
int XLALStringToUpperCase(char *string)
char * XLALStringToken(char **s, const char *delim, int empty)
const LALVCSInfo *const LALVCSInfoList[16]
LALStringVector * XLALAppendString2Vector(LALStringVector *vect, const CHAR *string)
INT4 XLALUTCToGPS(const struct tm *utc)
struct tm * XLALGPSToUTC(struct tm *utc, INT4 gpssec)
#define XLAL_ERROR_VOID(...)
#define XLAL_ERROR_NULL(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_FAIL(assertion,...)
#define XLAL_ERROR_FAIL(...)
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
p
RUN ANALYSIS SCRIPT ###.