Some general constructs provided by Gnuastro’s FITS handling functions are discussed here. In particular there are several useful functions about FITS file names.
The maximum number of dimensions a dataset can have in FITS format, according to the FITS standard this is 999.
status is non-zero, this function will print the CFITSIO error
message corresponding to status, print
message (optional) in the
next line and abort the program. If
message==NULL, it will print a
default string after the CFITSIO error.
name is an acceptable CFITSIO FITS filename return
(one), otherwise return
0 (zero). The currently acceptable FITS
suffixes are .fits, .fit, .fits.gz, .fits.Z,
.imh, .fits.fz. IMH is the IRAF format which is acceptable to
gal_fits_name_is_fits, but only for the suffix. The
suffix doesn’t have to start with ‘.’: this function will return
1 (one) for both
If the name is a FITS name, then put a
(hdu: ...) after it and
return the string. If it isn’t a FITS file, just print the name, if
filename==NULL, then return the string
stdin. Note that the
output string’s space is allocated.
This function is useful when you want to report a random file to the user which may be FITS or not (for a FITS file, simply the filename is not enough, the HDU is also necessary).