coolest.template.classes.fits_file#

Classes#

FitsFile

Class that represents a FITS file on the disk.

Module Contents#

class FitsFile(path: str, directory: str = None, check_exist: bool = False)[source]#

Class that represents a FITS file on the disk.

Parameters:
  • path (str) – Path to the FITS file, depending on usage either relative or absolute.

  • directory (str, optional) – Absolute directory containing the FITS file, in case path is a relative, by default None

  • check_exist (bool, optional) – If True, will check if the FITS file exists when the object is instantiated, by default False

Raises:

RuntimeError – If the FITS file does not exist on the disk.

path[source]#
property abs_path[source]#
exists()[source]#
read(directory=None)[source]#

Read the data and header content of the FITS file, using astropy.io.fits.

A directory must be given typically when it has not been set at the initialization of the object.

Parameters:

directory (str, optional) – Absolute directory containing the FITS file, by default None

Returns:

(data, header) content of the FITS file (as returned by fits.getdata())

Return type:

ndarray or recarray or Group

Raises:

ValueError – If no directory is provided and no directory has been set beforehand.