Next: FITS header keywords, Previous: CFITSIO and Gnuastro types, Up: FITS files [Contents][Index]
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 fitsio.h
which is automatically included by Gnuastro’s gnuastro/fits.h.
*filename
)If filename exists, open it and return the fitsfile
pointer
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.
*filename
)Return the number of HDUs/extensions in filename.
*filename
, char *hdu
)Return the format of the HDU as one of CFITSIO’s recognized macros:
IMAGE_HDU
, ASCII_TBL
, or BINARY_TBL
.
*filename
, char *hdu
, int iomode
)Open the HDU/extension hdu
from filename and return a pointer
to CFITSIO’s fitsfile
. iomode
determines how the FITS file
will be opened using CFITSIO’s macros: READONLY
or READWRITE
.
The string in hdu
will be appended to filename in square
brackets so CFITSIO only opens this extension. You can use any formatting
for the hdu
that is acceptable to CFITSIO. See the description under
--hdu in Input/Output options for more.
*filename
, char *hdu
, int img0_tab1
)Open (in read-only format) the hdu
HDU/extension of filename
as an image or table. When img0_tab1
is 0
(zero) but the HDU
is a table, this function will abort with an error. It will also abort with
an error when img0_tab1
is 1
(one), but the HDU is an
image.
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.
Next: FITS header keywords, Previous: CFITSIO and Gnuastro types, Up: FITS files [Contents][Index]
GNU Astronomy Utilities 0.13 manual, September 2020.