Research & Science Home ESA Public Web Site Sci-Tech Portal      XMM-Newton Public Web Site XMM-Newton Sci-Tech Portal
Astrophysics Missions Planetary Exploration Missions Solar Terrestrial Science Missions Fundamental Physics Missions Science Faculty

Combining the spectra of the 3 EPIC cameras


Introduction

This thread is a step-by-step recipe to combine the spectra of the 3 EPIC cameras into one single spectrum.

Expected Outcome

The thread requires as an input the event lists of the three EPIC cameras as produced by the EPIC SAS reduction meta-tasks (either e[mp]proc or e[mp]chain). In this thread the event lists are called: mos1.evt, mos2.et, and pn.evt, respectively. It is assumed the spectral extraction regions have been defined prior to starting the thread. The thread will first generate spectra for each individual EPIC camera in a common spectral range and with a common binning, together with the associated response files. The spectra and response are then merged together into one single set of merged source+background spectrum, background spectrum, redistribution matrix and effective area vector files.

SAS Tasks to be Used

Prerequisites

Useful Links

This thread makes use of the following LHEASOFT tasks:

Caveats




The thread assumes as starting point calibrated and concatenated event lists for each of the three EPIC cameras. If the user has already generated spectra and response files, s/he can go directly to Step#4. We stress that the algorithm described below works if, and only if, spectra and response files to be merged have been generated in the same PI channel interval, and with the same spectral binning. This condition is fulfilled only if non-default values of the relevant parameters are specified in the corresponding SASv10 tasks.

If this sounds obscure or too complicated, start from Step#1 to stay on the safe side.

Generation of individual camera spectra and responses

  1. For each EPIC camera generate a source+background spectrum in the 0-11999 (eV) PI range, with a common bin size of 5 eV

     evselect table=${camera}.evt expression="${src_exp}" withspectrumset=yes spectrumset=my_src_${camera}.pi \
      spectralbinsize=5 specchannelmin=0 specchannelmax=11999 energycolumn=PI

     backscale spectrumset=my_src_${camera}.pi badpixlocation=${camera}.evt

    where ${src_exp} is a selectlib expression appropriate for the camera and the source (cf., e.g., the MOS [pn] thread on how to extract spectra with SAS), and ${camera} is either one of the following string: mos1, mos2, pn.evt.

  2. For each EPIC camera generate a background spectrum with in the same spectral range and with the same spectral binning as in Step#1 above

     evselect table=${event_list} expression="${bkg_exp}" withspectrumset=yes spectrumset=my_bkg_${camera}.pi
       spectralbinsize=5 specchannelmin=0 specchannelmax=11999 energycolumn=PI

     backscale spectrumset=my_bkg_${camera}.pi badpixlocation=${camera}.evt

    where ${bkg_exp} is the selectlib expression appropriate for the camera and the background.

  3. Generate redistribution matrices and effective areas corresponding to the spectra extracted in Step#1

     rmfgen spectrumset=my_src_${camera}.pi rmfset=my_src_${camera}.rmf withenergybins=yes energymin=0.1 energymax=12.0 nenergybins=2400

     arfgen spectrumset=my_src_${camera}.pi arfset=my_src_${camera}.arf withrmfset=yes rmfset==my_src_${camera}.rmf

  4. Combine the MOS camera source+background spectra

    • Read the BACKSCAL and EXPOSURE keywords from the headers of the spectra files

       fkeypar fitsfile=my_src_mos1.pi+1 keyword=BACKSCAL
       set mos1_backscal = `pget fkeypar value`
       fkeypar fitsfile=my_src_mos1.pi+1 keyword=EXPOSURE
       set mos1_exposure = `pget fkeypar value`
       fkeypar fitsfile=my_src_mos2.pi+1 keyword=BACKSCAL
       set mos2_backscal = `pget fkeypar value`
       fkeypar fitsfile=my_src_mos2+1 keyword=EXPOSURE
       set mos2_exposure = `pget fkeypar value`

    • Employ the average of the exposure time of the individual spectra as exposure time of the combined MOS spectrum

       set mos_exposure = `awk -v e1=${mos1_exposure} -v e2=${mos2_exposure} 'BEGIN {printf"%f", (e1+e2)/2}'

    • Sum the spectra

       mathpha errmeth="Gauss" expr="my_src_mos1.pi+my_src_mos2.pi" units=COUNTS outfil=my_src_mos.pi \
        exposure=${mos_exposure} backscal='NONE' areascal='%' ncomments=0 clobber=yes
       set backscal_sum = `awk -v e1=${mos1_backscal} -v e2=${mos2_backscal} 'BEGIN {printf"%f", e1+e2}'`
       fparkey value=${backscal_sum} fitsfile=my_src_mos.pi+1 keyword=BACKSCAL
       fparkey value=${mos_exposure} fitsfile=my_src_mos.pi+1 keyword=EXPOSURE

  5. Repeat the procedure as in Step#4 for the background spectra

    • Read the BACKSCAL and EXPOSURE keywords from the headers of the spectra files

       fkeypar fitsfile=my_bkg_mos1.pi+1 keyword=BACKSCAL
       set mos1_backscal = `pget fkeypar value`
       fkeypar fitsfile=my_bkg_mos1.pi+1 keyword=EXPOSURE
       set mos1_exposure = `pget fkeypar value`
       fkeypar fitsfile=my_bkg_mos2.pi+1 keyword=BACKSCAL
       set mos2_backscal = `pget fkeypar value`
       fkeypar fitsfile=my_bkg_mos2+1 keyword=EXPOSURE
       set mos2_exposure = `pget fkeypar value`

    • Employ the average of the exposure time of the individual spectra as exposure time of the combined MOS spectrum

       set mos_exposure = `awk -v e1=${mos1_exposure} -v e2=${mos2_exposure} 'BEGIN {printf"%f", (e1+e2)/2}'

    • Sum the spectra

       mathpha errmeth="Gauss" expr="my_bkg_mos1.pi+my_bkg_mos2.pi" units=COUNTS outfil=my_bkg_mos.pi\
        exposure=${mos_exposure} backscal='NONE' areascal='%' ncomments=0 clobber=yes
       set backscal_sum = `awk -v e1=${mos1_backscal} -v e2=${mos2_backscal} 'BEGIN {printf"%f", e1+e2}'`
       fparkey value=${backscal_sum} fitsfile=my_bkg_mos.pi+1 keyword=BACKSCAL
       fparkey value=${mos_exposure} fitsfile=my_bkg_mos.pi+1 keyword=EXPOSURE

  6. Merge the MOS effective areas and redistribution matrices

     marfrmf rmfil=my_src_mos1.rmf arfil=my_src_mos1.arf outfil=my_src_mos1.rsp clobber=yes
     marfrmf rmfil=my_src_mos2.rmf arfil=my_src_mos2.arf outfil=my_src_mos2.rsp clobber=yes

  7. Merge the MOS response matrices with the appropriate weights (their sum has to be 2)

     set arf_norm_1 = `awk -v e1="${mos1_exposure}" -v e2="${mos2_exposure}" 'BEGIN {print (2.0/(1.0+(e2/e1)))}'`
     set arf_norm_2 = `awk -v e1="${mos1_exposure}" -v e2="${mos2_exposure}" 'BEGIN {print ((2.0*(e2/e1))/(1+(e2/e1)))}'`
     addrmf list="my_src_mos1.rsp my_src_mos2.rsp" weights="${arf_norm_1} ${arf_norm_2}" rmffile=my_src_mos.rsp clobber=yes

  8. Repeat Steps#4 to 7 to merge the combined MOS and the pn spectra and response files

A simple C-shell based commented script is made available to perform the above algorithm starting spectra (merging_epic_spectra_fromspectra.csh).

Last Updated: 30 July 2010



Caveats

Users must be careful in using the algorithm and scripts described in this thread, above all with bright sources whose spectral residuals are dominated by systematic errors. An example of the application of this script to real data (the EPIC spectra of the blazar H1426+428, Obs.#0310190101) is shown in Fig.2. The statistical quality of the parameters derived from the merged EPIC spectrum is better than the fit on one individual camera, but still comparable to that obtained by the simultaneous fitting of individual camera spectra, the latter being the rigorously correct procedure. Similar conclusions can be drawn with respect to the measurements of spectral properties of narrow-band features (in Fig.3 the prominent iron Kα fluorescent line in the EPIC spectra of the Circinus Galaxy, Molendi et al., 2003, MNRAS, 343, L1)


Fig.2 - Left panel: residuals in units of data/model ratio when the same photoelectrically absorbed power-law model is applied to the spectra of the blazar H1426+428, Obs.#0310190101. Red: EPIC-pn; Green: EPIC-MOS1; Blue: EPIC-MOS2; Cyan: combined MOS cameras: White: combined EPIC cameras. Right panel: iso-χ2 contour plots when a photoelectrically absorbed model is applied to the same spectra: Red: Simultaneous fit of all the EPIC camera spectra; Green: merged EPIC spectrum.


Fig.3 - Left panel: EPIC spectra of the Circinus Galaxy (Obs.#0111240201). Right panel: iso-χ2 for the Kα fluorescent line centroid energy versus intensity.




   Copyright 2012© European Space Agency. All rights reserved.
This page was last updated on 1 March, 2011.