GNU Astronomy Utilities

Next: , Previous: , Up: FITS files   [Contents][Index] FITS Macros, errors and filenames

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.

gal_fits_io_error (int status, char *message)

If 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.

gal_fits_name_is_fits (char *name)

If the name is an acceptable CFITSIO FITS filename return 1 (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 CFITSIO.

gal_fits_suffix_is_fits (char *suffix)

Similar 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 fits and .fits.

char *
gal_fits_name_save_as_string (char *filename, char *hdu)

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).

Next: , Previous: , Up: FITS files   [Contents][Index]