skip to content
 
XMM-Newton Guest Observer Facility

THE XMM-NEWTON ABC GUIDE, STREAMLINED

EPIC (IMAGING mode), Hera Parameter Window


Contents


Prepare the Data
Reprocess the Data
Make a Light Curve
Apply Standard Filters
Apply Time Filters
Source Detection
Make an Exposure Map
Extract the Source and Background Spectra
Determine the Spectrum Extraction Areas
Check for Pile Up
My Observation is Piled Up! Now What?
Create the Photon Redistribution Matrix (RMF) and Ancillary File (ARF)

Prepare the Data

Please note that the two tasks in this section (cifbuild and odfingest) must be run in the ODF directory. These are the only tasks with that requirement, and after this section, we will work exclusively in our reprocessing directory.

Many SAS tasks require calibration information from the Calibration Access Layer (CAL). Relevant files are accessed from the set of Current Calibration File (CCF) data using a CCF Index File (CIF). To make the ccf.cif file, navigate into the ODF directory using the icons in the User Account Window of the Hera interface. Then, in the Tool Parameter Window, in the Task Name box, enter cifbuild and click "Get".

The task odfingest extends the Observation Data File (ODF) summary file with data extracted from the instrument housekeeping data files and the calibration database. It is only necessary to run it once on any dataset, and will cause problems if it is run a second time. If for some reason odfingest must be rerun, you must first delete the earlier file it produced. This file largely follows the standard XMM naming convention, but has SUM.SAS appended to it. To run odfingest, in the Tool Parameter Window, in the Task Name box, enter odfingest and click "Change".

Hera automatically resets the relevant environmental parameters to the output of these tasks, so we can continue merrily on our way.

Reprocess the Data

To reprocess the data, go up one directory in the tree and make a new working directory using the buttons in the upper left corner of the User Account Window. When you are in the working directory, call either emchain or emproc for MOS data, and epproc for PN data. (Due to security concerns, epchain is disabled.) As in the previous section, just enter the task name in Task Name box and click "Change".

By default, none of these tasks keep any intermediate files they generate. Emchain maintains the usual naming convention. Emproc and epproc designate their output event files with "ImagingEvts.ds". In any case, it is convenient to rename them something easy to type; this can be done by clicking on the pen icon next to the file name in the User Account Window. We'll assume the new name for the MOS1 event file is mos1.fits.

Make a Light Curve

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 across the entire bandpass.

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.

To determine if our observation is affected by background flaring, we can make a light curve by entering evselect into the Task Name box and clicking "Change". Then,

  1. By the table parameter, use the Browse button to select the event file, mos1.fits.
  2. Set withrateset to yes. This will make the parameters that are relevant specifically to making a light curve appear.
  3. Set maketimecolumn to yes, set timebinsize to 100, and enter an output file name in rateset. We will use mos1_ltcrv.fits.
  4. Click "Run evselect".

The output file mos1_ltcrv.fits can be viewed by downloading and displaying it with fv on your local machine.

   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). Selecting PLOT from this row will let you choose the column name and axis on which to plot it. The light curve is shown in Figure 1.

Figure 1: The Lockman Hole light curve.

Apply Standard Filters

The standard 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 you are going to extract a spectrum from the PN data, you will need the most stringent filters in order to get a high-quality spectrum:

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

For the MOS, the standard filters should be appropriate for most cases.

The first two expressions will select good events with PATTERN in the 0 to 12 range (or the 0 to 4 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.

To filter the data, enter evselect into the Task Name box and click "Change". Then,

  1. By the table parameter, use the Browse button to select the event file, mos1.fits.
  2. Set keepfilteroutput to yes. This will make the parameters that are relevant specifically to filtering a file appear.
  3. Set withfilteredset to yes. Enter an output file name in filteredset, mos1_filt.fits. In the expression parameter box, enter (PATTERN <= 12) && (PI in [200:12000]) && #XMMEA_EM
  4. Click "Run evselect".

Apply Time Filters

Taking a look at the light curve, we can see that there is a very large flare toward the end of the observation and two much smaller ones in the middle of the exposure.

There are several ways to filter an event file: on TIME, with an explicit reference to the TIME parameter in the filtering expression or by creating a secondary Good Time Interval (GTI) file, or on RATE, which requires making a new GTI file. New GTI files are easily made with the task tabgtigen or gtibuild. These are discussed in detail below. Any of these methods will produce a cleaned file, so which one to use is a matter of the user's preference. The file can be viewed via Hera with the js9 application or by downloading it and viewing it locally with ds9. An image of the MOS1 events file with both the standard and time filters applied is shown in Figure 2.

Filter on RATE With tabgtigen

Examining the light curve shows us that during non-flare times, the count rate is quite low, about 1.3 ct/s, with a small increase at 7.3223e7 seconds to about 6 ct/s. We can use that to generate the GTI file and apply it. Enter tabgtigen into the Task Name box and click "Change". Then,

  1. By the table parameter, use the Browse button to select the light curve, mos1_ltcrv.fits.
  2. Enter an output file name in gtiset. We will use gtiset.fits. In the expression parameter box, enter RATE<=6.
  3. Click "Run tabgtigen".

and apply the new GTI file with evselect:

  1. By the table parameter, use the Browse button to select the filtered event file, mos1_filt.fits.
  2. Set keepfilteroutput to yes. This will make the parameters that are relevant specifically to filtering a file appear. Set withfilteredset to yes.
  3. Enter an output file name in filteredset. We will use mos1_filtered_time.fits. In the expression parameter box, enter GTI(gtiset.fits,TIME)
  4. Click "Run evselect".

Filter on TIME With tabgtigen

Alternatively, we could have chosen to make a new GTI file by noting the times of the flaring in the light curve and using that as a filtering parameter. The big flare starts around 7.32276e7 s, and the smaller ones are at 7.32119e7 s and 7.32205e7 s. The expression to remove these would be (TIME <= 73227600)&&!(TIME IN [7.32118e7:7.3212e7])&&!(TIME IN [7.32204e7:7.32206e7]). The syntax &&(TIME < 73227600) includes only events with times less than 73227600, and the "!" symbol stands for the logical "not", so use &&!(TIME in [7.32118e7:7.3212e7]) to exclude events in that time interval. So in the tabgtigen parameter window,

  1. By the table parameter, use the Browse button to select the light curve, mos1_ltcrv.fits.
  2. Enter an output file name in gtiset. We will use gtiset.fits. In the expression parameter box, enter (TIME <= 73227600)&&!(TIME IN [7.32118e7:7.3212e7])&&!(TIME IN [7.32204e7:7.32206e7]).
  3. Click "Run tabgtigen".

and apply the new GTI file with evselect:

  1. By the table parameter, use the Browse button to select the filtered event file, mos1_filt.fits.
  2. Set keepfilteroutput to yes. This will make the parameters that are relevant specifically to filtering a file appear. Set withfilteredset to yes.
  3. Enter an output file name in filteredset. We will use mos1_filtered_time.fits. In the expression parameter box, enter GTI(gtiset.fits,TIME)
  4. Click "Run evselect".

Filter on TIME With gtibuild

This method requires a text file as input. In the first two columns, enter the start and end times (in seconds) that you are interested in, and in the third column, indicate with either a + or - sign whether that region should be kept or removed. Each good (or bad) time interval should get its own line. Please note that due to security restrictions, comments are not supported. In the example case, we would write in our ASCII file (named gti.txt):

   0 73227600 +          
   7.32118e7 7.3212e7 -  
   7.32204e7 7.32206e7 - 

and proceed to gtibuild and evselect. In the gtibuild parameter window,

  1. By the file parameter, enter the name of the text file, gti.txt. By the table parameter, enter the output file name, gtiset.fits.
  2. Click "Run gtibuild".

and apply the new GTI file with evselect:

  1. By the table parameter, use the Browse button to select the filtered event file, mos1_filt.fits.
  2. Set keepfilteroutput to yes. This will make the parameters that are relevant specifically to filtering a file appear. Set withfilteredset to yes.
  3. Enter an output file name in filteredset. We will use mos1_filtered_time.fits. In the expression parameter box, enter GTI(gtiset.fits,TIME)
  4. Click "Run evselect".

Filter on TIME By Explicit Reference

Finally, we could have chosen to forgo using a secondary GTI file altogether, and simply filtered on TIME with the standard filtering expression. In that case, the full filtering expression would be:

   (PATTERN <= 12) && (PI in [200:12000]) && #XMMEA_EM &&
      (TIME <= 73227600) &&!(TIME IN [7.32118e7:7.3212e7])&&!(TIME IN [7.32204e7:7.32206e7])
This expression can then be used to filter the original event file, or only the time requirements can be used to filter the file that has already had the standard filters applied.
Figure 2: The filtered MOS1 event file.

Source Detection

The edetect_chain task does nearly all the work involved with EPIC source detection. It can process up to three intruments (both MOS cameras and the PN) with up to five images in different energy bands simultaneously. All images must have identical binning and WCS keywords. For this example, we will perform source detection 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) using the filtered event files produced here. Edetect_chain has many parameters that users might want to edit, such as detection likelihood threshold; more information about them can be found here.

We will start by generating some files that edetect_chain needs: an attitude file and images of the sources in the desired energy bands, with the image binning sizes as needed according to the detector. For the MOS, we'll let the binsize be 22.

First, the attitude file. Enter atthkgen into the Task Name box and click "Change". Then,

  1. Enter an output file name in atthkset. We will use attitude.fits.
  2. Click "Run atthkgen".

Next, make the soft and hard X-ray images. Enter evselect into the Task Name box and click "Change". Then,

  1. By the table parameter, use the Browse button to select the event file, mos1_filt_time.fits.
  2. Set withimageset to yes. This will make parameters that are specific to making an image appear.
  3. Enter an output file name in imageset. We will use mos1-s.fits. Set xcolumn to X and ycolumn to Y. In the expression parameter box, enter (FLAG == 0)&&(PI in [300:2000]).
  4. Set imagebinning to binSize, ximagebinsize to 22, yimagebinsize to 22.
  5. Click "Run evselect".

Follow the same procedure to make the hard X-ray image, changing the output name to mos1-h.fits and the filtering expression to (FLAG == 0)&&(PI in [2000:10000]).

Now we can run edetect_chain. Enter edetect_chain into the Task Name box and click "Change". Then,

  1. Set imagesets to the names of the images, separated by a space, mos1-s.fits mos1-h.fits. Set eventsets to the event file, mos1_filt_time.fits. Confirm that attitudeset is set to attitude.fits. Enter the lower PI values from the images in the parameter pimin, separated by a space: 300 2000. Do the same for the higher PI values in pimax: 2000 10000.
  2. In the ecf box, enter the energy conversion factors that are appropriate for each band. Here, we will use 0.878 0.220.
  3. Click "Run edetect_chain".

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

The task srcdisplay can be used to produce a region file for the sources (ignore the error messages.) This can be downloaded and overlayed on the event file with ds9. To make one for the soft image, enter srcdisplay in the Task Name box and click "Change". Then,

  1. Set boxlistset to one of the outputs of edetect_chain, emllist.fits. Set imageset to mos1-s.fits and withregionfile to yes. In regionfile, enter the name of the output file. We will use regionfile.txt.
  2. Click "Run srcdisplay".

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

Figure 3: The filtered MOS1 image with detected sources.

Make an Exposure Map

Prior to making an exposure map, you will need to make an image in the energy band you are interested in. You will also need the attitude file from atthkgen (we'll just use the one we made before.) Let's say that we're interested in the 1-2 keV band. To make the image, enter evselect in the Task Name box and click "Change". Then,
  1. By the table parameter, use the Browse button to select the event file, mos1_filt_time.fits.
  2. Set withimageset to yes. This will make parameters that are specific to making an image appear.
  3. Enter an output file name in imageset. We will use mos1_1-2keV.fits. Set xcolumn to X and ycolumn to Y. In the expression parameter box, enter (PI in [1000:2000]). Set imagebinning to binSize, ximagebinsize to 22, and yimagebinsize to 22.
  4. Click "Run evselect".

Now we can run eexpmap. Enter eexpmap in the Task Name box and click "Change". Then,

  1. By the imageset parameter, use the Browse button to select the image, mos1_1-2keV.fits. Confirm that the attitudeset parameter is set to attitude.fits. By the eventset parameter, use the Browse button to select the event file, mos1_filt_time.fits. Enter an output file name in expimageset. We will use mos1_expmap_1-2keV.fits. Enter the lower PI value from the image in the parameter pimin,1000. Do the same for the higher PI value in the parameter pimax, 2000.
  2. Click "Run eexpmap".

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 -- this is the default -- or 20479 for the PN. This parameter can be seen by setting withspecranges to yes. Also, as mentioned before, the most stringent filters, (FLAG==0)&&(PATTERN<=4), must be included in the expression to get a high-quality spectrum for the PN, if you have not already filtered on this.

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.

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

      ds9 mos1_filt_time.fits & 
Select the object whose spectrum you wish to extract and resize as desired. For this example, we will choose the source at (26188.5,22816.5) and set the extraction radius to 300 (in physical units). To extract the source spectrum, enter evselect in the Task Name box and click "Change". Then,

  1. By the table parameter, use the Browse button to select the event file, mos1_filt_time.fits.
  2. Set keepfilteroutput, withfilteredset, and withspectrumset to yes. This will make parameters that are specific to filtering an event file and extracting a spectrum appear.
  3. Enter an event file output name in filteredset. We will use mos1_filtered.fits. Enter a spectrum output file name in spectrumset. We will use mos1_pi.fits. Set energycolumn to PI. In the expression parameter box, enter (X,Y) in CIRCLE(26188.5,22816.5,300).
  4. Click "Run evselect".

Follow the same procedure to make the background spectrum, which we will extract from an annulus around the source, changing the output event file to bkg_filtered.fits, the spectrum file to bkg_pi.fits, and the filtering expresssion to ((X,Y) in CIRCLE(26188.5,22816.5,1500))&&!((X,Y) in CIRCLE(26188.5,22816.5,500)).

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, enter backscale in the Task Name box and click "Change". Then,

  1. By the spectrumset parameter, use the Browse button to select the spectrum, mos1_pi.fits. By the badpixlocation parameter, use the Browse button to select the event file, mos1_filt_time.fits.
  2. Click "Run backscale".
Follow the same procedure for the background spectrum, setting spectrumset to bkg_pi.fits.

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

To check for pile up in our Lockman Hole example, enter epatplot in the Task Name box and click "Change". Then,

  1. By the set parameter, use the Browse button to select the event file mos1_filtered.fits. Set useplotfile to yes and enter the output postscript file name in the plotfile parameter; we will use mos1_epat.ps. Set withbackgroundset to yes and next to the backgroundset parameter, use the Browse button to enter the event file bkg_filtered.fits.
  2. Click "Run epatplot".

The output of epatplot is a postscript file, mos1_epat.ps, which may be downloaded and viewed with gv, containing two graphs describing the distribution of counts as a function of PI channel, as seen in Figure 4 (left).

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-σ 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. For comparison, an example of a bright source (from a different observation) which is strongly affected by pileup is shown in Figure 4 (right). 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.

Figure 4. Left: The output of epatplot for a very faint source without pileup. (Note that in the lower plot, there are too few X-rays for epatplot to model.) Right: 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 ~ 1000 eV.

My Observation is Piled Up! Now What?

If you're working with a different (much brighter) dataset that does show signs of pile up, there are a few ways to deal with it. 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.

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

Now that a source spectrum has been extracted, we need to reformat the detector response by making a redistribution matrix file (RMF) and ancillary response file (ARF). To make the RMF, enter rmfgen in the Task Name box and click "Change". Then,

  1. Set the rmfset parameter to the output file name. We will use mos1_rmf.fits.
  2. By the spectrumset parameter, use the Browse button to select the spectrum file, mos1_pi.fits.
  3. Click "Run rmfgen".

Please note that rmfgen can take several minutes (~10) to run.

Now use the RMF, spectrum, and event file to make the ancillary file. Enter arfgen in the Task Name box and click "Change". Then,

  1. By the spectrumset parameter, use the Browse button to select the spectrum file, mos1_pi.fits.
  2. Set withrmfset to yes, and by the rmfset parameter, use the Browse button to select the RMF file, mos1_rmf.fits. Set arfset to the output file name; we will use mos1_arf.fits. By badpixlocation, use the Browse button to select the event file, mos1_filt_time.fits.
  3. Click "Run arfgen".

The spectrum can be fit using HEASoft or CIAO packages, as SAS does not include fitting software.


If you have any questions concerning XMM-Newton send e-mail to xmmhelp@lists.nasa.gov

This file was last modified on Tuesday, 19-Nov-2013 17:08:40 EST
Curator:Michael Arida (ADNET); michael.arida@nasa.gov

NASA Astrophysics

  • FAQ/Comments/Feedback
  • Education Resources
  • Download Adobe Acrobat
  • A service of the Astrophysics Science Division (ASD) at NASA/ GSFC

    XMM-Newton Project Scientist: Dr. Steve Snowden

    Responsible NASA Official: Phil Newman

    Privacy Policy and Important Notices.