|
Introduction
This thread describes how to extract the spectrum of a point-like source
observed with the PN camera in timing mode using the command line.
Expected Outcome
The final outcome of this thread is the standard suite of spectral products
required by spectral analysis packages such as XSPEC:
- A source+background (commonly referred to as "source") spectrum
- A background spectrum
- A redistribution matrix (commonly referred to as a "RMF" file)
- An effective area vector (commonly referred to as an "ARF" file)
SAS Tasks to be Used
Prerequisites
Useful Links
EPIC
status of calibration and data analysis document
This thread makes use of the image display software ds9.
Caveats
|
Procedure
This thread contains a step-by-step recipe to extract PN spectra of a point-like
source observed in Timing mode and to create associated response matrices, starting from a calibrated,
concatenated event list (either produced with
epproc
/
epchain or available
as PPS product; here it has been assumed that the name of the event file is
PN.fits).
All the analysis steps are performed with single SAS tasks started from
the command line to explain the general method of generating spectral products
and to show explicitly the usage and setting of task parameters. The users
should note that the SAS meta-task
xmmselect allows them to interactively
define source and background regions (via
ds9) and to run
backscale on the
fly. Especially the
xmmselect:Spectral Products generation
method creates source and background spectra as well as related ancillary and
redistribution files in one go. However, notice that the source extraction
region to be used should be standard. Check the
Caveats section referring to the treatment of pile-up in
timing mode before trying non-standard extraction regions as the ARF
generation could not be valid. For example, with the extraction regions
illustrated in Fig.1 the use of the
xmmselect:Spectral Products
generation would be valid.
The method described below follows
the command line method. For more details on how to
use xmmselect
for the generation of EPIC spectra, the reader is
referred to the User
Guide to the XMM-Newton Science Analysis System.
-
Set up your SAS environment (following the
SAS
startup Thread)
- If necessary, create a PN cleaned and filtered for particle background event file for your observation
(see the
How to filter EPIC event lists for flaring particle background Thread).
Lets assume that a filtered file has been created from the file PN.fits, with name: PNclean.fits
-
Extract an image in RAW coordinates
evselect table=PNclean.fits imagebinning=binSize imageset=PNimage.fits withimageset=yes \
xcolumn=RAWX ycolumn=RAWY ximagebinsize=1 yimagebinsize=1
-
Display the image (Fig.1., left). Note, that in timing mode, the RAWY coordinate
is not giving spatial but timing information and hence, the source
is visible as a bright strip when plotting RAWX against RAWY.
imgdisplay withimagefile=true imagefile=PNimage.fits
This command is equivalent to the following:
ds9 PNimage.fits
 |
 |
| Fig.1: Left, RAWY vs. RAWX image. Rectangular regions
have been overlaid to illustrate the source extraction (solid green
line) and background extraction (dashed green line)
regions. Right, distribution of RAWX corresponding to the image
on the left. |
-
Select the region, from which the spectrum shall be accumulated. The
selection of source and background extraction regions is somewhat
arbitrary. In general terms, the source extraction region
should be centered in the RAWX column with the highest number of
counts. This information can be extracted from the distribution of the
RAWX values (Fig.1., right).
As for the background region, it should be selected as
further away from the source region as possible (see Fig.1., left).
For this particular example, the source extraction region is centered
in RAWX=38 with a width of 18 pixels. The background region is centered
in RAWX=4 with a width of 2 pixels.
Something that should be kept in mind when defining the source and
background extraction regions is that regardeless of the definition
given above, the background region can still be contaminated by the source. A
good way to see this is by plotting RAWX vs. PI, where PI is the energy
of the events in unit of eV (Fig.2.). Notice that the effect is energy
dependant (refer to XMM-SOC-CAL-TN-0083
for more information).
 |
| Fig.2: RAWX vs. PI
image. PI has been limited
between 0.2-10. keV to produce this image. The scale in the z-axis has
been set to logarithmic to enhance the effect. The solid and dashed green
boxes overlaid on the image correspond to the same source and
background extraction regions used in Fig.1. |
Other useful
information on the selection of source and background extraction
regions can be found in the Caveats section and
in the SAS User
Guide (EPIC chapter, section titled
Generating spectra).
-
Extract a source spectrum, using the region highlighted in Fig.1., left, and
restricting the patterns to single and double events.
evselect table=PNclean.fits withspectrumset=yes spectrumset=PNsource_spectrum.fits \
energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0 specchannelmax=20479 \
expression='(FLAG==0) && (PATTERN<=4)
&& (RAWX>=29) && (RAWX<=47)'
-
Extract a background spectrum, using the region highlighted in Fig.1., left. In the following, we assume that the background is extracted from a source-free
region.
evselect table=PNclean.fits withspectrumset=yes spectrumset=PNbackground_spectrum.fits \
energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0 specchannelmax=20479 \
expression='(FLAG==0) && (PATTERN<=4) && (RAWX>=3) && (RAWX<=5)'
-
Calculate the area of source and background region used to make the spectral
files. The area is written into the header of the SPECTRUM table of the file
as keyword BACKSCAL (if the spectrum is created via xmmselect,
backscale will run automatically).
backscale spectrumset=PNsource_spectrum.fits badpixlocation=PNclean.fits
backscale spectrumset=PNbackground_spectrum.fits badpixlocation=PNclean.fits
-
Generate a redistribution matrix
Currently there are two possible approaches:
a) use the SAS task rmfgen to create a redistribution matrix
for your previously extracted spectrum:
rmfgen spectrumset=PNsource_spectrum.fits rmfset=PN.rmf
b) use the ready-made canned response matrix.
-
Generate an ancillary file
arfgen spectrumset=PNsource_spectrum.fits arfset=PN.arf withrmfset=yes rmfset=PN.rmf \
badpixlocation=PNclean.fits detmaptype=psf
-
Rebin the spectrum and populate the header keywords with the names of
the required response and background files. In the following example the
spectrum is rebinned in order to have at least 25 counts for each background-subtracted
spectral channel and not to oversample the intrinsic energy resolution by a factor
larger then 3.
specgroup spectrumset=PNsource_spectrum.fits mincounts=25 oversample=3 rmfset=PN.rmf \
arfset=PN.arf backgndset=PNbackground_spectrum.fits
-
Fit the spectrum
Last Updated: 2 November 2010
Caveats
If your observation is affected by pile-up, check the corresponding section of the SAS User
Guide (EPIC chapter, section How to analyse a piled-up Timing
mode observation) for information on the analysis of piled-up Timing
mode observations. Of especial relevance is the recipe on how to deal with the generation of an ARF file
using the sas task arfgen.
See also the thread on
How to evaluate the pile-up fraction in an EPIC source.
Notice that in the case of PN Timing mode observations (where the rate of single
to double events depends on the source position) one should always create
and fit a spectrum of the combined single and double events. For more details
on the spectral analysis of data obtained in Timing and Burst mode, see
XMM-SOC-CAL-TN-0018.
Timing mode is typically used to observe bright sources. This means that
the counts from the whole CCD area are dominated by the source, leaving
often no source free-region areas from which the background can be
reliably obtained. In such a case, it might be better not to perform any
background subtraction. Users are referred to the discussion in XMM-SOC-CAL-TN-0083.
For observations taken in pn burst mode, users are referred to the
document XMM-SOC-CAL-TN-0069,
where the special techniques of data reduction needed for this mode are described.
|