Logo ROOT  
Reference Guide
No Matches
FITS file

Interface to FITS file.

TFITS is an interface that lets you reading Flexible Image Transport System (FITS) files, which are generally used in astronomy. This file format was standardized 1981 and today is still widely used among professional and amateur astronomers. FITS is not only an image file, but also it can contain spectrums, data tables, histograms, and multidimensional data. Furthermore, FITS data can be described itself by containing human-readable information that let us to interpret the data within the FITS file. For example, a FITS could contain a 3D data cube, but an additional description would tell us that we must read it, for example, as a 3-layer image.

TFITS requires CFITSIO library to be installed on your system. It is currently maintained by NASA/GSFC and can be downloaded from NASA/GSFC web site, as well as documentation.

Using this interface is easy and straightforward. There is only 1 class called "TFITSHDU" which has several methods to extract data from a FITS file, more specifically, from an HDU within the file. An HDU, or Header Data Unit, is a chunk of data with a header containing several "keyword = value" tokens. The header describes the structure of data within the HDU. An HDU can be of two types: an "image HDU" or a "table HDU". The former can be any kind of multidimensional array of real numbers, by which the name "image" may be confusing: you can store an image, but you can also store a N-dimensional data cube. On the other hand, table HDUs are sets of several rows and columns (a.k.a fields) which contain generic data, as strings, real or complex numbers and even arrays.

Please have a look to the tutorials ($ROOTSYS/tutorials/fitsio/) to see some examples. IMPORTANT: to run tutorials it is required that you change the current working directory of ROOT (CINT) shell to the tutorials directory. Example:

root [1] gSystem->ChangeDirectory("tutorials/fitsio")
root [1] .x FITS_tutorial1.C
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:849



CFITSIO library uses standard C types ('int', 'long', ...). To avoid confusion, the same types are used internally by the access methods. However, class's fields are ROOT-defined types.


 FITS file interface class. More...