Both Gnuastro and CFITSIO have special identifiers for each type that they
accept. Gnuastro’s type identifiers are fully described in Library data types (type.h) and are usable for all kinds of datasets (images, table columns,
etc) as part of Gnuastro’s Generic data container (gal_data_t
). However,
following the FITS standard, CFITSIO has different identifiers for images
and tables. Following CFITSIO’s own convention, we will use bitpix
for image type identifiers and datatype
for its internal identifiers
(and mainly used in tables). The functions introduced in this section can
be used to convert between CFITSIO and Gnuastro’s type identifiers.
One important issue to consider is that CFITSIO’s types are not fixed width
(for example, long
may be 32-bits or 64-bits on different
systems). However, Gnuastro’s types are defined by their width. These
functions will use information on the host system to do the proper
conversion. To have a portable (usable on different systems) code, is thus
recommended to use these functions and not to assume a fixed correspondence
between CFITSIO and Gnuastro’s types.
uint8_t
(int bitpix
)
¶Return the Gnuastro type identifier that corresponds to CFITSIO’s
bitpix
on this system.
int
(uint8_t type
)
¶Return the CFITSIO bitpix
value that corresponds to Gnuastro’s
type
.
char
(uint8_t type
)
¶Return the FITS standard binary table TFORM
character that
corresponds to Gnuastro’s type
.
int
(uint8_t type
)
¶Return the CFITSIO datatype
that corresponds to Gnuastro’s
type
on this machine.
uint8_t
(int datatype
, int is_table_column
)
¶Return Gnuastro’s type identifier that corresponds to the CFITSIO
datatype
. Note that when dealing with CFITSIO’s TLONG
, the
fixed width type differs between tables and images. So if the corresponding
dataset is a table column, put a non-zero value into
is_table_column
.
GNU Astronomy Utilities 0.20 manual, April 2023.