ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
FITS_tutorial2.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_FITS
3
/// \notebook -draw
4
/// Open a FITS file whose primary array represents
5
/// a spectrum (flux vs wavelength).
6
///
7
/// \macro_image
8
/// \macro_code
9
/// \macro_output
10
///
11
/// \author Claudi Martinez
12
13
void
FITS_tutorial2()
14
{
15
// We're gonna open a FITS file that contains the primary HDU and a little data table.
16
// The primary HDU is an array of 2 rows by 2040 columns, and they represent a radiation
17
// spectrum. The first row contains the flux data, whereas the second row the wavelengths.
18
// Data copyright: NASA
19
20
TString
dir =
gROOT
->GetTutorialDir();
21
22
// Open primary HDU from file
23
TFITSHDU
hdu(dir +
"/io/fitsio/sample2.fits"
);
24
25
// Dump the HDUs within the FITS file
26
// and also their metadata
27
hdu.Print(
"F+"
);
28
29
// We now generate a TGraph from vectors
30
std::unique_ptr<TVectorD> Y(hdu.GetArrayRow(0));
31
std::unique_ptr<TVectorD>
X
(hdu.GetArrayRow(1));
32
TGraph
gr
(*
X
,*Y);
33
34
// Show the graphic
35
auto
c
=
new
TCanvas
(
"c1"
,
"FITS tutorial #2"
, 800, 800);
36
gr
.SetFillColor(
kRed
);
37
gr
.DrawClone(
"BA"
);
38
}
c
#define c(i)
Definition
RSha256.hxx:101
kRed
@ kRed
Definition
Rtypes.h:67
X
#define X(type, name)
gROOT
#define gROOT
Definition
TROOT.h:417
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TFITSHDU
FITS file interface class.
Definition
TFITS.h:35
TGraph
Definition
TGraph.h:41
TString
Basic string class.
Definition
TString.h:138
gr
TGraphErrors * gr
Definition
legend1.C:25
tutorials
io
fitsio
FITS_tutorial2.C
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1