next up previous contents
Next: 7. An RGS Data Up: XMM ABC Guide Previous: 5. Preparing the Data   Contents

Subsections


6. An EPIC Data Processing and Analysis Primer

So, you've received an XMM-Newton EPIC data set. What are you going to do with it? After checking what the observation consists of (see § 3.2), you should note when the observation was taken. If it is a recent observation, it was likely processed with the most recent calibrations and SAS, and you can immediately start to analyze the Pipeline Processed data. However, if it is more than a year old, it was probably processed with older versions of CCF and SAS prior to archiving, and the pipeline should be rerun to generate event files with the latest calibrations.

As noted in Chapter 4, a variety of analysis packages can be used for the following steps. However, as the SAS was designed for the basic reduction and analysis of XMM-Newton data (extraction of spatial, spectral, and temporal data), it will be used here for demonstration purposes (although see § 6.9 for a short tutorial on the use of Xselect for data extraction). SAS will be required at any rate for the production of detector response files (RMFs and ARFs) and other observatory-specific requirements. (Although for the simple case of on-axis point sources the canned response files provided by the SOC can be used.)

NOTE: For PN observations with very bright sources, out-of-time events can provide a serious contamination of the image. Out-of-time events occur because the read-out period for the CCDs can be up to $\sim6.3$% of the frame time. Since events that occur during the read-out period can't be distinguished from others events, they are included in the event files but have invalid locations. For observations with bright sources, this can cause bright stripes in the image along the CCD read-out direction. For a more detailed description of this issue, check: http://www.mpe.mpg.de/xray/wave/xmm/cookbook/preparation/index.php

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 assumed to be in the PPS directory, the ODF data (with upper case file names, and uncompressed) are in the directory ODF, the analysis is taking place in the PROC directory, and the CCF data are in the directory CCF.

If your data are recent and do not require repipelining, you need only to gunzip the files and prepare the data for processing (see §5; for simplicity, it is also recommended that you change the name of the unzipped event file to something easy to type. For example, an MOS1 event list:

cp PPS/PiiiiiijjkkM1SlllMIEVLI0000.FTZ PROC/mos1.fits

where

iiiiiijjkk - observation number
lll - exposure number within the observation

At this point, feel free to skip §6.2 and proceed to §6.3, where various analysis procedures are demonstrated using the Lockman Hole SV1 dataset (Obs ID 0123700101). Also, the following procedures are applicable to all XMM-Newton datasets, so it is not required that you use this particular dataset; any observation should be sufficient.

For detailed descriptions of PP data nomenclature, file contents, and which tasks can be used to view them, see Tables 3.2 and 3.3. For detailed descriptions of ODF data nomenclature and file contents, see Table 3.1.


6.1 A Quick Look at What You Have

The ESKYIM files contain EPIC sky images in different energy bands whose ranges are listed in Table 3.3. 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). In addition, the image of the total band pass for all three EPIC detectors is also provided in PNG format which can be displayed with a web browser.

The PP source list is provided in both zipped FITS format (readable by fv) and as an HTML file.


6.2 Rerunning the Pipeline

The Lockman Hole observation definitely needs to be repipelined. We assume that the data was prepared and environment variables were set according to §5. In the window where SAS was initialized, in your ``processing directory'' PROC, run the tasks emchain or emproc (to produce calibrated photon event files for the MOS cameras), and epchain or epproc (to do the same for the PN camera):

emchain or emproc

and

epchain or epproc

If the dataset has more than one exposure, a specific exposure can be accessed using the exposure parameter, e.g.:

emchain exposure=n

where n is the exposure number. To create an out-of-time event file for your PN data, add the parameter withoutoftime to your epchain invocation:

epchain withoutoftime=yes

By default, none of these tasks keep any intermediate files they generate. Emchain and epchain maintain the naming convention described in §3.3.3. Emproc and epproc designate their output event files with ``Evts.ds''; ``*ImagingEvts.ds'', ``*TimingEvts.ds'', and ``*BurstEvts.ds'' denote the imaging mode, timing, and burst mode event lists, respectively. In either case, you may want to name the new files something easy to type. For example, to rename one of the new MOS1 event files output from emchain or emproc, respectively, type

mv P0123700101M1S001MIEVLI0000.FIT mos1.fits

or

mv 0070_0123700101_EMOS1_S001_ImagingEvts.ds mos1.fits

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


6.3 Examine and Filter the Data

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 (see Figure 6.1). 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 one 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. You can either use the browser button or just type the file name in the entry area, ``mos1.fits:EVENTS'' 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 (see Figure 6.2) 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.

Figure 6.1: The SAS GUI. To locate and invoke a task one need only start typing the task name, and when it is highlighted, press carriage return. Otherwise, double-click on the task name.
\begin{figure}
\centerline{\psfig{file=sas.ps,width=5in}}
\end{figure}

Figure 6.2: The xmmselect GUI.
\begin{figure}
\centerline{\psfig{file=xmmselect.ps,width=5in}}
\end{figure}


6.3.2 Create and Display an Image

To create an image in sky coordinates by using the xmmselect GUI:

1)
Check the square boxes to the left of the ``X'' and ``Y'' entries.
2)
Click on the ``Image'' button near the bottom of the page. This brings up the evselect GUI (see Figure 6.3).
3)
In the imageset box, enter the name of the output file, in this case, image.fits.
4)
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 written to the file image.fits, and the image is automatically displayed using ds9, and is shown in Figure 6.4.

To create an image in sky coordinates by using the task evselect on 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).
evselect table=mos1.fits:EVENTS withimageset=yes imageset=image.fits
$   $ xcolumn=X ycolumn=Y 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$
The output file image.fits can be viewed by using a standard FITS display, such as ds9 (see Figure 6.4) :
ds9 image.fits &

Figure 6.3: The evselect GUI.
\begin{figure}
\centerline{\psfig{file=evselect.ps,width=4in}}
\end{figure}

Figure 6.4: The MOS1 image, displayed in ds9.
\begin{figure}
\centerline{\psfig{file=mos1-lh-im.ps,width=5in}}
\end{figure}


6.3.3 Create and Display a Light Curve

To create a light curve of the observation by using the xmmselect GUI:

1)
Check the round box to the left of the ``Time'' entry.
2)
Click on the ``OGIP Rate Curve'' button near the bottom of the page. This brings up the evselect GUI (see Figure 6.3).
3)
Click on the ``Lightcurve'' tab and change the ``timebinsize'' to a reasonable amount, e.g. 10 or 100 s. In the ``rateset'' textbox, enter the name of the output file, for example, mos1_ltcrv.fits.
4)
Click on the ``Run'' button at the lower left corner of the evselect GUI.
The resultant light curve is displayed automatically using Grace (see Figure 6.5).

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).
evselect table=mos1.fits:EVENTS withrateset=yes rateset=mos1_ltcrv.fits
$   $ maketimecolumn=yes timecolumn=TIME timebinsize=100 makeratecolumn=yes

where

table - input event table
withrateset - make a light curve
rateset - name of output light curve file
maketimecolumn - control to create a time column
timecolumn - time column label
timebinsize - time binning (seconds)
makeratecolumn - control to create a count rate column, otherwise a count column will be created

The output file mos1_ltcrv.fits can be viewed by using fv or dsplot:

dsplot table=mos1_ltcrv.fits x=TIME y=RATE.ERROR withoffsetx=yes &

where

table - input event table
x - column for plotting on X axis
y - column for plotting on Y axis
withoffsetx - creates an offset to the X axis; -73194570.96472888s in Figure 6.5

Figure 6.5: The light curve, displayed in Grace.
\begin{figure}
\centerline{\psfig{file=mos1-lh-lc.ps,width=5in}}
\end{figure}


6.3.4 Applying Standard Filters the Data

Whether using the GUI or the command line, the needed filtering ``expressions'' for the MOS and PN are:

(PATTERN $<=$ 12)&&(PI in [200:12000])&&#XMMEA_EM

and

(PATTERN $<=$ 12)&&(PI in [200:15000])&&#XMMEA_EP

If the PN data is timed, then the PATTERN parameter should be set to 4:

(PATTERN $<=$ 4)&&(PI in [200:15000])&&#XMMEA_EP.

The first two expressions will select good events with PATTERN in the 0 to 12 range, and the last will select events with PATTERN between 0 and 4. The PATTERN value is similar the GRADE selection for ASCA data, and is related to the number and pattern of the CCD pixels triggered for a given event.The PATTERN assignments are: single pixel events: PATTERN == 0, double pixel events: PATTERN in [1:4], triple and quadruple events: PATTERN in [5:12].

The second keyword in the expressions, PI, selects the preferred pulse height of the event; for the MOS, this should be between 200 and 12000 eV. For the PN, this should be between 200 and 15000 eV. This should clean up the image significantly with most of the rest of the obvious contamination due to low pulse height events. Setting the lower PI channel limit somewhat higher (e.g., to 300 eV) will eliminate much of the rest.

Finally, the #XMMEA_EM (#XMMEA_EP for the PN) filter provides a canned screening set of FLAG values for the event. (The FLAG value provides a bit encoding of various event conditions, e.g., near hot pixels or outside of the field of view.) Setting FLAG == 0 in the selection expression provides the most conservative screening criteria and should always be used when serious spectral analysis is to be done.

It is a good idea to keep the output filtered event files and use them in your analyses, as opposed to re-filtering the original file with every task. This will save much time and computer memory. As an example, the Lockman Hole data's original event file is 48.4 Mb; the fully filtered list (that is, filtered spatially, temporally, and spectrally) is only 4.0Mb!

To filter the data using the xmmselect GUI:

1)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect GUI:
(PATTERN $<=$ 12)&&(PI in [200:12000])&&#XMMEA_EM
2)
Click on the "Filtered Table" box at the lower left of the xmmselect GUI.
3)
Change the evselect filteredset parameter, the output file name, to something useful, e.g., mos1_filt.fits
4)
Click ``Run''.

To filter the data using 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).
evselect table=mos1.fits:EVENTS withfilteredset=yes
$   $ expression='(PATTERN $<=$ 12)&&(PI in [200:12000])&&#XMMEA_EM'
$   $ filteredset=mos1_filt.fits filtertype=expression keepfilteroutput=yes
$   $ updateexposure=yes filterexposure=yes

where

table - input event table
filtertype - method of filtering
expression - filtering expression
withfilteredset - create a filtered set
filteredset - output file name
keepfilteroutput - save the filtered output
updateexposure - for use with temporal filtering
filterexposure - for use with temporal filtering


6.3.5 Applying Temporal Filters the Data

Sometimes, it is necessary to use a temporal filter in addition to those mentioned above. This is because of soft proton background flaring, which can have count rates of 100 counts/sec or higher.

It should be noted that the amount of flaring that needs to be removed depends in part on the object observed; a faint, extended object will be more affected than a very bright X-ray source.

There are two ways to filter temporally: with an explicit reference to the TIME or RATE parameters in the filtering expression, or by creating a secondary Good Time Interval (GTI) file with the tast tabgtigen. Both procedures are described below. For the example data, we will filter by time, though you can just as easily filter by rate.

To explicitly define the TIME or RATE parameters:

1)
Make a light curve and display it in Grace (see §6.3.3).
2)
In the Grace window, pull down the ``Edit'' menu, select ``Regions'', and select ``Define''; for the Lockman case, select ``Left of Line'' for the ``Region type''.
3)
Click the ``Define'' button and then click at two points to create a vertical line at the upper end of the desired range on the Grace plot. (It is possible to define up to five regions at one time by changing the ``Define region'' counter.)
4)
Back on the xmmselect GUI, click on the ``1D region'' button. This will transfer the selection criteria to the ``Selection expression'' location.

The syntax for the time selection is (TIME $<=$ 73227600). A more complicated expression which would remove a small flare within an otherwise good interval (e.g., the soft proton flares observed in the light curve plot of Figure 6.5) could be: (TIME $<=$ 73227600)&&!(TIME IN [73221920:73223800]). The syntax &&(TIME $<$ 73227600) includes only events with times less than 73227600, and the ``!'' symbol stands for the logical ``not''. So, use &&!(TIME in [73221920:73223800]) to exclude events in the time interval 73221920 to 73223800.

If combined with the standard filtering expression (see §6.3.3), the full filtering expression would then be:

(PATTERN $<=$ 12)&&(PI in [200:12000])&&#XMMEA_EM
$   $ &&(TIME $<=$ 73227600) &&!(TIME in [73221920:73223800])

This expression can then be used in either the evselect GUI or command line to filter the event file, as shown above. If using the GUI, be certain that the updateexposure and filterexposure boxes are checked. Similarly, if using the command line, make sure to set those parameters to ``yes'', as in the example above. As ever, give the new file a useful name; here, we will use mos1_filt_time.fits.

To make a secondary GTI file using tabgtigen and apply it in the GUI:

1)
Double-click on tabgtigen in the SAS window and select the ``quality-filtered'' event file, mos1_filt.fits, and the extension, EVENTS.
2)
Edit the output file name, the gtiset parameter; here, we will use gtiset.fits.
3)
Enter the filtering expression. In this case, it is (TIME $<=$ 73227600) &&! (TIME in [73221920:73223800])
4)
Click ``Run'' in the lower left corner.
5)
Click on xmmselect and load the quality-filtered event file, mos1_filt.fits.
6)
In the ``Selection Expression'' box, type GTI(gtiset.fits,TIME),
7)
Click on the ``Filtered Table'' box at the lower left of the xmmselect GUI.
8)
Change the evselect filteredset parameter, the output file name, to something useful; here, we will use mos1_filt_time.fits.

To make a secondary GTI file using tabgtigen and apply it 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 commands (all on one line).
tabgtigen table=mos1_ltcrv.fits:RATE gtiset=gtiset.fits timecolumn=TIME
$   $ expression='(TIME $<=$ 73227600)&&!(TIME in [73221920:73223800])'

where

table - input count rate table and extension (see §6.3.3)
expression - filtering expression
gtiset - output file name for selected GTI intervals
timecolumn - time column
2)
Filter the mostly-filtered event file with evselect.
evselect table=mos1_filt.fits:EVENTS withfilteredset=yes
$   $ expression='GTI(gtiset.fits,TIME)' filteredset=mos1_filt_time.fits
$   $ filtertype=expression keepfilteroutput=yes
$   $ updateexposure=yes filterexposure=yes

where

table - input count rate table and extension (see §6.3.3)
expression - filtering expression
withfilteredset - create a filterered set
filteredset - output file name
filtertype - method of filtering
keepfilteroutput - save the filtered set
updateexposure - update exposure information in event list and in spectrum files
filterexposure - filter exposure extensions of event list with same time
$   $ filters as for corresponding CCD


6.4 Extract and Fit the Spectrum


6.4.1 Extract the Source Spectrum

Throughout the following, some parameters are instrument-dependent! The parameter spectralbinsize should be set to 15 if you are using the MOS; if you are using the PN, it should be 5. The parameter specchannelmax should be set to 11999 for the MOS, or 20479 for the PN. Also, remember that the most stringent filter, FLAG==0, must be applied to get a high-quality spectrum when the object you're extracting is on CCDs 1 (where the boresight is), 2, and 5. If the object is on CCD 4 or 7, and the observation was taken after 11 December 2012, don't use the FLAG==0 parameter, as this will result in spectra with few to no counts.

To extract the source spectrum using the GUI:

1)
Click on xmmselect and run the filtered file, mos1_filt_time.fits.
2)
In the ``Selection Expression'' box, enter FLAG==0.
3)
Make an image (see §6.3.2). It will be displayed automatically in a ds9 window.
4)
Click on the object whose spectrum you wish to extract. This will produce a circle (extraction region), centered on the object. The circle's radius can be changed by clicking on it. Adjust the size and position of the circle until you are satisfied with the extraction region.
5)
Click on ``2D Region'' in the xmmselect GUI. This transfers the region information into the ``Selection Expression'' text area, for example, ((X,Y) IN circle(26144,22838,600)). The circle parameters are the X, Y coordinates of the center, and the radius in units of 0.05 arcsec; so, the region used here has a radius of 30 arcsec.
6)
Click the round button next the PI column on the xmmselect GUI.
7)
Click on ``OGIP Spectrum''.
8)
In the ``General'' page, check keepfilteroutput and withfilteredset. In the filteredset box, enter the name of the event file output, in this case, mos1_filtered.fits.
9)
Select the ``Spectrum'' page of the evslect GUI to set the file name and binning parameters for the spectrum. Confirm that withspectrumset is checked. Set spectrumset to the desired output name, in this case, mos1_pi.fits. Confirm that spectralbinsize is set to the correct value: 15 for the MOS, 5 for the PN. Confirm that withspecranges is checked. Set specchannelmin to 0. Set specchannelmax to 11999 for the MOS, or 20479 for the PN.
10)
Click ``Run''.

To extract the source spectrum using the command line:

1)
Bring up ds9 and view the filtered event file:
ds9 mos1_filt_time.fits &
2)
Click on the object whose spectrum you wish to extract. This will produce a circle (extraction region), centered on the object. The circle's radius can be changed by clicking on it. Adjust the size and position of the circle until you are satisfied with the extraction region.
3)
Double-click on the chosen region. This will bring up a window showing the center coordinates and radius of the circle. For example, lets say the center is at (26144,22838) and the radius is 600.
4)
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). Remember that for PN data, spectralbinsize must be set to 5, and specchannelmax must be set to 20479.
evselect table='mos1_filt_time.fits:EVENTS' energycolumn='PI' withfilteredset=yes
$   $ filteredset='mos1_filtered.fits' keepfilteroutput=yes filtertype='expression'
$   $ expression='((X,Y) in CIRCLE(26144,22838,600))&&(FLAG==0)'
$   $ withspectrumset=yes spectrumset='mos1_pi.fits' spectralbinsize=15
$   $ withspecranges=yes specchannelmin=0 specchannelmax=11999

where

table - the event file
energycolumn - energy column
withfilteredset - make a filtered event file
keepfilteroutput - keep the filtered file
filteredset - name of output file
filtertype - type of filter
expression - expression to filter by
withspectrumset - make a spectrum
spectrumset - name of output spectrum
spectralbinsize - size of bin, in eV
withspecranges - covering a certain spectral range
specchannelmin - minimum of spectral range
specchannelmax - maximum of spectral range


6.4.2 Extract the Background Spectrum

To extract the background spectrum using the GUI:

1)
Follow steps 1 - 3 of §6.4.1 (GUI instructions).
2)
Make an annulus around the object whose background spectrum you wish to extract. This can be done using two circles, each defining the inner and outer edges of the annulus.
3)
Select the inner circle. From ``Regions'' on the ds9 pulldown menu, select ``Properties'', then ``Exclude''. Adjust the sizes and positions of the circles until you are satisfied with the extraction region.
4)
In the xmmselect GUI, make sure the ``Selection Expression'' box is empty.
5)
Click on ``2D Region'' in the xmmselect GUI. Confirm that the correct values were transferred to the ``Selection Expression'' box; in this case, it should show
((X,Y) in CIRCLE(26144,22838,1500))&&!((X,Y) in CIRCLE(26144,22838,900))
6)
Follow steps 6 - 10 of §6.4.1 (GUI instructions), giving the output files appropriate names. In this case, let the spectrum be bkg_pi.fits and the filtered file be bkg_filtered.fits.

To extract the background spectrum using the command line:

1)
View the filtered event file with ds9.
ds9 mos1_filt_time.fits &
2)
Make an annulus around the object whose background spectrum you wish to extract. This can be done using two circles, each defining the inner and outer edges of the annulus.
3)
Select the inner circle. From ``Regions'' on the ds9 pulldown menu, select ``Properties'', then ``Exclude''.
4)
Adjust the sizes and positions of the circles until you are satisfied with the extraction region.
5)
Double-click on the regions. This will bring up windows listing the center coordinates and radius of each circle. For example, lets say the circles are centered on (26144,22838), and have radii of 900 and 1500.
6)
Follow step 4 in §6.4.1 (command line instructions), remembering to change the output file names and the extraction expression:
spectrumset='bkg_pi.fits'
filteredset='bkg_filtered.fits'
expression='((X,Y) in CIRCLE(26144,22838,1500))&&!((X,Y) in CIRCLE(26144,22838,900))'

6.4.3 Determine the Spectrum Extraction Areas

The source and background region areas must now be found. This is done with the task backscale, which takes into account any bad pixels or chip gaps, and writes the result into the BACKSCAL keyword of the spectrum table. Since there are so few parameters, it is easiest to use the command line:

1)
In the window where SAS was initialized, and in the directory where the spectra are, type
backscale spectrumset=mos1_pi.fits badpixlocation=mos1_filt_time.fits
backscale spectrumset=bkg_pi.fits badpixlocation=mos1_filt_time.fits


6.4.4 Check for Pile Up

Depending on how bright the source is and what modes the EPIC detectors are in, 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 such cases the energies of the two events are in effect added together to form one event. If this happens sufficiently often it will skew the spectrum to higher energies. To check whether pile up may be a problem, use the SAS task epatplot. Note that this procedure requires as input the event files created when the spectrum was made.

The default output of epatplot is a postscript file named ``my event file''_epat.ps. As ever, the user should feel free to rename files. The plot, which may be viewed with gv, contains two graphs describing the distribution of counts as a function of PI channel; see Figure 6.6.

A few words about interpretting the plots are in order. The top is the distribution of counts versus PI channel for each pattern class (single, double, triple, quadruple), and the bottom is the expected pattern distribution (smooth lines) plotted over the observed distribution (histogram). If the lower plot shows the model distributions for single and double events diverging significantly from the observed distributions, then the source is piled up.

The source used in this example is too faint to provide reasonable statistics for epatplot and is far from being affected by pile up. In contrast, Figure 6.7 shows an example of a bright source (from a different observation) which is strongly affected by pileup. Note the severe divergence between the model and the observed pattern distribution.

To check for pile up with the GUI:

1)
Double-click epatplot in the SAS GUI.
2)
In the epatplot window, in the ``set'' text area, enter the name of the event file that was made when the spectrum was extracted, in this case, mos1_filtered.fits. Click the ``withbackgroundset'' box. In the ``backgroundset'' text area, enter the name of the background event file output when the background spectrum was extracted, in this case, bkg_filtered.fits. If you wish to change the output file name to something other than the default, click the ``useplotfile'' box and enter the name in the ``plotfile'' text area; For this example, we will use mos1_epat.ps.
3)
Click ``Run''.

To check for pile up 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).
epatplot set=mos1_filtered.fits plotfile=mos1_epat.ps useplotfile=yes
$   $ withbackgroundset=yes backgroundset=bkg_filtered.fits

Figure 6.6: The output of epatplot for a very faint source without pileup. Note that in the lower plot, for energies less than $\sim $ 1500 eV, there are too few X-rays for epatplot to model.
\begin{figure}
\centerline{\psfig{file=epatplot.ps,width=5in}}
\end{figure}

Figure 6.7: The output of epatplot for a heavily piled source. In the lower plot, there are large differences between the predicted and observed pattern distribution at energies above $\sim $ 1000 eV.
\begin{figure}
\centerline{\psfig{file=events_pat.ps,width=5in}}
\end{figure}


6.4.5 My Observation is Piled Up! Now What?

There are two ways to remove the effects of pile up from an observation:

$\bullet$
Using the region selection and event file filtering procedures demonstrated in earlier sections, you can excise the inner-most regions of a source (as they are the most heavily piled up), re-extract the spectrum, and continue your analysis on the excised event file. For this procedure, it is recommended that you take an iterative approach: remove an inner region, extract a spectrum, check with epatplot, and repeat, each time removing a slightly larger region, until the model and observed distribution functions agree.

and/or

$\bullet$
Using the event file filtering procedures, consider only the pattern 0 events (PATTERN==0). Pattern 0 events are less sensitive to pile up than other patterns.


6.4.6 Create the Photon Redistribution Matrix (RMF)

The following assumes that an appropriate source spectrum, named mos1_pi.fits, has been extracted as in §6.4.1.

To make the RMF using the GUI:

1)
Double-click the task rmfgen in the SAS GUI.
2)
In the ``Main'' tab, set the spectrumset keyword to the spectrum file name, e.g., mos1_pi.fits. Set the rmfset keyword to the RMF file name, e.g., mos1_rmf.fits.
3)
Click ``Run''.

To make the RMF using the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type:
rmfgen rmfset=mos1_rmf.fits spectrumset=mos1_pi.fits

where

rmfset - output file
spectrumset - spectrum file


6.4.7 Create the Ancillary Region File (ARF)

The following assumes that an appropriate source spectrum, named mos1_pi.fits, has been extracted as in §6.4.1, and the RMF, named mos1_rmf.fits, has been made as in §6.4.6.

To make the ARF using the GUI:

1)
Double-click on the task arfgen in the SAS GUI.
2)
In the ``Main'' tab, set the arfset parameter to the ARF file name, for example, mos1_arf.fits. Set the spectrumset parameter to the spectrum file name, in this case, mos1_pi.fits.
3)
In the ``Effects'' tab, confirm that the withbadpixcorr box is checked. Set the badpixlocation keyword to the event file name from which the spectrum was extracted, in this case, mos1_filt_time.fits.
4)
In the ``Calibration'' tab, check the withrmfset box and set the rmfset keyword to the RMF file name, in this case, mos1_rmf.fits.
5)
Click on ``Run''. (If your xmmselect GUI is still running, a dialog box will occur asking whether rmfgen can be run. It can, as there is no conflict).

To make the ARF using the command line:

1)
In the window where SAS was initialized, and in the directory where you want the output to go, type:
arfgen arfset=mos1_arf.fits spectrumset=mos1_pi.fits withrmfset=yes
$   $ rmfset=mos1_rmf.fits badpixlocation=mos1_filt_time.fits

where

arfset - output ARF file name
spectrumset - input spectrum file name
withrmfset - flag to use the RMF
rmfset - RMF file created by rmfgen
withbadpixcorr - flag to include the bad pixel correction
badpixlocation - file containing the bad pixel information; should be set to the event
$   $ file from which the spectrum was extracted.


6.4.8 Prepare the Spectrum

Assuming that source and background spectra have been extracted as in § 6.4.1 and 6.4.2, and the RMF and ARF created as in §6.4.6 and 6.4.7, spectral fitting will be demonstrated using HEASoft software.

Nearly all spectra will need to be binned for statistical purposes. The procedure grppha from FTOOL provides an excellent mechanism to do just that. The following commands not only group the source spectrum for Xspec but also associate the appropriate background and response files for the source.

1)
On the command line, type:
grppha

and edit the parameters and file names as appropriate:

      Please enter PHA filename[] mos1_pi.fits      ! input spectrum file name
      Please enter output filename[] mos1_grp.fits  ! output grouped spectrum
      GRPPHA[] chkey BACKFILE back_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 25                         ! group the data by 25 counts/bin
      GRPPHA[] exit


6.4.9 Fit the Spectrum

Next, use Xspec to fit the spectrum.

1)
On the command line, type:
xspec

and edit the parameters and file names as appropriate:

      XSPEC> data mos1_grp.fits      ! input data
      XSPEC> ignore 0.0-0.2,6.6-**   ! ignore unusable energy ranges, in keV
                                     ! set a range appropriate for the data
      XSPEC> model wabs(pow+pow)     ! set spectral model to two absorbed power laws
      1:wabs:nH> 0.01                ! set model absorption column density to 1.e20
      2:powerlaw:PhoIndex> 2.0       ! set the first model power law index to -2.0
      3:powerlaw:norm>               ! default model normalization
      4:powerlaw:PhoIndex> 1.0       ! set the second model power law index to -1.0
      5:powerlaw:norm>               ! default model normalization
      wabs:nH> 0.01                  ! set model absorption column density to 1.e20
      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

Figure 6.8 shows the fit to the spectrum.

Figure 6.8: The fitted spectrum of the Lockman Hole source.
\begin{figure}
\centerline{\psfig{file=mos1-lh-source-spec-fit.ps,width=5in}}
\end{figure}


6.5 Source Detection: edetect_chain

The edetect_chain task does nearly all the work involved with EPIC source detection, but it can be problematic. Its use with the MOS1 is described below, for both the GUI and command line, as usual; however, a work-around is also given (see § 6.6) in case it is needed, as it sometimes happens that the imagebuffersize parameter default is not sufficient for a certain image and cannot be changed in edetect_chain.

Edetect_chain requires input files to be generated first. The first step is to make an attitude file with the task atthkgen, then images of the sources in the desired energy bands, with the image binning sizes as needed according to the detector. For the MOS, the binsize is 22; for the PN, the binsize is 82.

In the example below, and in the work-around, source detection is done only on MOS1 images in two bands (``soft'' X-rays with energies between 300 and 2000 eV, and ``hard'' X-rays, with energies between 2000 and 10000 eV). Users interested in other bands might wish to look at Table 3.2 in the 2XMM Catalogue User Guide, which lists several bands and their ECFs (assuming an absorbed power law spectrum, with N$_{\rm H}$ = 3.0 $\times 10^{20}$ cm$^{-2}$ and a photon index of $\Gamma =$ 1.7.)

The example uses the filtered event file produced in §6.3.5, with the assumption that it is located in the current directory.

To detect sources with the GUI:

1)
Call the task atthkgen.
2)
Set the timestep keyword to 1. Set the atthkset keyword to the desired output file name, for example, attitude.fits.
3)
Click ``Run''.
4)
Call the task evselect.
5)
In the ``General'' tab, set the ``Table'' parameter to the MOS1 event file name (mos1_filt_time.fits). Confirm that ``Filtertype'' is set to ``expression'', and in the ``Expression'' text area, type (FLAG == 0)&&(PI in [300:2000]). In the ``Image'' tab, check the withimageset box, and enter the desired output image name, for example, mos1-s.fits. Set xcolumn to X and ycolumn to Y. Set Binning to binSize, ximagebinsize to 22, and yimagebinsize to 22. For the display purposes, we will also make an image over both bands, which we will call mos1-all.fits.
6)
Click ``Run''.
7)
Call the task evselect again.
8)
In the ``General'' tab, set the ``Table'' parameter to the MOS1 event file name (mos1_filt_time.fits). Confirm that ``Filtertype'' is set to ``expression'', and in the ``Expression'' text area, type (FLAG == 0)&&(PI in [2000:10000]). In the ``Image'' tab, check the withimageset box, and enter the desired output image name, for example, mos1-h.fits. Confirm that xcolumn is set to X, ycolumn is set to Y, Binning is binSize, and ximagebinsize and yimagebinsize are both 22.
9)
Click ``Run''.
10)
Call the task edetect_chain.
11)
In the ``0'' tab, in the imagesets text area, type: mos1-s.fits mos1-h.fits In the eventsets area, enter the names of the event file: mos1_filt_time.fits. In the attitudeset area, enter the name of the attitude file made by the task atthkgen (attitude.fits). Set the pimin keyword to the minimum PI values (in eV) for the input images by typing: 300 2000, and do similar for the maximum values for pimax (2000 10000). Set the likemin parameter to 10, witheexpmap to yes, ecf to 0.878 0.220. In the ``1'' tab, set eboxl_list to eboxlist_l.fits and eboxm_list to eboxlist_m.fits. In the ``2'' tab, set esp_withootset to no and eml_list to emllist.fits.
12)
Click ``Run''.
13)
Call the task srcdisplay.
14)
Set boxlistset to emllist.fits. Confirm that withimageset is checked, and set imageset to mos1-all.fits. Check withregionfile, and set regionfile to regionfile.txt. Confirm that sourceradius is set to 0.01.
15)
Click ``Run''.

Figure 6.9 shows the MOS1 image overlayed with the detected sources.

To detect sources from the command line:

1)
First, make the attitude file. In the window where SAS was initialized, and in the directory where you want the output to go, type:
atthkgen atthkset=attitude.fits timestep=1

where

atthkset - output file name
timestep - time step in seconds for attitude file

2)
Now make the images with evselect. On one line, type:
evselect table=mos1_filt_time.fits withimageset=yes imageset=mos1-s.fits
$   $ imagebinning=binSize xcolumn=X ximagebinsize=22 ycolumn=Y yimagebinsize=22
$   $ filtertype=expression expression='(FLAG == 0)&&(PI in [300:2000])'

where

table - event list
withimageset - flag to create an image
imageset - fits image name to be created
imagebinning - how to bin the image
xcolumn - table column to use for the X axis
ximagebinsize - binning in X axis
ycolumn - table column to use for the Y axis
yimagebinsize - binning in Y axis
filtertype - type of filtering
expression - filtering expression, select events in the PI channel range 300-2000 eV

3)
Repeat step 2, but change the filtering expression to (FLAG == 0)&& (PI in [2000:10000]). We will assume the output image is named mos1-h.fits. For the display purposes, we will also make an image over both bands, which we will call mos1-all.fits.
4)
Run edetect_chain.
edetect_chain imagesets='mos1-s.fits mos1-h.fits'
$   $ eventsets='mos1_filt_time.fits' attitudeset=attitude.fits
$   $ pimin='300 2000' pimax='2000 10000' likemin=10 witheexpmap=yes
$   $ ecf='0.878 0.220' eboxl_list=eboxlist_l.fits
$   $ eboxm_list=eboxlist_m.fits eml_list=emllist.fits esp_withootset=no

where

imagesets - list of count images
eventsets - list of event files
attitudeset - attitude file name
pimin - list of minimum PI channels for the bands
pimax - list of maximum PI channels for the bands
likemin - maximum likelihood threshold
witheexpmap - create and use exposure maps
ecf - energy conversion factors for the bands
eboxl_list - output file name for the local sliding box source
$   $ detection list
eboxm_list - output file name for the sliding box source detection in
$   $ background map mode list
eml_list - output file name for maximum likelihood source detection list
esp_withootset - Flag to use an out-of-time processed PN event file,
$   $useful in cases where bright point sources have left streaks in the PN data
esp_ooteventset - The out-of-time processed PN event file
The energy conversion values (ECFs) can be supplied to convert the source count rates into fluxes. The ECFs for each detector and energy band depend on the pattern selection and filter used during the observation. For more information, please consult the calibration paper ``SSC-LUX-TN-0059'', available at the XMM-Newton Science Operations Center or see Table 3.2 in the 2XMM Catalogue User Guide. Those used here are derived from PIMMS using the flux in the 0.1-10.0 keV band, a source power-law index of 1.9, an absorption of $0.5\times10^{20}$.

5)
Display the results of eboxdetect using the task srcdisplay and produce a region file for the sources.
srcdisplay boxlistset=emllist.fits imageset=mos1-all.fits
$   $ regionfile=regionfile.txt sourceradius=0.01 withregionfile=yes

where

boxlistset - eboxdetect source list
imageset - image file name over which the source circles are to be plotted
includesources - flag to include the source positions on the display
regionfile - file name of output file containing source regions
sourceradius - radius of circle plotted to locate sources
withregionfile - flag to create a region file

Figure 6.9 shows the MOS1 image overlayed with the detected sources.

Figure 6.9: MOS1 count image with the detected sources.
\begin{figure}
\centerline{\psfig{file=mos1_image.eps,width=5in}}
\end{figure}


6.6 Source Detection: The edetect_chain Work-Around

The task edetect_chain is actually a meta-task, comprised of seven straightforward tasks that can be run by hand. Since these are so many, it is easier to run them from the command line. The first step is to make an attitude file with the task atthkgen, then images of the sources in the desired energy bands, with the image binning sizes as needed according to the detector. As seen in §6.5, for the MOS, the binsize is 22; for the PN, the binsize is 82.

To detect sources from the command line, without using edetect_chain:

1)
Make the attitude file. In the window where SAS was initialized, and in the directory where you want the output to go, type:
atthkgen atthkset=attitude.fits timestep=1

where

atthkset - output file name
timestep - time duration (in seconds) of step through attitiude information

2)
Make the images. In the window where SAS was initialized, and in the directory where you want the output to go, type:

evselect table=mos1_filt_time.fits withimageset=yes imageset=mos1-s.fits
$   $ imagebinning=binSize xcolumn=X ximagebinsize=22 ycolumn=Y yimagebinsize=22
$   $ filtertype=expression expression='(FLAG == 0)&&(PI in [300:2000])'

where

table - event list
withimageset - flag to create an image
imageset - fits image name to be created
imagebinning - how to bin the image
xcolumn - table column to use for the X axis
ximagebinsize - binning in X axis
ycolumn - table column to use for the Y axis
yimagebinsize - binning in Y axis
filtertype - type of filtering
expression - filtering expression

3)
Repeat step 2, but change the filtering expression to '(FLAG==0)&&(PI in [2000:10000])'. We will assume the output image is named mos1-h.fits.
4)
Make exposure maps for each of the different energy bands.

eexpmap attitudeset=attitude.fits eventset=mos1_filt_time.fits imageset=mos1-s.fits
$   $ expimageset='mos1-s_exp.fits mos1-h_exp.fits' pimin='300 2000' pimax='2000 10000'

where

attitudeset - attitude file
eventset - event list
imageset - image name; can be any of the images we just made. This is used only
$   $to extract some header information.
expimageset - output file name
pimin - lower energy limit of exposure images
pimax - higher energy limit of exposure images

5)
Make detection masks for each detector using the exposure maps just made. The mask can be viewed in ds9 to confirm that the area selection is useful for further source detections.
emask expimageset=mos1-s_exp.fits detmaskset=mask_mos1.fits

where

expimageset - name of exposure map
detmaskset - output file name

6)
Begin the local mode sliding box detection. Please note that you may need to increase the the parameter imagebuffersize, which is not listed in the task description. If so, you need only add imagebuffersize=2000 to the parameter list below.
eboxdetect usemap=no likemin=8 withdetmask=yes detmasksets='mask_mos1.fits'
$   $ imagesets='mos1-s.fits mos1-h.fits' expimagesets='mos1-s_exp.fits mos1-h_exp.fits
$   $ pimin='300 2000' pimax='2000 10000' boxlistset=eboxlist_mos1_l.fits ecf='1 1'

where

usemap - flag to use map or local mode. True: map mode, false: local mode
likemin - minimum detection likelihood
withdetmask - detection mask flag
detmasksets - name of detection mask
imagesets - names of input images
expimagesets - names of exposure maps
pimin - lower energy limit of input images
pimax - higher energy limit of input images
boxlistset - name of output source list
ecf - energy conversion factors, in 10$^{-11}$ counts cm$^2$ erg$^{-1}$

7)
Use the output to generate spline background maps from the non-source regions.
esplinemap bkgimageset=mos1-s_bkg.fits imageset=mos1-s.fits
$   $ boxlistset=eboxlist_mos1_l.fits scut=0.005 nsplinenodes=16 withdetmask=yes
$   $ detmaskset=mask_mos1.fits withexpimage=yes expimageset=mos1-s_exp.fits

where

bkgimageset - name of output spline background map
imageset - name of input image
boxlistset - name of eboxdetect source list
scut - source cut-out flux level in counts/arcsec$^2$
nsplinenodes - number of spline nodes
withdetmask - use the detection map?
detmaskset - name of detection map file
withexpimages - use the exposure map?
expimageset - name of exposure map

8)
Repeat step 7 for each energy band, changing the input and output images and exposure maps as needed. We will assume the output file is named mos1-h_bkg.fits.

9)
Perform the sliding box source detection again, this time in map mode. This will improve the detection sensitivity. As before, you may need to increase the imagebuffersize parameter to, say, 2000.
eboxdetect usemap=yes likemin=8 withdetmask=yes detmasksets='mask_mos1.fits'
$   $ imagesets='mos1-s.fits mos1-h.fits' expimagesets='mos1-s_exp.fits mos1-h_exp.fits'
$   $ pimin='300 2000' pimax='2000 10000' boxlistset=eboxlist_mos1_m.fits
$   $ bkgimagesets='mos1-s_bkg.fits mos1-h_bkg.fits' ecf='1 1'

where the parameters are as defined in step 6, and

bkgimageset - name of spline background maps

10)
Make the final source list with emldetect. The energy conversion values (ECFs) can be supplied to convert the source count rates into fluxes. The ECFs for each detector and energy band depend on the pattern selection and filter used during the observation. For more information, please consult the calibration paper ``SSC-LUX-TN-0059'', available at the XMM-Newton Science Operations Center or see Table 3.2 in the 2XMM Catalogue User Guide. Those used here are derived from PIMMS using the flux inthe 0.1-10.0 keV band, a source power-law index of 1.9, and an absorption of 0.5$\times$10$^{20}$cm$^{-2}$. As with eboxdetect, it may be necessary to increase the parameter imagebuffersize, to say, 2000.
emldetect imagesets='mos1-s.fits mos1-h.fits' expimagesets='mos1-s_exp.fits
$   $ mos1-h_exp.fits' bkgimagesets='mos1-s_bkg.fits mos1-h_bkg.fits'
$   $ pimin='300 2000' pimax='2000 10000' boxlistset='eboxlist_mos1_m.fits'
$   $ ecf='0.878 0.22' mlmin=10 mllistset=emllist_mos1.fits
where

imagesets - names of images
expimagesets - names of exposure maps
bkgimagesets - names of background maps
pimin - lower energy limit of images
pimax - higher energy limit of images
boxlistset - name of source list output from eboxdetect
mlmin - minimum detection likelihood for inclusion of source in output list
mllistset - name of output emldeetect source list

The image can be viewed with the source list overlaid:

srcdisplay boxlistset=emllist_mos1.fits imageset=mos1-s.fits sourceradius=0.01


6.7 Source Detection: Making a Sensitivity Map

After performing source detection, it may be instructive to make a sensitivity map, which gives the rough point source detection upper limits for each image pixel, using esensmap. (Edetect_chain does this automatically, but there is no harm in repeating this procedure.) This task can be called for individual energy bands or combinations of energy bands and instruments. First, we will make a sensitivity map for only the MOS1 soft energy band from the examples in §6.5 and §6.6, and then proceed to make one for the soft and hard bands combined.

To make a sensitivity map from the GUI:

1)
Call the task esensmap.
2)
Next to detmasksets, enter mask_mos1.fits; next to expimagesets, enter mos1-s_exp.fits; next to bkgimagesets, enter mos1-s_bkg.fits; next to sensimageset, enter mos1-s_sen.fits.
3)
Click ``Run''.

To make a sensitivity map from the command line:

esensmap expimagesets='mos1-s_exp.fits' bkgimagesets='mos1-s_bkg.fits'
$   $ detmasksets='mask_mos1.fits' sensimageset='mos1-s_sen.fits' mlmin=10

where

expimagesets - names of exposure maps
bkgimagesets - names of background maps
detmasksets - names of detection masks
sensimageset - name of source list output from eboxdetect
mlmin - minimum detection likelihood for inclusion of source in output list

To make a sensitivity map for the MOS1 soft and hard energy bands combined, from the GUI:

1)
Call the task esensmap.
2)
Next to detmasksets, enter mask_mos1.fits; next to expimagesets, enter mos1-s_exp.fits mos1-h_exp.fits; next to bkgimagesets, enter mos1-s_bkg.fits mos1-h_bkg.fits; next to sensimageset, enter mos1-comb_sen.fits.
3)
Click ``Run''.

To make a sensitivity map for the MOS1 soft and hard energy bands combined, from the command line:

esensmap expimagesets='mos1-s_exp.fits mos1-h_exp.fits'
$   $ bkgimagesets='mos1-s_bkg.fits mos1-h_bkg.fits' detmasksets='mask_mos1.fits'
$   $ sensimageset='mos1-comb_sen.fits' mlmin=10


6.8 Timing Analysis

This section will demonstrate some basic timing analysis of EPIC image-mode data using the Xronos analysis package. (Note: for PN timing and burst mode data, the task epchain must be run with datamode=TIMING$\vert$BURST.) These examples assume that an appropriate light curve, named source.lc, has been created as in § 6.3.3 with timebinsize set to 1 and makeratecolumn set to no. For this exercise the central source from the observation of G21.5-09 (Obs ID 0122700101) is used. For the aficionado, the task barycen can be used for the barycentric correction of the source event arrival times.

Figure 6.10: Light curve for the source analyzed as in § 6.3.3.
\begin{figure}
\centerline{\psfig{file=lh-xlc.ps,width=5in,angle=-90}}
\end{figure}

Figure 6.11: Power spectrum density for the source analyzed as in § 6.4.
\begin{figure}
\centerline{\psfig{file=lh-xpow.ps,width=5in,angle=-90}}
\end{figure}

1)
Use the Xronos command lcurve to produce a binned lightcurve. The following command will also produce a screen plot using QDP (``quit'' or ``exit'' will exit the QDP session).

lcurve nser=1 cfile1=source.lc window=- dtnb=500 nbint=450
$   $ outfile=lightcurve.fits plot=yes plotdev=/xw

where

nser - number of time series
cfile1 - filename first series
window - name of window file (if a subset of the time series is required)
dtnb - bin size (time)
nbint - number of bins per interval
outfile - output file name (FITS format light curve)
plot - plot flag
plotdev - device for plotting, output shown in Figure 6.10
2)
Use the Xronos command powspec calculate power spectrum density. The following command will also produce a screen plot using QDP (``quit'' or ``exit'' will exit the QDP session).

powspec cfile1=source.lc window=- dtnb=100.0 nbint=300
$   $ nintfm=INDEF rebin=5 plot=yes plotdev=/xw outfile=power.fits

where

cfile1 - filename first series
window - name of window file (if a subset of the time series is required)
dtnb - bin size (time)
nbint - number of bins per interval
nintfm - number of intervals in each power spectrum
rebin - rebin factor for power spectrum (0 for no rebinning)
plot - plot flag
plotdev - device for plotting, output shown in Figure 6.11
outfile - output file name (FITS format power spectrum)

3)
Use the Xronos command efsearch to search for periodicities in the time series. The following command will also produce a screen plot using QDP (``quit'' or ``exit'' will exit the QDP session).
efsearch cfile1=source.lc window=- sepoch=INDEF dper=20 nphase=10
$   $ nbint=INDEF nper=100 dres=INDEF plot=yes plotdev=/xw outfile=efsearch.fits

where

cfile1 - filename first series
window - name of window file (if a subset of the time series is required)
sepoch - value for epoch used for phase zero when folding the time series
dper - value for the period used in the folding
nphase - number of phases per period
nbint - number of bins per interval
nper - number of sampled periods during search
dres - sampling resolution of search
plot - plot flag
plotdev - device for plotting
outfile - output file name (FITS format)

4)
Use the Xronos command autocor to calculate the auto correlation for an input time series. The following command will also produce a screen plot using QDP (``quit'' or ``exit'' will exit the QDP session).
autocor cfile1=source.lc window=- dtnb=24.0 nbint=2048 nintfm=INDEF
$   $ rebin=0 plot=yes plotdev=/xw outfile=auto.fits

where

cfile1 - filename first series
window - name of window file (if a subset of the time series is required)
dtnb - bin size (time)
nbint - number of bins per interval
nintfm - number of intervals to be summed in each autocorrelation function
rebin - rebin factor for autocorrelation function (0 for no rebinning)
plot - plot flag
plotdev - device for plotting
outfile - output file name (FITS format autocorrelation spectrum)

5)
Use the Xronos command lcstats to calculate statistical quantities for an input time series. The following command will write the output to an ASCII file fname. (Leave off the $>$ fname to write the results to the screen.)
lcstats cfile1=source.lc window=- dtnb=6.0 nbint=8192 $>$ fname

where

cfile1 - filename first series
window - name of window file
dtnb - integration time (binning)
nbint - number of bins
fname - output file name


6.9 Once More, This Time with Feeling and Ftools

Most of the data extraction described in the previous sections can be done equally well in Ftools, and will be illustrated here using fselect and Xselect. Note that the HEASoft package is incorporated into SAS and so if SAS is operational, fselect and Xselect will be available. Keith Arnaud is responsible for the XMM-Newton-specific tools mentioned below, which he describes at:
http://lheawww.gsfc.nasa.gov/users/kaa/xselect/xmm.html

1)
Filter the event file using the xmmclean perl script provided by Arnaud at the HTML page above by typing the following:

fselect mos1.fits mos1-filt.fits "FLAG ==0 && TIME <= 73227600)
$   $ &&!(TIME in [73221920:73223800]) && PATTERN <= 12
$   $ && PI <= 12000 && PI >= 200"

2)
Invoke an Xselect session.
xselect

Enter a session name or default with a carriage return.

3)
Read in the event list.
read events mos1-filt.fits

Enter the directory containing the event file; enter yes to reset the mission.

4)
Create and plot an image (this will spawn a ds9 window).
extract image
plot image

5)
Create and plot a light curve (this will spawn a Pgplot window).
extract curve
plot curve

6)
Filter the data. This can be done in one of two ways: using the cursor and light curve plot, or by using a threshold intensity.
a)
To filter on time using the cursor and light curve plot, type
$   $ filter time cursor
and follow the instructions.
-
Enter ``quit'' at the PLT prompt.
-
Right-click at the start and end points of the time intervals to keep.
-
When done entering intervals, enter ``x'' on the keyboard
b)
To filter on time using a threshold intensity, type
$   $ filter time cursor range
where range is the filter range, e.g., 0.01-3.0.

7)
Create the extraction region for the source.
a)
Display the filtered image output from step 6 with ds9.
b)
Create a region on the ds9 window:
-
In the ds9 window pull down the Region menu and set 1) the File Format to DS9/Funtools, 2) the File Coordinate System to Equatorial J2000, and 3) the Region Coordinate System to Degrees
c)
Adjust the region to be appropriate for the source of interest
d)
Under the region menu select the Save Regions option
e)
Save the region as a file (e.g., ds9-source.reg)
8)
Create an annulus extraction region for the background.
a)
If necessary, resize the existing region to be appropriate for the inner annulus radius
b)
Pull down the Region menu and select Exclude under Properties
c)
Create a second region on the ds9 window
d)
Adjust the region to be appropriate for the outer boundary of the annulus
e)
Pull down the Region menu and select Include under Properties
f)
Make sure that the outer annulus is ``in front'' by selecting the Move to Front option under the Region menu.
g)
Under the region menu select the Save Regions option
h)
Save the region (e.g., ds9-back.reg)
9)
Filter the data using the source region.
10)
Extract, plot, save the spectrum from the source region and create RMF and ARF files.
extract spectrum
plot spectrum
save spectrum resp=yes
$   $ The resp=yes runs the perl script xsl_xmm_epic_makeresp which is available from Arnaud's web page above
-
Enter a file name for the spectrum, e.g., mos1-source.pi
-
Bin the data (i.e., enter yes at the query)
11)
Filter the data using the background region.
a)
First remove the source filter expression: clear region all
b)
Now invoke the background filter: filter region ds9-back.reg
12)
Extract, plot, and save the spectrum from the background region.
13)
Extract, plot, and save the light curve from the region.
a)
First remove the source filter expression: clear region all
b)
Now invoke the source filter: filter region ds9-source.reg
c)
And extract the light curve.
$   $ extract curve binsize=1000 phalcut_t=300 phahcut_t=10000
-
use binsize=1 to create a light curve for timing analysis
-
use phalcut_t to set the lower energy bound for the light curve
-
use phahcut_t to set the upper energy bound for the light curve
plot curve
save curve
-
Enter a file name for the light curve

From this point follow the procedures in § 6.4.8 and § 6.4.9 for spectral analysis and § 6.8 for temporal analysis.


6.10 In a Nutshell

To summarize, the basic steps taken in EPIC data reduction are as follows.

1)
Obtain the raw and pipelined data.
2)
Initialize SAS.
3)
Make the CCF and ODF summary file (run the cifbuild and odfingest tasks).
4)
Rerun the pipeline (run the emchain/emproc and epchain/epproc tasks).
5)
Make the images and light curves.
6)
Filter the event files.
7)
Make filtered images.
8)
Extract the source and background spectra.
9)
Check for pile up (eplatplot).
10)
Make the response files (rmfgen and arfgen).
11)
Fit the spectrum.


next up previous contents
Next: 7. An RGS Data Up: XMM ABC Guide Previous: 5. Preparing the Data   Contents
Lynne Valencic 2013-05-13