next up previous contents
Next: 7. An OM Data Up: XMM ABC Guide Previous: 5. An EPIC Data   Contents

Subsections


6. An RGS Data Processing and Analysis Primer

Before beginning this chapter please consult the ``watchout'' page at the VILSPA SOC:

http://xmm.esac.esa.int/sas/7.0.0/watchout/
This web site discusses current and past SAS bugs and analysis issues.

Many files are associated with an RGS dataset, and it is easy to be overwhelmed. The INDEX.HTM file, and links therein, are viewable with a web browser and will help you navigate the dataset. The different types of files are discussed in more detail in Chapter 3.

As ever, it is strongly recommended that you keep all reprocessed data in its own directory! SAS places output files in whichever directory it is in when a task is called. Throughout this primer, it is assumed that the Pipleline Processed data are in the PPS directory, the ODF data (with upper case file names, and uncompressed) are in the directory ODF, the reprocessing and analysis is taking place in the PROC directory, and the CCF data are in the directory CCF.

If you have just received your data from the SOC, it has been processed with the most recent version of SAS, and you should not need to reprocess it (though no harm is done if you do). However, it is very likely that you will want to filter your data; in this case, you will need to reprocess it in order to determine the appropriate filters. Therefore, we recommend that you rerun the pipeline regardless of the age of your dataset.

But if you decide that reprocessing is unnecessary, you need only to gunzip the files and rename event files for easier handling. For example, for the RGS1 event list,

gunzip ODF/*.gz
gunzip PPS/*.gz
mv PPS/PiiiiiijjkkR1lEVENLInmmm.FTZ PPS/PiiiiiijjkkR1lEVENLInmmm.FIT.gz
gunzip PPS/PiiiiiijjkkR1lEVENLInmmm.FIT.gz PPS/r1_evt.fits

where

iiiiiijjkk - observation number
l - scheduled (S) or unscheduled (U) obseravtion n - spectral order number
mmm - source number

6.0.1 A Quick Look at What You Have

As noted in Tables 3.2 and 3.3 you can view images of your data. While the zipped FITS files may need to be unzipped before display in ds9 (depending on the version of ds9), they can be displayed when zipped using fv (fv is FITS file viewer available in the HEASoft package). As usual, there are some HTML products to help you inspect the data. These have file names of the form:

where

iiiiiijjkk - Observation number
jj - observation ID - target number in proposal
kk - observation ID - observation number for target
AAAAAA - Group ID (see Table 3.2)

You will find a variety of RGS-specific files in XMM-Newton data sets. Generally there are two of each because there are two RGS instruments. Table 3.3 lists typical file names, their purpose, the file format, and a list of tools that will enable the user to inspect their data. Remember that the INDEX.HTM file will help you navigate.


6.1 Rerunning the pipeline

You will need to reprocess the data before being able to determine the appropriate filters, but before doing that, you must prepare the data and initialize SAS. Throughout this primer, we will use the AB Dor dataset with ObsID 0134520301 available through links at the HEASARC archive.

1)
If you have not already done so, gunzip all gzipped files in the ODF and PPS directories. If necessary, rename all files in the ODF directory to upper case. This can be done using the script provided by the NASA/GSFC XMM-Newton GOF.
gunzip ODF/*.gz
gunzip PPS/*.gz
2)
Initialize SAS by calling one of the two setup scripts, depending on which shell you use.
source /full/path/to/xmmsas_20080701_1801/setsas.csh
or
. /full/path/to/xmmsas_20080701_1801/setsas.sh
It is strongly recommended that you add a line to your login shell file to set up an alias to these scripts! Calling the script will deal with most of the details needed to run SAS, except for three environment variables, which we will set next.
3)
Set the SAS directory pointers. To verify the SAS-specific settings, use the command env | grep SAS. (For a detailed discussion of SAS initialization, see Chapter 4.)
setenv SAS_ODF full/path/to/ODF
setenv SAS_CCFPATH full/path/to/CCF
At this point, the SAS GUI can be run by typing sas & in the window where the pointers were set. However, since the next few procedures are very simple, it is faster to just use the command line.
4)
If it doesn't already exist, create a CIF file in the ODF directory using the SAS task cifbuild (see §4.5.1). If a CIF file has previously been produced, it is only necessary to rerun cifbuild if the CCF has changed. Be sure to set the environment parameter afterwards.
cd ODF
cifbuild
setenv SAS_CCF /full/path/to/ODF/ccf.cif
5)
If it hasn't already been done (don't do it twice), while still in the ODF directory, prepare the data by using the SAS task odfingest (see §4.5.2) and setting the environment parameter. It is only necessary to run it once on any data set 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 produced by odfingest (*SUM.SAS).
odfingest
setenv SAS_ODF /full/path/to/file/full_name_of_*SUM.SAS
6)
In your ``processing directory'' PROC, run the SAS task rgsproc. From the command line of a window where SAS has been initialized, enter:
rgsproc orders='1 2' bkgcorrect=no withmlambdacolumn=yes

where

orders - dispersion orders to extract
bkgcorrect - subtract background from source spectra?
withmlambdacolumn - include a wavelength column in the event file product

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*FITS r1_evt1.fits
ln -s *R2*EVENLI*FITS r2_evt1.fits

Once the new event files have been obtained, the analysis techniques described in §6.3 and later can be used.


6.2 Potentially useful tips for using the pipeline

The pipeline task, rgsproc, is very flexible and can address potential pitfalls for RGS users. In §6.1, we used a simple set of parameters with the task, and if this is sufficient for your data, feel free to skip to §6.3. In the following sections, we will look at the cases of a nearby bright optical source, a nearby bright X-ray source, and a user-defined source.


6.2.1 A Nearby Bright Optical Source

With certain pointing angles, zeroth-order optical light may be reflected off the telescope optics and cast 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 use, type

rgsproc orders='1 2' bkgcorrect=no calcoffsets=yes withoffsethistogram=no

where the parameters are as described in §6.1 and

calcoffsets - calculate PHA offsets from diagnostic images
withoffsethistogram - produce a histogram of uncalibrated excess for the user


6.2.2 A Nearby Bright X-ray Source

In the example above, it is assumed that the field around the source contains sky only. Provided a bright background source 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' bkgcorrect=no withepicset=yes
$~~~$ epicset=PiiiiiijjkkaablllEMSRLInmmm.FTZ exclsrcsexpr='INDEX==1&&INDEX==3'

where the parameters are as described in §6.1 and

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


6.2.3 User-defined Source Coordinates

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 by typing:

rgsproc orders='1 2' bkgcorrect=no withsrc=yes srclabel=ABDor srcstyle=radec
$~~~$ srcra=82.185493 srcdec=-65.449329

where the parameters are as described in §6.1 and

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

6.3 Examine and Filter the Data

Since the event files are current, we can proceed with some simple analysis demonstrations, which will allow us to generate filters. The following sections describe the use of SAS tasks using the both the command line and GUI interfaces, except in cases where one of the methods is particularly easy. People new to SAS will likely prefer the GUI, at least at first; however, as they become more familiar with the software and the keywords, they will probably migrate to the command line, which is faster. Assuming that the parameter values for any given task are the same, it does not matter if a task is invoked on the command line or in the GUI; the output files will be identical. The SAS xmmselect GUI provides a very simple method for producing and displaying images, spectra, and light curves, and is the recommended method for extracting data unless large numbers of sources are being analyzed.

6.3.1 An Introduction to the SAS GUI and xmmselect

We are now ready to invoke the SAS GUI if we have not already done so. Make sure that you are in the directory where you want the output to go before invoking the SAS GUI or any of the SAS tasks on the command line!

sas &

1)
Invoke the xmmselect GUI from the SAS GUI. To invoke a task, you need only start typing the task name, and when it is highlighted, hit a carriage return.
$\bullet$
When xmmselect is invoked a dialog box will first appear requesting a file name. One can either use the browser button or just type the file name in the entry area, ``r1_evt1.fits'' in this case. To use the browser, first click on the file folder icon button on the right which will bring up a second GUI for the file selection. Double click on the desired event file in the right-hand column (you may have to open the appropriate directory first), click on the ``EVENTS'' extension in the right-hand column (which selects the extension), and then click ``Ok''. The directory GUI will then disappear and then click ``Run'' on the selection GUI.
$\bullet$
When the file name has been submitted the xmmselect GUI (Figure 5.2) GUI will appear, along with a dialog box offering to display the selection expression. The selection expression will include the filtering done to this point on the event file, which for the pipeline processing includes for the most part CCD and GTI selections.


6.3.2 Create and Display an Image

Two commonly-made plots are those showing PI vs. BETA_CORR (also known as ``banana plots'') and XDSP_CORR vs. BETA_CORR.

To create images by using the xmmselect GUI:

1)
Check the square boxes to the left of the ``BETA_CORR'' and ``PI'' entries.
2)
Click on the ``Image'' button near the bottom of the page. This brings up the evselect GUI (Figure 6.3).
3)
Click on the ``Image'' tab in the evselect GUI.
4)
Confirm that the withimageset box is checked.
5)
In the imageset box, change the output image name from image.ds to something descriptive, in this case, pi_bc.fits.
6)
Click on the ``Run'' button on the lower left corner of the evselect GUI.
$\bullet$
Different binnings and other selections can be invoked by accessing the ``Image'' tab at the top of the GUI. The default settings are reasonable, however, for a basic image.
$\bullet$
The resultant image is automatically displayed using ds9. Similarly, plots can be made comparing BETA_CORR to XDSP_CORR. These two example plots can be seen in Figure 6.4.

To create images by using the task evselect on the command line:

1)
In the window in which SAS was initialized, and in the directory where you want the output to go, type the following command (all on one line). Make sure the correct path is given for the event file.
evselect table=r1_evt1.fits:EVENTS withimageset=yes
$~~~$ imageset=pi_bc.fits xcolumn=BETA_CORR ycolumn=PI
$~~~$ imagebinning=imageSize ximagesize=600 yimagesize=600

where

table - input event table
withimageset - make an image
imageset - name of output image
xcolumn - event column for X axis
ycolumn - event column for Y axis
imagebinning - form of binning, force entire image into a given size or bin by a specified number of pixels
ximagesize - output image pixels in X
yimagesize - output image pixels in Y

$\bullet$
Plots comparing BETA_CORR to XDSP_CORR may be made in a similar way. The output files can be viewed by using a standard FITS display, such as ds9 (see Figure 6.4) :
ds9 pi_bc.fits &


6.3.3 Create and Display a Light Curve

The background is assessed through examination of the light curve. We will extract a region, CCD9, that is most susceptible to proton events and generally records the least source events due to its location close to the optical axis. Also, to avoid confusing solar flares for source variability, a region filter that that removes the source from the final event list should be used. The region filters are kept in the source file product P*SRCLI_*.FIT. (For our example data, this would be P0134520301R1S001SRCLI_0000.FIT).



To create light curves of the observation by using the xmmselect GUI:

1)
Enter the filtering criteria in the ``Selection expression'' box at the top of the xmmselect GUI:
(CCDNR==9)&&(REGION(P0134520301R1S001SRCLI_0000.FIT:RGS1_BACKGROUND,BETA_CORR,XDSP_CORR))
2)
Check the round box to the left of the time entry.
3)
Click on the ``OGIP Rate Curve'' button near the bottom of the page. This brings up the evselect GUI (Figure 5.3).
4)
Click on the ``Lightcurve'' tab and confirm that the withrateset box is checked.
5)
Change the timebinsize to a reasonable amount, e.g. 10 or 100 s, and change the default output file name in the rateset box to something appropriate, in this case, r1_ltcrv.fits.
6)
Click on the ``Run'' button at the lower left corner of the evselect GUI.
$\bullet$
The resultant light curve is displayed automatically using Grace (see Figure 6.1).

To create a light curve of the observation by using the task evselect on the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type the following command (all on one line). Make sure the correct path is given for the event file.
evselect table=r1_evt1.fits:EVENTS withrateset=yes rateset=r1_ltcrv.fits
$~~~$ maketimecolumn=yes timebinsize=100 makeratecolumn=yes
$~~~$ expression=
$~~~$ '(CCDNR==9)&&(REGION(P0134520301R1S001SRCLI_0000.FIT:RGS1_BACKGROUND,BETA_CORR,XDSP_CORR))'
where
table - input event table
withrateset - make a light curve
rateset - name of output light curve file
maketimecolumn - control to create a time column
timebinsize - time binning (seconds)
makeratecolumn - control to create a count rate column, otherwise a count column will be created
expression - filtering criteria
$\bullet$
The output file r1_ltcrv.fits can be viewed using dsplot:
dsplot table=r1_ltcrv.fits x=TIME y=RATE &

where

table - input event table
x - column for plotting on the X axis
y - column for plotting on the Y axis

The light curve is shown in Figure 6.1.

Figure 6.1: Background event rate from the RGS1 CCD9 chip. The flares are solar events. The time units are elapsed mission time.
\begin{figure}
\centerline{\psfig{file=rgs_rate.ps,angle=270,width=5in}}
\end{figure}


6.3.4 Generating the Good Time Interval (GTI) File

Examination of the lightcurve shows that there are two noisy sections, one between 9.6405e7 and 9.6413e7 seconds, and another between 9.6422e7 and 9.6425e7 seconds. Both show rates well in excess of the normal background count rate of $\sim $ 0.05 count/second. There are two procedures that make the GTI file (gtibuild and tabgtigen) that, when applied to the event file in another run of rgsproc, will excise these sections.

The first method, using gtibuild, requires a text file as input. In the first two columns, refer to 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. In the example case, then, we would write in our ASCII file (named gti.txt):

9.6405e7 9.6413e7 -
9.6422e7 9.6425e7 -


and proceed to the SAS task gtibuild.

To make the GTI with gtibuild in the SAS GUI:

1)
Double-click on the gtibuild task in the SAS GUI.
2)
Enter the name of the text file in the file box.
3)
Enter the name of the output fits file in the table box.
4)
Click ``Run''.

To make the GTI with gtibuild on the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type the following command.
gtibuild file=gti.txt table=gti.fits

where

file - intput text file
table - output gti table

To make the GTI with tabgtigen in the SAS GUI:

1)
Double-click on the tabgtigen task.
2)
Enter the name of the lightcurve file in the table box, in this case, r1_ltcrv.fits.
3)
Enter the name of the output file in the gtiset box, in this case, gti.fits.
4)
Enter the filtering expression in the expression box. Since the nominal count rate is about 0.05 count/sec, we will set the upper limit to 0.2 count/sec: RATE$<$0.2
5)
Click ``Run''.

To make the GTI with tabgtigen from the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type the following command.
tabgtigen table=r1_ltcrv.fits gtiset=gti.fits expression='(RATE$<$0.2)'

where

table - the lightcurve file
gtiset - output gti table
expression - the filtering criteria. Since the nominal count rate is 0.05 about count/sec, we have set the upper limit to 0.2 count/sec.


6.3.5 Applying the GTI

Now that we have GTI file, we can apply it 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.

To rerun the pipeline in the SAS GUI:

1)
Double-click on rgsproc in the SAS GUI.
2)
In the ``global'' tab, make sure that the orders box is set for both orders, 1 2 .
3)
In the ``global'' tab, use the pulldown menus for entrystage and exitstage to select 3:filter and 5:fluxing, respectively.
4)
In the ``filter'' tab, enter the name of the GTI file, in this case, gti.fits, in the auxgtitables box.
5)
In the ``spectra'' tab, click on the ``rgsspectrum'' tab, and make sure that bkgcorrect is set to no.
6)
In the ``angles'' tab, make sure the withmlambda column is set to yes.
7)
Click on ``Run''.

To rerun the pipeline from the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type the following command, all on one line:
rgsproc orders='1 2' auxgtitables=gti.fits bkgcorrect=no
$~~~$ withmlambdacolumn=yes entrystage=3:filter finalstage=5:fluxing

where

orders - spectral orders to be processed
auxgtitables - gti file in FITS format
bkgcorrect - subtract background from source spectra?
withmlambdacolumn - include a wavelength column in the event file product
entrystage - stage at which to begin processing
finalstage - stage at which to end processing


6.3.6 Creating the Response Matrices (RMFs)

Response matrices (RMFs) are not provided as part of the pipeline product package, so you must create your own before analyzing data. This can be done with the package rgsrmfgen.

To make the RMFs using the GUI:

1)
Double-click on the rgsrmfgen task in the GUI.
2)
In the spectrumset box, enter the name of the spectrum file; it has the form *SRSPEC*, and in our case, is P0134520301R1S001SRSPEC1001.FIT.
3)
In the evlist box, enter the name of the event list, r1_evt1.fits.
4)
Set emin to 0.4, emax to 2.5, and rows to 5000.
5)
Set rmfset to the output file name, in this case, r1_o1_rmf.fits.
6)
Click ``Run''.

To make the RMFs from the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type the following command (all on one line).
rgsrmfgen spectrumset=P0134520301R1S001SRSPEC1001.FIT rmfset=r1_o1_rmf.fits
$~~~$ evlist=r1_evt1.fits emin=0.4 emax=2.5 rows=5000

where

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


6.4 Fitting a Spectral Model

Now that we have a response file, we can fit the spectrum using Xspec.

1)
On the command line, type:
xspec

Enter the data, background, and response file at the prompts, and edit the fitting parameters as needed.

      XSPEC> data P0136540101R1S001SRSPEC1003.FIT ! input data 
      XSPEC> back P0136540101R1S001BGSPEC1003.FIT ! input background
      XSPEC> resp r1_o1_rmf.fits                  ! input response file
      XSPEC> model wabs*mekal                     ! set spectral model to absorbed mekal
      wabs:nH> 1             
      mekal:kT> 1    
      mekal:nH>            
      mekal:Anbundanc> .4    
      mekal:Redshift>      
      mekal:Switch> 0    
      mekal:norm> 1    
      XSPEC> renorm
      XSPEC> fit
      XSPEC> cpd /xw
      XSPEC> setplot wave
      XSPEC> setplot command window all
      XSPEC> setplot command log x off
      XSPEC> setplot command wind 1
      XSPEC> setplot command r y 1e-5 1.6
      XSPEC> setplot command wind 2
      XSPEC> setplot command r y -9.99 9.99
      XSPEC> plot data residuals
      XSPEC> exit

Figure 6.2 shows the fit to the spectrum.

Figure 6.2: 1st order RGS1 spectrum of AB Dor. The fit is an absorbed single-temperature mekal model. The gap between 10-15Å is due to the absence of CCD7.
\begin{figure}
\centerline{\psfig{file=rgs_xspec.ps,angle=270,width=5in}}
\end{figure}


6.4.1 Combining RGS1 and RGS2 Spectra

While it is tempting to merge the RGS1 and RGS2 data, or data from different pointings, to provide a single spectrum with a signal-to-noise improvement over either individual spectrum, this is strongly discouraged since it results in data degradation.

The pointings of the two instruments are not identical, resulting in different dispersion angles and wavelength scales. Separate response files are always required for each unit. While it is possible to merge spectra and response files, great care must be taken to account for different exposure times, background subtractions, error propagation, and so on. However, the resulting response will always have inferior resolution to the originals. It is therefore simpler and more accurate to keep data from the two RGS units separate and use both sets to fit one model in tandem.

1)
On the command line, type:
xspec

 
       XSPEC>data 1:1 P0136540101R1S001SRSPEC1003.FIT 1:2 P0136540101R1S001SRSPEC2003.FIT
       XSPEC>ignore bad 
       XSPEC>model phabs*mekal


6.5 Approaches to Spectral Fitting

For data sets of high signal-to-noise and low background, where counting statistics are within the Gaussian regime, the data products above are suitable for analysis using the default fitting scheme in XSPEC, $\chi^2$-minimization. However, for low count rates, in the Poisson regime, $\chi^2$-minimization is no longer suitable. With low count rates in individual channels, the error per channel can dominate over the count rate. Since channels are weighted by the inverse-square of the errors during $\chi^2$ model fitting, channels with the lowest count rates are given overly-large weights in the Poisson regime. Spectral continua are consequently often fit incorrectly, with the model lying underneath the true continuum level.

This will be a common problem with most RGS sources. Even if count rates are large, much of the flux from these sources can be contained within emission lines, rather than the continuum. Consequently, even obtaining correct equivalent widths for such sources is non-trivial. There are two approaches to fitting low signal-to-noise RGS data, spectral rebinning and maximum-likelihood statistics. The correct approach would normally be to use an optimization of the two.


6.5.1 Spectral Rebinning

By grouping channels in appropriately large numbers, the combined signal-to-noise of groups will jump into the Gaussian regime. There are two ways to do this: the FTOOL grppha, or the RGS pipeline. grppha can group channels using an algorithm which bins up consecutive channels until a count rate threshold is reached. This method conserves the resolution in emission lines above the threshold while improving statistics in the continuum.

1)
On the command line, type the following and edit parameters as needed.
grppha

         > Please enter PHA filename[] P0136540101R1S001SRSPEC1003.FIT 
         > Please enter output filename[] P0136540101R1S001SRSPEC1003.bin.FIT
         > GRPPHA[] group min 30 
         > GRPPHA[] exit

The disadvantage of using grppha is that, although channel errors are propagated through the binning process correctly, the errors column in the original spectrum product is not strictly accurate. The problem arises because there is no good way to treat the errors within channels containing no counts. To allow statistical fitting, these channels are arbitrarily given an error value of unity, which is subsequently propagated through the binning. Consequently, the errors are overestimated in the resulting spectra.

The other approach, which involves calling the RGS pipeline after it is complete, bins the data during spectral extraction. The following rebins the pipeline spectrum by a factor 3.

1)
On the command line, type
rgsproc orders='1 2' rebin=3 rmfbins=4000 entrystage=4:spectra
$~~~$ finalstage=5:fluxing bkgcorrect=no

where

orders - dispersion orders to extract
rebin - wavelength rebinning factor
rmfbins - number of bins in the response file; this should be greater than 3000
entrystage - entry stage to the pipeline
finalstage - exit stage for the pipeline

One disadvantage of this approach is that you can only choose integer binning of the original channel size. To change the sampling of the events, the pipeline must be run from the second stage (``angles'') or earlier.

1)
On the command line, type
rgsproc orders='1 2' nbetabins=1133 rmfbins=4000 entrystage=2:angles
$~~~$ finalstage=fluxing bkgcorrect=no

where the parameters are as defined previously, and

nbetabins - number of bins in the dispersion direction; the default is 3400

The disadvantage of using rgsproc, as opposed to grppha, is that the binning is linear across the dispersion direction. Velocity resolution is lost in the lines, so the accuracy of redshift determinations will be degraded, transition edges will be smoothed, and neighboring lines will become blended.


6.5.2 Maximum-Likelihood Statistics

The second method is to replace the $\chi^2$-minimization scheme with the Cash maximum-likelihood scheme (cstat in Xspec) when fitting data. This method is much better suited to data with low count rates and is a suitable option only if one is running Xspec v11.1.0 or later. The reason for this is that RGS spectrum files have prompted a slight modification to the OGIP standard. Because the RGS spatial extraction mask has a spatial-width which is a varying function of wavelength, it has become necessary to characterize the BACKSCL and AREASCL parameters as vectors (i.e., one number for each wavelength channel), rather than scalar keywords as they are for data from the EPIC cameras and past missions. These quantities map the size of the source extraction region to the size of the background extraction region and are essential for accurate fits. Only Xspec v11.1.0, or later versions, are capable of reading these vectors, so be certain that you have an up-to-date installation at your site.

One caveat of using the cstat option is that the scheme requires a ``total'' and ``background'' spectrum to be loaded into Xspec. This is in order to calculate parameter errors correctly. Consequently, be sure not to use the ``net'' spectra that were created as part of product packages by SAS v5.2 or earlier. To change schemes in Xspec before fitting the data, type:

XSPEC$>$ statistic cstat


6.6 Analysis of Extended Sources


6.6.1 Region masks

The optics of the RGS allow spectroscopy of reasonably extended sources, up to a few arc minutes. The width of the spatial extraction mask is defined by the fraction of total events one wishes to extract. With the default pipeline parameter values, 90% of events are extracted, assuming a point-like source.

Altering and optimizing the mask width for a spatially-extended source may take some trial and error, and, depending on the temperature distribution of the source, may depend on which lines one is currently interested in. While AB Dor is not an extended source, the following example increases the width of the extraction mask and ensures that the size of the background mask is reduced so that the two do not overlap.

To adjust the region mask with rgsproc in the SAS GUI:

1)
Double-click on rgsproc in the SAS GUI.
2)
In the ``global'' tab, make sure that the orders box is set for both orders, 1 2.
3)
In the ``global'' tab, use the pulldown menus for entrystage and exitstage to select 4:spectra and 5:fluxing, respectively.
4)
In the ``spectra'' tab, in the ``rgsregions'' sub-tab, set both xpsfincl and xpsfexcl to 99, and pdistincl to 95.
5)
Click ``Run''.

To adjust the region mask with rgsproc from the command line:

1)
Type the following on the command line, in the directory where you want the output to go:
rgsproc orders='1 2' entrystage=4:spectra finalstage=5:fluxing bkgcorrect=no
$~~~$ xpsfincl=99 xpsfexcl=99 pdistincl=95

where parameters are as they were decsribed previously, and

xpsfincl - include this fraction of point-source events inside the spatial source extraction mask
xpsfexcl - exclude this fraction of point-source events from the spatial background extraction mask
pdistincl - include this fraction of point-source events inside the pulse height extraction mask

Observing extended sources effectively broadens the psf of the spectrum in the dispersion direction. Therefore, it is prudent to also increase the width of the PI masks using the pdistincl parameter in order to prevent event losses.


6.6.2 Fitting spectral models to extended sources

RGS response matrices are consistent for point sources only. Since extended source spectra are broadened, the simplest way to deal with this problem during spectral fitting is to reproduce the broadening function, and convolve it across the spectral model. Xspec v11.2 contains the convolution model rgsxsrc. It requires two external files to perform the operation:

1)
An OGIP FITS image of the source. The better the resolution of the image, the more accurate the convolution. For example, if a Chandra image of the source is available, this will provide a more accurate result than an EPIC image.

2)
An ASCII file containing three lines of input. For this example case, we will name it xsource.mod. It defines three environment variables and should look like this example:
RGS_XSOURCE_IMAGE ./MOS1.fit
RGS_XSOURCE_BORESIGHT 23:25:19.8 -12:07:25 247.302646
RGS_XSOURCE_EXTRACTION 2.5

where

RGS_XSOURCE_IMAGE - path to the source image
RGS_XSOURCE_BORESIGHT - RA, Dec of the center of the source and PA of the telescope
RGS_XSOURCE_EXTRACTION - The extent (in arcmin), centered on the source, over which you want to construct the convolution function. You want this ``aperture'' to be larger than the source itself.

To set these environment variables within Xspec execute the command:

xset rgs_xsource_file xsource.mod

Here is an example. Note that the spectral order is always negative.

xspec

       XSPEC>data P0108460201R1S004SRSPEC1003.FIT  
       XSPEC>ignore bad 
       XSPEC>xset rgs_xsource_file xsource.mod 
       XSPEC>model rgsxsrc*wabs*mekal 
       rgsxsrc:order>-1 
       wabs:nH>1 
       mekal:kT>2 
       mekal:nH>1 
       mekal:Abundanc>1 
       mekal:Redshift> 
       mekal:Switch>0 
       mekal:norm>1 
       XSPEC>renorm 
       XSPEC>fit 
       XSPEC>setplot device /xs 
       XSPEC>setplot wave 
       XSPEC>setplot command window all 
       XSPEC>setplot command log x off 
       XSPEC>plot data residuals 
       XSPEC>exit 
       Do you really want to exit? (y)y

Figure 6.3 compares a point source model with an extended source counterpart.

Figure 6.3: The top figure is a thin, thermal plasma at 2 keV from a point source. The lower figure is the same spectral model, but convolved by the MOS1 0.3-2.0 keV spatial profile of a low-redshift cluster.
\begin{figure}
\vspace{5mm}
\centerline{\psfig{file=pntsrc.ps,angle=270,width=3...
...vspace{5mm}
\centerline{\psfig{file=extsrc.ps,angle=270,width=3in}}
\end{figure}


6.6.3 Model limitations

Users should be aware that this method assumes an isothermal source (or uniform emissivity from line to line in the case of a non-thermal spectrum) where the spatial distributions of all the lines are identical. In reality, however, the thermal structure of the source is likely to be more complicated. The broad-band convolution function may bear little resemblance to the correct function for particular line transitions.

One way around this problem would be to have a temperature map of the source to define line emissivity across the source and convolve the model spectrum accordingly. The RGS instrument team at the Columbia Astrophysics Laboratory are developing a Monte Carlo code to perform an operation with this effect. While it is unlikely the code will be publicly available in the near future, the team welcomes investigators who would be interested in collaboration. Interested parties are encouraged to contact John Peterson (jrpeters@astro.columbia.edu).


6.7 In A Nutshell

To summarize, the steps you must take to prepare your data for analysis are:

1)
Obtain the raw and pipelined data from the XMM archive.
2)
Initialize SAS.
3)
Make the CCF file and ODF summary file.
4)
Rerun the pipeline.
5)
Generate a light curve to determine the appropriate filter for your data.
6)
Make the good time interval (GTI) file.
7)
Apply the GTI file by rerunning the pipeline again.
8)
Generate the response file (RMF).


next up previous contents
Next: 7. An OM Data Up: XMM ABC Guide Previous: 5. An EPIC Data   Contents
Lynne Valencic 2008-09-02