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 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, you need only to gunzip the files and prepare the data for processing (see §5. Feel free to skip the command line and GUI discussions on repipelining (§6.1 and §6.4, respectively) and proceed to the command line or GUI discussions on filtering (§6.2 and §6.5, respectively). In any case, for simplicity, it is 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

Various analysis procedures are demonstrated using the Lockman Hole SV1 dataset, ObsID 0123700101, which definitely needs to be repipelined. 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.

If you simply want to have a quick look at your data, 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. Also, the PP source list is provided in both zipped FITS format (readable by fv) and as an HTML file.

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.

The following sections (§6.1, 6.2, and 6.3) will deal with processing EPIC data on the command line. Users who prefer to use the GUI should skip ahead to find the demonstrations for the same tasks with the GUI (§6.4, 6.5, and 6.6).


6.1 Rerun the Pipeline on the Command Line

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 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.

Note that emproc and epproc will automatically detect what mode the data were taken in. However, if you are using data that was not taken in Imaging mode and want to run emchain or epchain, you will need to set the relevant parameter, as shown below.

To process MOS data taken in Imaging Mode (like the Lockman Hole dataset), type

emchain

or

emproc

Similarly, to process PN data taken in Imaging Mode, type

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

If you have PN data taken in Timing or Burst mode, you can either just use epproc, or

epchain datamode=TIMING

and

epchain datamode=BURST

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 below can be used for data in Imaging Mode. For data in Timing Mode, see §6.3.


6.2 Examine and Analyze Data on the Command Line (Imaging Mode)

Remember that all tasks should be called from the window where SAS was initiated, and that tasks place output files in whatever directory you happen to be in when they are called, so be sure to call them in the directory where you want the output to go!


6.2.1 Create and Display an Image

To create an image in sky coordinates, type

evselect table=mos1.fits 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

The output file image.fits can be viewed by using a standard FITS display, such as ds9 (see Figure 6.1) :

ds9 image.fits &

Figure 6.1: The MOS1 image, displayed in ds9.

\includegraphics[scale=0.5]{mos1-lh-im.ps}


6.2.2 Create and Display a Light Curve

To create a light curve, type

evselect table=mos1.fits 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

or, alternatively,

fv mos1_ltcrv.fits &

In the pop-up window, the RATE extension will be available in the second row (index 1, as numbering begins with 0). Select ``PLOT'' from this row, and select the column name and axis on which to plot it.

Figure 6.2: The light curve, displayed in fv.

\includegraphics[scale=0.5]{LockmanHole_0123700101_ltcrv_fv.eps}


6.2.3 Applying Standard Filters the Data

The 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

The first two expressions will select good events with PATTERN in the 0 to 12 range. 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 on the PN. It typically is not necessary for the MOS.

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, type

evselect table=mos1.fits 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.2.4 Applying Time Filters the Data

Sometimes, it is necessary to use filters on time 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 on time: 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 task 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, make a light curve and display it, as demonstrated in §6.2.2 and plotted in Figure 6.2. There is a very large flare toward the end of the observation, so the syntax for the time selection is (TIME $<=$ 73227600). However, there is also a small flare within an otherwise good interval. A slightly more comlicated expression to remove it would 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.2.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 to filter the original event file, as shown in §6.2.3, or only the times can be used to filter the file that has already had the standard filters applied:

evselect table=mos1_filt.fits withfilteredset=yes
$   $ expression='(TIME $<=$ 73227600) &&!(TIME in [73221920:73223800]) '
$   $ filteredset=mos1_filt_time.fits filtertype=expression keepfilteroutput=yes
$   $ updateexposure=yes filterexposure=yes

where the keywords are as described in §6.2.3.

To filter on time using a secondary GTI file, make the file by using the same time filtering parameters as determined above and the tabgtigen task,

tabgtigen table=mos1_ltcrv.fits gtiset=gtiset.fits timecolumn=TIME
$   $ expression='(TIME $<=$ 73227600)&&!(TIME in [73221920:73223800])'

where

table - input count rate table
expression - filtering expression
gtiset - output file name for selected GTI intervals
timecolumn - time column

and apply the new GTI file with the evselect task:

evselect table=mos1_filt.fits 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
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.2.5 Source Detection with edetect_chain

The edetect_chain task does nearly all the work involved with EPIC source detection, but it requires some input files that must 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, 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).

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

First, make the attitude file by typing

atthkgen atthkset=attitude.fits timestep=1

where

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

Next, make the soft and hard X-ray images with evselect by typing

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])'

and

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

We will also make an image with both soft and hard X-rays for display purposes:

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

where the parameters are

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

Now we can 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 factors (ECFs) 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 8 in the 3XMM 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}$.

We can 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.3 shows the MOS1 image overlayed with the detected sources.

Figure 6.3: MOS1 count image with the detected sources.

\includegraphics[scale=0.5]{mos1_image.eps}


6.2.6 Extract the Source and Background Spectra

Throughout the following, please keep in mind that some parameters are instrument-dependent. The parameter specchannelmax should be set to 11999 for the MOS, or 20479 for the PN. Also, for the PN, the most stringent filters, (FLAG==0)&&(PATTERN<=4), must be included in the expression to get a high-quality spectrum.

For the MOS, the standard filters should be appropriate for many cases, though there are some instances where tightening the selection requirements might be needed. For example, if obtaining the best-possible spectral resolution is critical to your work, and the corresponding loss of counts is not important, only the single pixel events should be selected (PATTERN==0). If your observation is of a bright source, you again might want to select only the single pixel events to mitigate pile up (see §6.2.8 and §6.2.9 for a more detailed discussion).

In any case, you'll need to know spatial information about the area over which you want to extract the spectrum, so display the filtered event file with ds9:

ds9 mos1_filt_time.fits &

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 and dragging to the desired size. Adjust the size and position of the circle until you are satisfied with the extraction region; then, double-click on the region to bring up a window showing the center coordinates and radius of the circle. For this example, we will choose the source at (26188.5,22816.5) and set the extraction radius to 300.

To extract the source spectrum, type

evselect table='mos1_filt_time.fits' energycolumn='PI' withfilteredset=yes
$   $ filteredset='mos1_filtered.fits' keepfilteroutput=yes filtertype='expression'
$   $ expression='((X,Y) in CIRCLE(26188.5,22816.5,300))'
$   $ withspectrumset=yes spectrumset='mos1_pi.fits' spectralbinsize=5
$   $ 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

When extracting the background spectrum, follow the same procedures, but change the extraction area. For example, make an annulus around the source; this can be done using two circles, each defining the inner and outer edges of the annulus, then change the filtering expression (and output file name) as necessary.

To extract the background spectrum, type

evselect table=mos1_filt_time.fits energycolumn='PI' withfilteredset=yes
$   $ filteredset='bkg_filtered.fits' keepfilteroutput=yes filtertype='expression'
$   $ expression='((X,Y) in CIRCLE(26188.5,22816.5,1500))&&!((X,Y) in CIRCLE(26188.5,22816.5,500))'
$   $ withspectrumset=yes spectrumset='bkg_pi.fits' spectralbinsize=5
$   $ withspecranges=yes specchannelmin=0 specchannelmax=11999

where the keywords are as described above.

6.2.7 Determine the Spectrum Extraction Areas

The source and background region areas can 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.

To find the source and background extraction areas, type

backscale spectrumset=mos1_pi.fits badpixlocation=mos1_filt_time.fits

and

backscale spectrumset=bkg_pi.fits badpixlocation=mos1_filt_time.fits


6.2.8 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, 1) the spectrum will appear to be harder than it actually is, and 2) the count rate will be underestimated, since multiple events will be undercounted. To check whether pile up may be a problem, use the SAS task epatplot. (Heavily piled sources will be immediately obvious, as they will have a ``hole'' in the center.) Note that this procedure requires as input the event files created when the spectrum was made.

The output of epatplot is a postscript file, which may be viewed with viewers such as gv, containing two graphs describing the distribution of counts as a function of PI channel; see Figure 6.4.

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). The lower plot shows the model distributions for single and double events and the observed distributions. It also gives the ratio of observed-to-modeled events with 1-$\sigma$ uncertainties for single and double pattern events over a given energy range. (The default is 0.5-2.0 keV; this can be changed with the pileupnumberenergyrange parameter.) If the data is not piled up, there will be good agreement between the modeled and observed single and double event pattern distributions. Also, the observed-to-modeled fractions for both singles and doubles in the 0.5-2.0 keV range will be unity, within errors. In contrast, if the data is piled up, there will be clear divergence between the modeled and observed pattern distributions, and the observed-to-modeled fraction for singles will be less than 1.0, and for doubles, it will be greater than 1.0.

Finally, when examining the plots, it should noted that the observed-to-modeled fractions can be inaccurate. Therefore, the agreement between the modeled and observed single and double event pattern distributions should be the main factor in determining if an observation is affected by pile up or not.

The source used in our Lockman Hole example is too faint to provide reasonable statistics for epatplot and is far from being affected by pile up. An example of a bright source (from a different observation) which is strongly affected by pileup is shown in Figure 6.5. Note that the observed-to-model fraction for doubles is over 1.0, and there is severe divergence between the model and the observed pattern distribution.

To check for pile up in our Lockman Hole example, type

epatplot set=mos1_filtered.fits plotfile=mos1_epat.ps useplotfile=yes
$   $ withbackgroundset=yes backgroundset=bkg_filtered.fits

Figure 6.4: 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, and for energies higher than $\sim $ 1500 eV, there is excellent agreement between the expected and observed pattern distributions.

\includegraphics[scale=0.5]{epatplot.ps}

Figure 6.5: 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.

\includegraphics[scale=0.5]{events_pat.ps}


6.2.9 My Observation is Piled Up! Now What?

There are a few ways to deal with pile up. First, 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.

You can also use the event file filtering procedures to include only single pixel events (PATTERN==0), as these events are less sensitive to pile up than other patterns.


6.2.10 Create the Photon Redistribution Matrix (RMF) and Ancillary File (ARF)

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

To make the RMF, type

rmfgen rmfset=mos1_rmf.fits spectrumset=mos1_pi.fits

where

rmfset - output file
spectrumset - spectrum file

Now use the RMF, spectrum, and event file to make the ancillary file.

To make the ARF, type

arfgen arfset=mos1_arf.fits spectrumset=mos1_pi.fits withrmfset=yes
$   $ rmfset=mos1_rmf.fits withbadpixcorr=yes 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.

At this point, the spectrum is ready to be analyzed, so skip ahead to prepare the spectrum for fitting (§6.7).


6.3 Examine and Analyze Data on the Command Line (Timing Mode)

The process for analyzing PN Timing data is largely similar to that for Imaging data, but with a few differences. We will assume that the pipeline was rerun and that the output event file was named pn.fits.


6.3.1 Create and Display an Image

To create an image, type

evselect table=pn.fits withimageset=yes imageset=image.fits
$   $ xcolumn=RAWX ycolumn=RAWY imagebinning=binSize ximagebinsize=1 yimagebinsize=1

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
ximagebinsize - binning factor for X axis
yimagebinsize - binning factor for Y axis

The output file image.fits can be viewed by using a standard FITS display, such as ds9 (see Figure 6.6).

ds9 image.fits &

Figure 6.6: An image of PN data taken in Timing mode, displayed in ds9.

\includegraphics[scale=0.5]{bol375_timing_image_ds9.eps}


6.3.2 Create and Display a Light Curve

To create a light curve, type

evselect table=pn.fits withrateset=yes rateset=pn_ltcrv.fits
$   $ maketimecolumn=yes timecolumn=TIME timebinsize=50 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 pn_ltcrv.fits can be viewed by using fv (see Fig 6.7).

Figure 6.7: The light curve of our example PN Timing mode data, displayed in fv.

\includegraphics[scale=0.5]{bol375_timing_ltcrv_fv.eps}


6.3.3 Applying Standard Filters to the Data

The filtering expressions for PN in Timing Mode is:

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

The first expression will select good 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 expression, PI, selects the preferred pulse height of the event. Since we are working with PN data, 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_EP 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 on PN data.

To filter the data, type

evselect table=pn.fits withfilteredset=yes
$   $ expression='(PATTERN $<=$ 4)&&(PI in [200:15000])&&#XMMEA_EP'
$   $ filteredset=pn_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.4 Applying Time Filters to the Data

Sometimes, soft proton background flaring makes it necessary to use filters on time in addition to those mentioned above.

To determine if there is flaring in the observation, make a light curve and display it, as demonstrated in §6.3.2 and plotted in Figure 6.7. No flares are evident, so we will continue to the next section. However, if a given dataset does contain flaring, it should be removed in the same way as shown in §6.2.4.


6.3.5 Extract the Source and Background Spectra

First, we will need to make an image of the filtered event file following the procedures set out in §6.3.1:

evselect table=pn_filt.fits imagebinning=binSize
$   $ imageset=image.fits withimageset=yes
$   $ xcolumn=RAWX ycolumn=RAWY ximagebinsize=1 yimagebinsize=1

where the keywords are as described in §6.3.1. The image can be displayed with ds9. As can be seen in Figure 6.6, the source is centered on RAWX=38. We will extract this and the 2 pixels on either side of it.

evselect table=pn_filt.fits withspectrumset=yes spectrumset=source_pi.fits
$   $ energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0
$   $ specchannelmax=20479 expression='(FLAG==0) && (RAWX in [36:40])' withfilteredset=yes
$   $ filteredset=pn_filt_source.fits

For the background, the extraction area should be as far from the source as possible.

evselect table=pn_filt.fits withspectrumset=yes spectrumset=bkg_pi.fits
$   $ energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0
$   $ expression='(FLAG==0) && (RAWX in [3:5])'
$   $ specchannelmax=20479 withfilteredset=y filteredset=pn_filt_bkg.fits

6.3.6 Determine the Spectrum Extraction Areas

The source and background region areas can now be found. (This process is identical to that used for Imaging data.) 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.

To find the source and background extraction areas, type

backscale spectrumset=source_pi.fits badpixlocation=pn_filt.fits

and

backscale spectrumset=bkg_pi.fits badpixlocation=pn_filt.fits


6.3.7 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. Pile up and how to deal with it are discussed at length in §6.2.8 and §6.2.9, respectively, and users are strongly encouraged to refer to those sections. Briefly, we deal with it in PN Timing data essentially the same way as in Imaging data, that is, by using only single pixel events, and/or removing the regions with very high count rates, checking the amount of pile up, and repeating until it is no longer a problem.

In our example case, the source is far too faint to be piled up, but it is always a good idea to check anyway.

To check for pile up, type

epatplot set=pn_filt_source.fits plotfile=pn_epat.ps useplotfile=yes
$   $ withbackgroundset=yes backgroundset=pn_filt_bkg.fits

The output is shown in Fig. 6.8.

Figure 6.8: The output of epatplot.

\includegraphics[scale=0.5]{pn_timing_pileup.ps}


6.3.8 My Timing Mode Data is Piled Up! Now What?

There are a couple ways to deal with pile up. First, you can use event file filtering procedures to include only single pixel events (PATTERN==0), as these events are less sensitive to pile up than other patterns.

You can also excise areas of high count rates, i.e., the boresight column and several columns to either side of it. (This is analogous to removing the inner-most regions of a source in Imaging data.) The spectrum can then be re-extracted and you can continue your analysis on the excised event file. As with Imaging data, 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 pattern distributions agree.

For example, a bright source is shown in Fig. 6.9. We can extract the boresight column and several columns to either side:

evselect table=pn_filt.fits withspectrumset=yes spectrumset=source_pi_WithBore.fits
$   $ energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0
$   $ specchannelmax=20479 expression='(FLAG ==0) && (RAWX in [28:48])'
$   $ withfilteredset=yes filteredset=pn_filt_source_WithBore.fits

And just the columns to either side of the boresight, with lower count rates:

evselect table=pn_filt.fits withspectrumset=yes spectrumset=source_pi_NoBore.fits
$   $ energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0
$   $ expression='(FLAG ==0) && (RAWX in [28:48] &&! (RAWX in [34:41])'
$   $ specchannelmax=20479 withfilteredset=yes filteredset=pn_filt_source_NoBore.fits

and check with epatplot as we go along until no pile up remains.

Be aware that if you do this, you will need to use a non-standard way to make the ancillary files (ARFs) for your spectrum! This is discussed further in §6.3.9. You will need the spectra of the full extraction area and the excised area, so we might as well get them now. We already have it for the full extraction area, so for the excised area,

evselect table=pn_filt.fits withspectrumset=yes spectrumset=source_pi_Excised.fits
$   $ energycolumn=PI spectralbinsize=5 withspecranges=yes specchannelmin=0
$   $ specchannelmax=20479 expression='RAWX in [34:41]'
$   $ withfilteredset=yes filteredset=pn_filt_source_Excised.fits

Figure 6.9: An image of a bright source in PN Timing mode.

\includegraphics[scale=0.5]{Mkn421_timing_image_ds9.eps}


6.3.9 Create the Photon Redistribution Matrix (RMF) and Ancillary File (ARF)

Making the RMF for PN data in Timing mode is exactly the same as in Imaging mode, which is demonstrated in §6.2.10. If the boresight was not excised, making the ARF is the same, as well.

To make the RMF,

rmfgen rmfset=source_rmf.fits spectrumset=source_pi.fits

where

rmfset - output file
spectrumset - spectrum file

and to make the ARF,

arfgen spectrumset=source_pi.fits arfset=source_arf.fits withrmfset=yes
$   $ rmfset=source_rmf.fits badpixlocation=pn_filt.fits detmaptype=psf

However, if you had to remove piled up sections, you will need to make an ARF for the full extraction area, another one for the piled up area, and then subtract the two to find the ARF for the non-piled regions. We already have spectra for the full extraction area and the excised area, so we will use them to make the ARFs:

arfgen arfset=source_arf_WithBore.fits spectrumset=source_pi_WithBore.fits detmaptype=psf
arfgen arfset=source_arf_Excised.fits spectrumset=source_pi_Excised.fits detmaptype=psf

where

arfset - output ARF file name
spectrumset - input spectrum file name

Now we can subtract them:

addarf "source_arf_WithBore.fits source_arf_Excised.fits" "1.0 -1.0" source_arf.fits

At this point, the spectrum is ready to be analyzed, so skip ahead to prepare the spectrum for fitting (§6.7).


6.4 Rerun the Pipeline with the GUI

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 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). If you are reprocessing PN data in TIMING or BURST modes and using epchain, you will need to set the relevant parameter, as shown below.

In the window where SAS was initialized, in your ``processing directory'' PROC, invoke the SAS GUI (see Figure 6.10).

On the command line, type

sas &

A window will appear with two panels. The upper one will contain task names, what group they belong to (such as utility, epic, timing, calibration, etc.) and a short description of each. The lower one will contain information about environment variables, and as tasks are invoked, feedback from the tasks.

From the upper window, select emchain or emproc to process the MOS data, and epchain or epproc to process the PN data. Double-clicking the task will bring up pop-up windows that will allow you to change the (many) parameters; however, for most cases, the default settings are fine, so just click "Run".

If the dataset has more than one exposure, a specific exposure can be accessed with epchain by setting the exposure parameter in the ``General'' tab to the exposure number.

To create an out-of-time event file for your PN data, toggle the parameter withoutoftime on the Epevents tab to ``yes''.

If you have PN data taken in Timing or Burst mode, note that epchain assumes by default that the data was taken in Imaging mode. To repipeline PN Timing or Burst data, toggle the datamode parameter in the General tab to the appropriate value.

By default, none of these tasks keep any intermediate files they generate. Epchain maintains 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 below can be used for data in Imaging Mode. For data in Timing Mode, see §6.6.

mv 0070_0123700101_EMOS1_S001_ImagingEvts.ds mos1.fits

Once the new event files have been obtained, the analysis techniques described below can be used.

Figure 6.10: 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.

\includegraphics[scale=0.5]{sas.ps}

Figure 6.11: The xmmselect GUI.

\includegraphics[scale=0.5]{xmmselect.ps}


6.5 Examine and Analyze Data with the GUI (Imaging Mode)

Remember that tasks place output files in whatever directory you happened to be in when the SAS GUI was called, so either open and close the GUI in the directory where you want the output or move the files to the directory they should be in.


6.5.1 An Introduction to xmmselect

The task xmmselect is used for many procedures in the GUI. Like all tasks, it can easily be invoked by starting to type the name and pressing enter when it is highlighted.

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, select the file folder icon; this will bring up a second window for the file selection. Choose the desired event file, then the ``EVENTS'' extension in the right-hand column, and click ``OK''. The directory window will then disappear and you can click ``Run'' on the selection window.

When the file name has been submitted the xmmselect GUI (see Figure 6.11) 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.12: The evselect GUI.

\includegraphics[scale=0.5]{evselect.ps}


6.5.2 Create and Display an Image

To create an image in sky coordinates by using the xmmselect, call xmmselect and load the event file as in §6.5.1. Then,

1)
Check the square boxes to the left of the ``X'' and ``Y'' entries.
2)
Click the ``Image'' button near the bottom of the page. This brings up the evselect GUI (see Figure 6.12).
3)
In the imageset box, enter the name of the output file, in this case, image.fits.
4)
Click the ``Run'' button on the lower left corner of the evselect GUI.

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. The resultant image is written to the file image.fits, and is automatically displayed using ds9 (see Figure 6.1).


6.5.3 Create and Display a Light Curve

To create a light curve with xmmselect,

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.12).
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.2). It can also be viewed using fv or dsplot; on the command line, type

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

or, alternatively,

fv mos1_ltcrv.fits &

In the fv pop-up window, the RATE extension will be available in the second row (index 1, as numbering begins with 0). Select ``PLOT'' from this row, and select the column name and axis on which to plot it.


6.5.4 Applying Standard Filters the Data

The 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

The first two expressions will select good events with PATTERN in the 0 to 12 range. 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 on the PN. It typically is not necessary for the MOS.

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 xmmselect,

1)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect window:
(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''.


6.5.5 Applying Time Filters the Data

Sometimes, it is necessary to use filters on time 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 on time: 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 task 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.5.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.

There is a very large flare toward the end of the observation, so the syntax for the time selection is (TIME $<=$ 73227600). However, there is also a small flare within an otherwise good interval. A slightly more comlicated expression to remove it would 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.5.4), 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 to filter the original event file, as shown in §6.5.4, or only the times can be used to filter the file that has already had the standard filters applied:

1)
Load the filtered file ``mos1_evt2.fits'' in xmmselect.
2)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect GUI:
(TIME $<=$ 73227600) &&!(TIME in [73221920:73223800])
3)
Click on the ``Filtered Table'' box at the lower left of the xmmselect GUI.
4)
Change the evselect filteredset parameter, the output file name, to something useful, e.g., mos1_filt.fits
5)
Click ``Run''.

To filter on time using a secondary GTI file, make the GTI by using the same time filtering parameters as determined above and the tabgtigen task:

1)
Call up tabgtigen in the SAS window and select the 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''.

The new GTI file can be applied with xmmselect:

1)
Invoke xmmselect and load the event file, mos1_filt.fits.
2)
In the ``Selection Expression'' box, type GTI(gtiset.fits,TIME),
3)
Click on the ``Filtered Table'' box at the lower left of the xmmselect GUI.
4)
Change the evselect filteredset parameter, the output file name, to something useful; here, we will use mos1_filt_time.fits.


6.5.6 Source Detection with edetect_chain

The edetect_chain task does nearly all the work involved with EPIC source detection, but it requires some input files that must 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, 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).

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

First, make the attitude file.

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''.

Next, make the soft and hard X-ray images.

1)
Call the task evselect.
2)
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.
3)
Click ``Run''.
4)
Call the task evselect again.
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 [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.
6)
Click ``Run''.

Now we can run edetect_chain.

1)
Call the task edetect_chain.
2)
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.
3)
Click ``Run''.

The energy conversion factors (ECFs) 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 8 in the 3XMM 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}$.

We can display the results of eboxdetect using the task srcdisplay and produce a region file for the sources.

1)
Call the task srcdisplay.
2)
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.
3)
Click ``Run''.

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


6.5.7 Extract the Source and Background Spectra

Throughout the following, please keep in mind that some parameters are instrument-dependent. The parameter specchannelmax should be set to 11999 for the MOS, or 20479 for the PN. Also, for the PN, the most stringent filters, (FLAG==0)&&(PATTERN<=4), must be included in the expression to get a high-quality spectrum.

For the MOS, the standard filters should be appropriate for many cases, though there are some instances where tightening the selection requirements might be needed. For example, if obtaining the best-possible spectral resolution is critical to your work, and the corresponding loss of counts is not important, only the single pixel events should be selected (PATTERN==0). If your observation is of a bright source, you again might want to select only the single pixel events to mitigate pile up (see §6.5.9 and §6.5.10 for a more detailed discussion).

In any case, you'll need to know spatial information about the area over which you want to extract the spectrum, so display the filtered event file with ds9:

ds9 mos1_filt_time.fits &

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 and dragging to the desired size. Adjust the size and position of the circle until you are satisfied with the extraction region; then, double-click on the region to bring up a window showing the center coordinates and radius of the circle. For this example, we will choose the source at (26188.5,22816.5) and set the extraction radius to 300.

To extract the source spectrum,

1)
If the filtered file (mos1_filt_time.fits) isn't already loaded, invoke xmmselect and load it.
2)
Make an image (see §6.5.2). It will be displayed automatically in a ds9 window.
3)
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.
4)
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(26188.5,22816,300)). 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.
5)
Click the round button next the PI column on the xmmselect GUI.
6)
Click on ``OGIP Spectrum''.
7)
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.
8)
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 withspecranges is checked. Set specchannelmin to 0. Set specchannelmax to 11999 for the MOS, or 20479 for the PN.
9)
Click ``Run''.

When extracting the background spectrum, follow the same procedures, but change the extraction area. For example, make an annulus around the source; this can be done using two circles, each defining the inner and outer edges of the annulus, then change the filtering expression (and output file name) as necessary.

To extract the background spectrum,

1)
Follow steps 1 and 2 for extracting the source spectrum.
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(26188.5,22816,1500))&&!((X,Y) in CIRCLE(26188.5,22816,500))
6)
Follow steps 5 - 9 for extracting the source spectrum, giving the output files appropriate names. In this case, let the spectrum be bkg_pi.fits and the filtered file be bkg_filtered.fits.

6.5.8 Determine the Spectrum Extraction Areas

The source and background region areas can 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.

To find the source extraction area,

1)
Invoke backscale from the SAS GUI.
2)
In the ``Main'' tab, enter the name of the spectrum, mos1_pi.fits. In the ``Effects'' tab, confirm that withbadpixcorr is checked, and enter the name of the event file in badpixlocation.
3)
Click ``Run''.

Follow the same steps to find the background spectrum area, changing the input spectrum file.


6.5.9 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, 1) the spectrum will appear to be harder than it actually is, and 2) the count rate will be underestimated, since multiple events will be undercounted. To check whether pile up may be a problem, use the SAS task epatplot. (Heavily piled sources will be immediately obvious, as they will have a ``hole'' in the center.) Note that this procedure requires as input the event files created when the spectrum was made.

The output of epatplot is a postscript file, which may be viewed with viewers such as gv, containing two graphs describing the distribution of counts as a function of PI channel; see Figure 6.13.

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 our Lockman Hole example is too faint to provide reasonable statistics for epatplot and is far from being affected by pile up. In contrast, Figure 6.14 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,

1)
Invoke 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''.

Figure 6.13: 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, and for energies higher than $\sim $ 1500 eV, there is excellent agreement between the expected and observed pattern distributions.

\includegraphics[scale=0.5]{epatplot_gui.ps}

Figure 6.14: 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.

\includegraphics[scale=0.5]{events_pat_gui.ps}


6.5.10 My Observation is Piled Up! Now What?

There are a few ways to deal with pile up. First, 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.

You can also use the event file filtering procedures to include only those events with PATTERN==0, as these events are less sensitive to pile up than other patterns.


6.5.11 Create the Photon Redistribution Matrix (RMF) and Ancillary File (ARF)

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

To make the RMF,

1)
Invoke 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 ARF,

1)
Invoke 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 ``Run''.

At this point, the spectrum is ready to be analyzed, so skip ahead to prepare the spectrum for fitting §6.7.


6.6 Examine and Analyze Data with the GUI (Timing Mode)

The process for analyzing PN Timing data is largely similar to that for Imaging data, but with a few differences. We will assume that the pipeline was rerun and that the output event file was named ``pn.fits''.

Many popular data products, such as images and light curves, are made with the task xmmselect. The following sections detail how to make them. For an introduction to xmmselect and a discussion on how to load an event file in it, please see §6.5.1.


6.6.1 Create and Display an Image

To create an image in sky coordinates by using the xmmselect, call xmmselect and load the event file as in §6.5.1. Then,

1)
Check the square boxes to the left of the ``RAWX'' and ``RAWY'' entries.
2)
Click the ``Image'' button near the bottom of the page. This brings up the evselect GUI (see Figure 6.12).
3)
In the ``General'' tab, in the imageset box, enter the name of the output file, in this case, image.fits.
4)
In the ``Image'' tab, toggle Binning to binSize, and confirm that ximagebinsize and yimagebinsize are set to 1.
5)
Click the ``Run'' button on the lower left corner of the evselect GUI.

The output file image.fits can be viewed by using a standard FITS display such as ds9 (see Fig. 6.15).

Figure 6.15: An image of PN data taken in Timing mode, displayed in ds9.

\includegraphics[scale=0.5]{bol375_timing_image_ds9_gui.eps}


6.6.2 Create and Display a Light Curve

To create a light curve with xmmselect,

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.12).
3)
Click on the ``Lightcurve'' tab and change the ``timebinsize'' to a reasonable amount, e.g., 50. In the ``rateset'' textbox, enter the name of the output file, pn_ltcrv.fits.
4)
Click on the ``Run'' button at the lower left corner of the evselect GUI.

The output file pn_ltcrv.fits can be viewed by using fv (see Fig 6.16).

Figure 6.16: The light curve of our example PN Timing mode data, displayed in fv.

\includegraphics[scale=0.5]{bol375_timing_ltcrv_fv_gui.eps}


6.6.3 Applying Standard Filters to the Data

The filtering expressions for PN in Timing Mode is:

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

The first expression will select good 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 expression, PI, selects the preferred pulse height of the event. Since we are working with PN data, 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_EP 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 on PN data.

To filter the data using xmmselect,

1)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect window:
(PATTERN $<=$ 4)&&(PI in [200:15000])&&#XMMEA_EP
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., pn_filt.fits
4)
Click ``Run''.


6.6.4 Applying Time Filters to the Data

Sometimes, soft proton background flaring makes it necessary to use filters on time in addition to those mentioned above.

To determine if there is flaring in the observation, make a light curve and display it, as demonstrated in §6.6.2 and plotted in Figure 6.16. No flares are evident, so we will continue to the next section. However, if a given dataset does contain flaring, it should be removed in the same way as shown in §6.5.5.


6.6.5 Extract the Source and Background Spectra

First, we will need to make an image of the filtered event file pn_filt.fits using xmmselect, by following the procedures set out in §6.6.1:

1)
Check the square boxes to the left of the ``RAWX'' and ``RAWY'' entries.
2)
Click the ``Image'' button near the bottom of the page. This brings up the evselect GUI (see Figure 6.12).
3)
In the ``General'' tab, in the imageset box, enter the name of the output file, in this case, image.fits.
4)
In the ``Image'' tab, toggle Binning to binSize, and confirm that ximagebinsize and yimagebinsize are set to 1.
5)
Click the ``Run'' button on the lower left corner of the evselect GUI.

The image can be displayed with ds9. As can be seen in Figure 6.15, the source is centered on RAWX=38. We will extract this and the 2 pixels on either side of it.

1)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect window: (FLAG==0) && (RAWX in [36:40]).
2)
Click the round button next the PI column on the xmmselect GUI.
3)
Click on ``OGIP Spectrum''.
4)
In the ``General'' tab, check keepfilteroutput and withfilteredset. In the filteredset box, enter the name of the event file output, in this case, pn_filt_source.fits.
5)
In the ``Spectrum'' tab, 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, source_pi.fits. Confirm that withspecranges is checked. Set specchannelmin to 0 and specchannelmax to 20479.
6)
Click ``Run''.

For the background, the extraction area should be as far from the source as possible.

1)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect window: (FLAG==0) && (RAWX in [3:5]).
2)
Click the round button next the PI column on the xmmselect GUI.
3)
Click on ``OGIP Spectrum''.
4)
In the ``General'' tab, check keepfilteroutput and withfilteredset. In the filteredset box, enter the name of the event file output, in this case, pn_filt_bkg.fits.
5)
In the ``Spectrum'' tab, 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, bkg_pi.fits. Confirm that withspecranges is checked. Set specchannelmin to 0 and specchannelmax to 20479.
6)
Click ``Run''.

6.6.6 Determine the Spectrum Extraction Areas

The source and background region areas can 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.

To find the source extraction area,

1)
Invoke backscale from the SAS GUI.
2)
In the ``Main'' tab, enter the name of the spectrum, source_pi.fits.
3)
In the ``Effects'' tab, confirm that withbadpixcorr is checked, and enter the event file, pn_filt.fits, in badpixlocation.
4)
Click ``Run''.

Follow the same steps to find the background spectrum extraction area.


6.6.7 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. Pile up and how to deal with it are discussed at length in §6.2.8 and §6.2.9, respectively, and users are strongly encouraged to refer to those sections. Briefly, we deal with it in PN Timing data essentially the same way as in Imaging data, that is, by using only single pixel events, and/or removing the regions with very high count rates, checking the amount of pile up, and repeating until it is no longer a problem.

In our example case, the source is far too faint to be piled up, but it is always a good idea to check anyway.

To check for pile up,

1)
Invoke epatplot in the SAS GUI.
2)
In the ``0'' tab, in the ``set'' text area, enter the name of the event file that was made when the spectrum was extracted, pn_filt_source.fits. If you want 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 pn_epat.ps.
3)
In the ``1'' tab, set ``withbackgroundset'' to yes. In the ``backgroundset'' text area, enter the name of the background event file output when the background spectrum was extracted, pn_filt_bkg.fits.
4)
Click ``Run''.

The output is shown in Fig. 6.17.

Figure 6.17: The output of epatplot.

\includegraphics[scale=0.5]{pn_timing_pileup_gui.ps}


6.6.8 My Timing Mode Data is Piled Up! Now What?

There are a couple ways to deal with pile up. First, you can use event file filtering procedures to include only single pixel events (PATTERN==0), as these events are less sensitive to pile up than other patterns.

You can also excise areas of high count rates, i.e., the boresight column and several columns to either side of it. (This is analogous to removing the inner-most regions of a source in Imaging data.) The spectrum can then be re-extracted and you can continue your analysis on the excised event file. As with Imaging data, 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 pattern distributions agree.

For example, a bright source is shown in Fig. 6.18. We can extract the boresight column and several columns to either side:

1)
Enter the filtering criteria in the ``Selection Expression'' area at the top of the xmmselect window: (FLAG==0) && (RAWX in [28:48])
2)
Click the round button next the PI column on the xmmselect GUI.
3)
Click on ``OGIP Spectrum''.
4)
In the ``General'' tab, check keepfilteroutput and withfilteredset. In the filteredset box, enter the name of the event file output, in this case, pn_filt_source_WithBore.fits.
5)
In the ``Spectrum'' tab, set the file name and binning parameters for the spectrum. Confirm that withspectrumset is checked. Set spectrumset to the output name, source_pi_WithBore.fits. Confirm that withspecranges is checked. Set specchannelmin to 0 and specchannelmax to 20479.
6)
Click ``Run''.

We can do the same for columns with lower count rates to either side of the boresight by following the same steps as above but changing the filtering expression to (FLAG == 0) && (RAWX in [28:48]) &&! (RAWX in [34:41]). We will set the output spectrum file to be source_pi_NoBore.fits, and the output filtered event file to pn_filt_source_NoBore.fits, and check with epatplot as we go along until no pile up remains.

Be aware that reducing pile up in this way means that we will need to use a non-standard way to make the ancillary files (ARFs) for your spectrum! This is discussed further in §6.6.9. We will need the spectra of the full extraction area and the excised area, so we might as well get them now. We already have it for the full extraction area. For the excised area, we will follow the same steps as above, but change the filtering expression to (FLAG == 0) && (RAWX in [34:41]), the output spectrum will be source_pi_Excised.fits and the output event file will be pn_filt_source_Excised.fits.

Figure 6.18: An image of a bright source in PN Timing mode.

\includegraphics[scale=0.5]{Mkn421_timing_image_ds9_gui.eps}


6.6.9 Create the Photon Redistribution Matrix (RMF) and Ancillary File (ARF)

Making the RMF for PN data in Timing mode is exactly the same as in Imaging mode, which is demonstrated in §6.5.11. If the boresight was not excised, making the ARF is the very similar, as well.

To make the RMF,

1)
Invoke the task rmfgen in the SAS GUI.
2)
In the ``Main'' tab, set the spectrumset keyword to the spectrum file name, source_pi.fits. Set the rmfset keyword to the RMF file name, source_rmf.fits.
3)
Click ``Run''.

and to make the ARF,

1)
Invoke the task arfgen in the SAS GUI.
2)
In the ``Main'' tab, set the arfset parameter to the ARF file name, for example, source_arf.fits. Set the spectrumset parameter to the spectrum file name, source_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, pn_filt.fits.
4)
In the ``Calibration'' tab, check the withrmfset box and set the rmfset keyword to the RMF file name, source_rmf.fits.
5)
In the ``Detector Map'' tab, set the type of detector map type to ``psf''.
6)
Click ``Run''.

However, if you had to remove piled up sections, you will need to make an ARF for the full extraction area, another one for the piled up area, and then subtract the two to find the ARF for the non-piled regions. We already have spectra for the full extraction area and the excised area, so we will use them to make the ARFs:

1)
Invoke the task arfgen in the SAS GUI.
2)
In the ``Main'' tab, set the arfset parameter to the output file name, source_arf_WithBore.fits. Set the spectrumset parameter to the spectrum file name, source_pi_WithBore.fits.
3)
In the ``Detector Map'' tab, set the type of detector map type to ``psf''.
4)
Click ``Run''.

We will repeat these four steps to make an ARF for source_pi_Excised.fits, which we will call source_arf_Excised.fits.

Now we can subtract them. This is easily done on the command line:

addarf "source_arf_WithBore.fits source_arf_Excised.fits" "1.0 -1.0" source_arf.fits

At this point, the spectrum is ready to be analyzed, so we can prepare the spectrum for fitting (§6.7).


6.7 Prepare and Fit the Spectrum

With the source and background spectra now extracted and the RMF and ARF created, we will do some simple spectral fitting, using the example data from the EPIC Imaging mode (Lockman Hole, Obs ID 0123700101). SAS does not include fitting software, so HEASoft packages will be used, and all fitting tasks will be called from the command line.

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

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.19 shows the fit to the spectrum.

Figure 6.19: The fitted spectrum of the Lockman Hole source.

\includegraphics[scale=0.5]{mos1-lh-source-spec-fit.ps}


6.8 Timing Analysis

The subpackage Xronos in ftools can be used in general timing analysis of EPIC data (any mode). This section will demonstrate some basic timing analysis using it and the example PN Timing data, Bol 375 (Observation ID 0403530301). More information about Xronos can be found through the ftools website.

We will assume that an appropriate light curve, named pn_ltcrv.fits, has been created, with the paramters timebinsize set to 1 and makeratecolumn set to no. Details on how to make such a light curve can be found in §6.3.2 (for the command line) or §6.6.2 (for the GUI). Note that for many Xronos tasks, though QDP may plot the results, the output file is saved as a FITS file.

First, a light curve can be binned using the Xronos command lcurve. It will be plotted automatically using QDP; just type ``quit'' or ``exit'' to end the session:

lcurve nser=1 cfile1=pn_ltcrv.fits window=- dtnb=INDEF
$   $ nbint=INDEF 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; set to INDEF for default)
nbint - number of bins per interval (set to INDEF for default)
outfile - output file name (FITS format light curve)
plot - plot flag
plotdev - device for plotting output

The output is shown in Fig. 6.20.

Figure 6.20: The light curve as seen in Xronos.

\includegraphics[scale=0.5]{pn_timing_xronos_lc.eps}

The power spectrum density can be found using the command powspec. As with lcurve, the plot is shown automatically in QDP, and ``quit'' or ``exit'' will end the session.

powspec cfile1=pn_ltcrv.fits window=- dtnb=10 nbint=200
$   $ 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; set to INDEF for default)
nbint - number of bins per interval (set to INDEF for default)
nintfm - number of intervals in each power spectrum (set to INDEF for default)
rebin - rebin factor for power spectrum (0 for no rebinning)
plot - plot flag
plotdev - device for plotting
outfile - output file name

The output is shown in Fig. 6.21.

Figure 6.21: The light curve as seen in Xronos.

\includegraphics[scale=0.5]{pn_timing_xronos_powerspec.eps}

We can look for periodicities in the time series using the command efsearch. Once again, this will automatically produce a plot with QDP.

efsearch cfile1=pn_ltcrv.fits 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

We can calculate the auto correlation for an input time series using the command autocor.

autocor cfile1=pn_ltcrv_xronos.fits window=- dtnb=10 nbint=100 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

Numerous statistics can be calculated for an input time series using the command lcstats. The output is written to the screen by default, but by appending ``$>$ output.txt'', the output is sent to the text file output.txt instead.

lcstats cfile1=pn_ltcrv_xronos.fits window=- dtnb=INDEF nbint=INDEF $>$ output.txt

where

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


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.7 for spectral analysis and § 6.8 for temporal analysis.


next up previous contents
Next: 7. An RGS Data Up: XMM ABC Guide Previous: 5. Preparing the Data   Contents
Lynne Valencic 2014-04-17