THE XMM-NEWTON ABC GUIDE, STREAMLINED
RGS, Command Line
Prepare the Data
Reprocess the Data
Make a Light Curve
Generate and Apply a New GTI File
Check for Pile Up
Create the Photon Redistribution Matrix (RMF)
Many SAS tasks require calibration information from the Calibration Access Layer (CAL). Relevant files are accessed from the set of Current Calibration File (CCF) data using a CCF Index File (CIF). To set the environment parameter and make the ccf.cif file, type
cd ODF setenv SAS_ODF /full/path/to/ODF/directory/ setenv SAS_ODFPATH /full/path/to/ODF/directory/ cifbuild
To use the updated CIF file in further processing, you will need to reset the environment variable SAS_CCF:
setenv SAS_CCF /full/path/to/ODF/ccf.cif
The task odfingest extends the Observation Data File (ODF) summary file with data extracted from the instrument housekeeping data files and the calibration database. It is only necessary to run it once on any dataset, and will cause problems if it is run a second time. If for some reason odfingest must be rerun, you must first delete the earlier file it produced. This file largely follows the standard XMM naming convention, but has SUM.SAS appended to it. After running odfingest, you will need to reset the environment variable SAS_ODF to its output file. To run odfingest and reset the environment variable, type
odfingest setenv SAS_ODF /full/path/to/ODF/full_name_of_*SUM.SAS
You will likely find it useful to alias these environment variable resets in your login shell (.cshrc, .bashrc, etc.).
- cd ..
This takes several minutes, and outputs 12 files per RGS, plus 3 general use FITS files. At this point, renaming files to something easy to type is a good idea.
ln -s *R1*EVENLI*FIT r1_evt1.fits ln -s *R2*EVENLI*FIT r2_evt1.fitsThe pipeline task rgsproc is very flexible and can address potential pitfalls for RGS users. If the default parameters are sufficient for your data (and they should be for most), feel free to skip ahead. However, there are some cases where the standard processing may not be appropriate. These are discussed next.
First, if the data includes a nearby bright optical source, with certain pointing angles, zeroth-order optical light may be reflected off the telescope optics and onto the RGS CCD detectors. If this falls on an extraction region, the current energy calibration will require a wavelength-dependent zero-offset. Stray light can be detected on RGS DIAGNOSTIC images taken before, during and after the observation. This test, and the offset correction, are not performed on the data before delivery. To check for stray light and apply the appropriate offsets,
rgsproc calcoffsets=yes withoffsethistogram=nowhere
calcoffsets - calculate PHA offsets from diagnostic images
withoffsethistogram - produce a histogram of uncalibrated excess for the user
If the data includes a nearby bright X-ray background source that is well-separated from the target in the cross-dispersion direction, a mask can be created that excludes it from the background region. Here the source has been identified in the EPIC images and its coordinates have been taken from the EPIC source list which is included among the pipeline products. The bright neighboring object is found to be the third source listed in the sources file. The first source is the target:
rgsproc orders='1 2' withepicset=yes epicset=PiiiiiijjkkaablllEMSRLInmmm.FTZ \ exclsrcsexpr='INDEX==1&&INDEX==3'where
withepicset - calculate extraction regions for the sources contained in
an EPIC source list
epicset - name of the EPIC source list, such as generated by emldetect
or eboxdetect procedures
exclsrcsexpr - expression to identify which source(s) should be excluded
from the background extraction region
If the true coordinates of an object are not included in the EPIC source list or the science proposal, the user can define the coordinates of a new source:
rgsproc withsrc=yes srclabel='Capella' srcstyle=radec srcra=79.1708 srcdec=+45.9981where
withsrc - make the source be user-defined
srclabel - source name
srcstyle - coordinate system in which the source position is defined
srcra - the source's right ascension in decimal degrees
srcdec - the source's declination in decimal degrees
To make a banana plot, type
evselect table=r1_evt1.fits imageset=pi_bc.fits xcolumn=BETA_CORR ycolumn=PI \ imagebinning=imageSize ximagesize=600 yimagesize=600where
table - make the source be user-defined
imageset - source name
xcolumn - coordinate system in which the source position is defined
ycolumn - the source's right ascension in decimal degrees
imagebinning - the source's declination in decimal degrees
ximagesize - size of the image on x axis
yimagesize - size of the image on y axis
More experienced users should be aware that with SAS 13, the *SRCLI* file's column information changed. rgsproc now outputs an M_LAMBDA column instead of BETA_CORR, and M_LAMBDA should be used to generate the light curve. (The *SRCLI* file that came with the PPS products still contains a BETA_CORR column if you prefer to use that instead.)
To create a light curve, type
evselect table=r1_evt1.fits rateset=r1_ltcrv.fits maketimecolumn=yes \ timebinsize=50 makeratecolumn=yes \ expression= \ '(CCDNR==9)&&(REGION(P0134720401R1S007SRCLI_0000.FIT:RGS1_BACKGROUND,M_LAMBDA,XDSP_CORR))'where
table - input event table
rateset - name of output light curve file
maketimecolumn - make a time column
timebinsize - time binning (seconds)
makeratecolumn - make a count rate column, otherwise a count column will be created
expression - filtering criteria
The output file r1_ltcrv.fits can be viewed by using fv, as shown
in Figure 2.
- fv r1_ltcrv.fits &
Examination of the lightcurve shows that there are high flux times at the start and end of the observations. Lets say we're interested in the quiescent periods. To extract them, we need to make an additional Good Time Interval (GTI) file and apply it by rerunning rgsproc.
There are two tasks that make a GTI file: gtibuild and tabgtigen. Either will produce the needed file, so which one to use is a matter of the user's preference. Both are demonstrated below.
The first method, using gtibuild, requires a text file as input. In the first two columns, enter the start and end times (in seconds) that you are interested in, and in the third column, indicate with either a + or - sign whether that region should be kept or removed. Each good (or bad) time interval should get its own line. In the example case, we would write in our ASCII file (named gti.txt):
1.50233e8 1.50258e8 +and proceed to gtibuild:
gtibuild file=gti.txt table=gti.fitswhere
file - input text file
table - output GTI table
Alternatively, we could filter on TIME using tabgtigen using the filtering expression from the good times noted previously:
tabgtigen table=r1_ltcrv.fits gtiset=gtiset.fits timecolumn=TIME \ expression='(TIME in [1.50233e8:1.50258e8])'where
table - input data set (the light curve)
gtiset - output GTI file name
timecolumn - name of column that contains the time stamps
expression - filtering expression
Finally, we could filter on RATE using tabgtigen. The typical quiescent count rate for this observation is about 0.1 ct/s, so we would have:
tabgtigen table=r1_ltcrv.fits gtiset=gtiset.fits timecolumn=TIME \ expression='(RATE <= 0.1)'where parameters are as described above.
We can apply the GTI to the event file by running rgsproc again. rgsproc is a complex task, running several steps, with five different entry and exit points. It is not necessary to rerun all the steps in the procudure, only the ones involving filtering.
rgsproc auxgtitables=gti.fits entrystage=3:filter finalstage=5:fluxingwhere
auxgtitables - gti file in FITS format
entrystage - stage at which to begin processing
finalstage - stage at which to end processing
Depending on how bright the source is event pile up may be a problem. Pile up occurs when a source is so bright that incoming X-rays strike two neighboring pixels or the same pixel in the CCD more than once in a read-out cycle. In the RGS, it will cause two coincident 1st order photons to combine into a single 2nd order event at the same spatial position on the detector but at half the wavelength; this results in photons moving from 1st order to 2nd order, and 2nd order to 3rd. Further, it can increase the number of complicated event patterns of the sort that the on-board processing removes; this results in differences in pile up between the two RGS detectors, and between CCD locations.
It is always a good idea to check if your observation is piled up, especially if the object is bright (total count rate in all orders > 12 cts/s in RGS1, and 6 cts/s in RGS2).
One way to determine if there is pile up is to examine the ratio of 1st and 2nd order fluxed spectra. Non-piled sources should have fluxed spectra that agree within a few percent, while piled sources will show discrepancies of about 10% or higher.
When rgsproc is run through the 5:fluxing stage, one of the outputs is fluxed spectra. They follow the naming convention *OBX*fluxed1000.FIT and *OBX*fluxed1000.FIT, for the 1st and 2nd orders, respectively. They can be viewed with fv.
If for some reason rgsproc wasn't run through that stage, fluxed spectra are easy enough to produce with rgsfluxer. Please note that rgsfluxer requires as input the response files (RMFs) for the spectra; these are produced by rgsproc (and have the nomenclature *RSPMAT*.FIT) or, alternatively, can be generated with the task rgsrmfgen as discussed below. Each RGS instrument and each order will have its own RMF.
To make fluxed order 1 spectra,
rgsfluxer pha='P0134720401R1S007SRSPEC1001.FIT P0134720401R2S008SRSPEC1001.FIT' \ rmf='P0134720401R1S007RSPMAT1001.FIT P0134720401R2S008RSPMAT1001.FIT' \ file=fluxed_o1.fitswhere
pha - list of spectrum files
rmf - list of response matrices
file - output spectrum
Fluxed 2nd order spectra are made in a similar way.
Unfortunately, if your spectrum is piled up, there is not a lot you can do to fix it; there is no tried-and-true method like with the EPIC and what there is applies only to certain cases, such as if you assume the 2nd order spectrum is composed entirely of piled up 1st order photons. For more information, see Ness et al. 2007, ApJ, 665, 1334.
Response matrices (RMFs) are not provided as part of the pipeline product package (PPS); as noted above, rgsproc generates response matrices automatically, with the nomenclature *RSPMAT*.FIT. But recall that the source coordinates are under the user's control. The source coordinates have a profound influence on the accuracy of the wavelength scale as recorded in the RMFs that are produced automatically by rgsproc.
Making the RMF is easily done with rgsrmfgen. Please note that, unlike with EPIC data, it is not necessary to make ancillary response files (ARFs). To make an RMF for the 1st order RGS1 spectrum,
rgsrmfgen spectrumset=P0134720401R1S007SRSPEC1001.FIT rmfset=r1_o1_rmf.fits \ evlist=r1_evt1.fits emin=0.4 emax=2.5 rows=5000where
spectrumset - spectrum file
evlist - event file
emin - lower energy limit of the response file
emax - upper energy limit of the response file
rows - number of energy bins; this should be greater than 3000
rmfset - output FITS file
RMFs for the RGS1 2nd order, and for the RGS2 1st and 2nd orders, are made in a similar way.
Spectra from the same order in RGS1 and RGS2 can be safely combined to create a spectrum with higher signal-to-noise if they were reprocessed using rgsproc with spectrumbinning=lambda. (This is the default setting.) The task we will use to merge source spectra, rgscombine, also merges response files and background spectra. When merging response files, be sure that they have the same number of bins. For this example, we will use the RMFs that were generated by rgsproc, which have a default bin number of 4000.
To merge 1st order RGS1 and RGS2 spectra,
rgscombine pha='P0134720401R1S007SRSPEC1001.FIT P0134720401R2S008SRSPEC1001.FIT' \ rmf='P0134720401R1S007RSPMAT1001.FIT P0134720401R2S008RSPMAT1001.FIT' \ bkg='P0134720401R1S007BGSPEC1001.FIT P0134720401R2S008BGSPEC1001.FIT' \ filepha='r12_o1_srspec.fits' filermf='r12_o1_rmf.fits' \ filebkg='r12_o1_bgspec.fits' rmfgrid=4000where
pha - list of spectrum files
rmf - list of response matrices
bkg - list of bakcground spectrum files
filepha - output merged spectrum
filermf - output merged response matrix
filebkg - output merged badkground spectrum
rmfgrid - number of energy bins; should be the same as the input RMFs
The spectrum can be fit using HEASoft or CIAO packages, as SAS does not include fitting software.
If you have any questions concerning XMM-Newton send e-mail to email@example.com