F I T S_Tutorial 6

Open a FITS file whose primary array represents a spectrum table (flux vs wavelength) and dump its columns

Author: Claudi Martinez
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Wednesday, January 27, 2021 at 08:45 AM.

We open a table from a fits file and dump its columns.

In [1]:
TString dir = gROOT->GetTutorialDir();

Open the table

In [2]:
TFITSHDU hdu(dir + "/fitsio/sample4.fits[1]");
Info in <TFITSHDU::LoadHDU>: The selected HDU contains a Table Extension

Show columns

In [3]:
const auto nColumns = hdu.GetTabNColumns();
printf("The table has %d columns:\n", nColumns);
for (auto i : ROOT::TSeqI(nColumns)) {
   printf(" - Column %d: %s\n", i, hdu.GetColumnName(i).Data());
}
The table has 8 columns:
 - Column 0: objId
 - Column 1: ra
 - Column 2: dec
 - Column 3: mag
 - Column 4: reddening
 - Column 5: objType
 - Column 6: mu_ra
 - Column 7: mu_dec

Draw all canvases

In [4]:
gROOT->GetListOfCanvases()->Draw()