F I T S_Tutorial 3

Open a FITS file and retrieve the first plane of the image array as a TImage object.

Author: Claudi Martinez
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Friday, September 18, 2020 at 07:56 AM.

We open a fits file that contains several image extensions. The primary HDU contains no data. Data copyright: NASA

Open extensions 1 to 5 from file

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

auto c = new TCanvas("c1", "FITS tutorial #1", 800, 700);
c->Divide(2, 3);
for (auto i : ROOT::TSeqI(1, 6)) {
   TFITSHDU hdu(dir + "/fitsio/sample3.fits", i);

   TImage* im = (TImage *)hdu.ReadAsImage(0);
   c->cd(i);
   im->Draw();
}
Info in <TFITSHDU::LoadHDU>: The selected HDU contains an Image Extension
Info in <TFITSHDU::LoadHDU>: The selected HDU contains an Image Extension
Info in <TFITSHDU::LoadHDU>: The selected HDU contains an Image Extension
Info in <TFITSHDU::LoadHDU>: The selected HDU contains an Image Extension
Info in <TFITSHDU::LoadHDU>: The selected HDU contains an Image Extension

Draw all canvases

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