Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
FITS_tutorial6.C File Reference

Detailed Description

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

void FITS_tutorial6()
{
// We open a table from a FITS file
// and dump its columns.
TString dir = gROOT->GetTutorialDir();
//Open the table
TFITSHDU hdu(dir + "/fitsio/sample4.fits[1]");
// Show columns
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());
}
}
#define gROOT
Definition TROOT.h:407
FITS file interface class.
Definition TFITS.h:35
Basic string class.
Definition TString.h:139
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
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
Author
Claudi Martinez

Definition in file FITS_tutorial6.C.