In this chapter, we will do some simple spectral fitting, using as an example
the source and background that was extracted from the Lockman Hole observation
(Obs ID 0123700101) in §6 (or §7
if you used the GUI), and its RMF and ARF files. All tasks will be called from
the command line.
Prior to fitting, users are encouraged to read this Guide's discussion on statistics
in §14.1. More information can be found in Humphreys et al. 2009, ApJ,
693, 822.
For this example, we are interested in just a quick fit to see what we are dealing
with, so we will rebin the data. The procedure grppha from FTOOL provides
an excellent mechanism to do that. The following commands not only group the source
spectrum for Xspec but also associate the appropriate background and response files
for the source. This is done simply by calling the task and editting parameters as
is appropriate:
> ftools
> grppha
Please enter PHA filename[] mos1_pi.fits ! input spectrum file name
Please enter output filename[] mos1_grp30.fits ! output grouped spectrum
GRPPHA[] chkey BACKFILE bkg_pi.fits ! include the background spectrum
GRPPHA[] chkey RESPFILE mos1_rmf.fits ! include the RMF
GRPPHA[] chkey ANCRFILE mos1_arf.fits ! include the ARF
GRPPHA[] group min 30 ! group the data by 30 counts/bin
GRPPHA[] exit
Next, use Xspec to fit the spectrum, editting the parameters as needed. We'll use two lightly absorbed power laws as a first try.
XSPEC> data mos1_grp.fits ! input data
XSPEC> ignore 0.0-0.2,6.6-** ! set a range appropriate for the data, in keV
XSPEC> model pow ! set spectral model to a power law
1:powerlaw:PhoIndex> 2.0 ! set the power law photon index to 2.0
2:powerlaw:norm> ! default model normalization
XSPEC> renorm ! renormalize the model spectrum
XSPEC> fit ! fit the model to the data
XSPEC> setplot device /xw ! set the plot device
XSPEC> setplot energy ! plot energy along the X axis
XSPEC> plot ldata ratio ! plot two panels with the log of the data and
! the data/model ratio values along the Y axes
XSPEC> exit ! exit Xspec
Do you really want to exit? (y) y
The spectrum is shown in Figure 13.1.