A FITS file can contain multiple HDUs/extensions. The functions in this
section can be used to get basic information about the extensions or open
them. Note that
fitsfile is defined in CFITSIO’s
which is automatically included by Gnuastro’s gnuastro/fits.h.
If filename exists, open it and return the
that corresponds to it. If filename doesn’t exist, the file will be
created which contains a blank first extension and the pointer to its next
extension will be returned.
Return the number of HDUs/extensions in filename.
Return the format of the HDU as one of CFITSIO’s recognized macros:
Open the HDU/extension
hdu from filename and return a pointer
iomode determines how the FITS file
will be opened using CFITSIO’s macros:
The string in
hdu will be appended to filename in square
brackets so CFITSIO only opens this extension. You can use any formatting
hdu that is acceptable to CFITSIO. See the description under
--hdu in Input/Output options for more.
Open (in read-only format) the
hdu HDU/extension of filename
as an image or table. When
0(zero) but the HDU
is a table, this function will abort with an error. It will also abort with
an error when
1 (one), but the HDU is an
A FITS HDU may contain both tables or images. When your program needs one of these formats, you can call this function so if the user provided the wrong HDU/file, it will abort and inform the user that the file/HDU is has the wrong format.