Combining the spectra of the 3 EPIC cameras

Introduction

This thread is a step-by-step recipe to combine the spectra of a given number of EPIC camera exposures into one single spectrum with corresponding rmf, arf and bkg files.

Expected Outcome

The thread requires as input a set of spectral files from a given number of EPIC exposures. In this thread the source, background, response and effective area files are called: src_spectrum_#.ds, bkg_spectrum_#.ds, response_#.rmf and arf_#.arf, where # is used to indicate the spectrum set corresponding to a given EPIC exposure. It is assumed that the sets of spectral files have been produced prior to starting this thread. This thread shows how spectra and response files are merged together into one single set. The output of this thread is a merged source+background spectrum, background spectrum, redistribution matrix and effective area files.

SAS Tasks to be Used

Prerequisites

Useful Links

Caveats

Last Reviewed: 4 june 2019, for SAS v18.0

Last Updated: 27 may 2019

 


Procedure
 

This thread assumes as starting point one set of spectral files for each one of the EPIC exposures that are going to be merged. For each EPIC exposure, a spectral set is made out of source+background spectrum, background spectrum, response and effective area files.

We stress that the algorithm employed by epicspeccombine 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 tasks used to generate spectra (for source+background and background spectra).

If this sounds obscure or too complicated, check the example which starts from Step#1 in how to generate these files to stay on the safe side. If not, escape Step#1-Step#3.

 

Generation of individual exposure spectra and responses
 

The following three steps have to be repeated for every single spectral set to be generated.

  1. For each EPIC exposure generate a source+background spectrum in the 0-11999 (eV) PI range, with a common bin size of 5 eV. It is important to check withspecranges and use the following spectral bin range, specchannelmin=0 and specchannelmax=11999, to accumulate the spectrum (see caveats).
     

     evselect table=Events_01.evt expression="${src_exp}" \
      withspectrumset=yes spectrumset=src_spectrum_01.ds \
      spectralbinsize=5 specchannelmin=0 specchannelmax=11999 energycolumn=PI

     backscale spectrumset=src_spectrum_01.ds badpixlocation=Events_01.evt

    where ${src_exp} is a selectlib expression appropriate for the camera and source of interest (cf., e.g., the MOS [pn] thread on how to extract spectra with SAS).

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

     evselect table=Events_01.evt expression="${bkg_exp}" \
       withspectrumset=yes spectrumset=bkg_spectrum_01.ds \
       spectralbinsize=5 specchannelmin=0 specchannelmax=11999 energycolumn=PI

     backscale spectrumset=bkg_spectrum_01.ds badpixlocation=Events_01.evt

    where ${bkg_exp} is the selectlib expression appropriate to select the background for the source of interest.

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

     rmfgen spectrumset=src_spectrum_01.ds rmfset=response_01.rmf \
       withenergybins=yes energymin=0.1 energymax=12.0 nenergybins=2400

     arfgen spectrumset=src_spectrum_01.ds arfset=arf_01.arf withrmfset=yes rmfset=response_01.rmf

    for pn, rmfgen should be run with the parameter acceptchanrange=yes so that the non-standard spectral channel range used to produced the spectrum in Step#1 is accepted.

In Step#1-Step#3 a set of spectral files has been generated for a given EPIC exposure, 01 in this example: src_spectrum_01.ds, bkg_spectrum_01.ds, response_01.rmf and arf_01.arf. Follow the same process to generate a spectral set for the rest of the EPIC exposures to be combined.

 

Combine the EPIC camera exposures spectra
 

For the purpose of this thread, lets assume that we have three EPIC exposures (01, 02, 03). This can be in any combination of pn or MOS camera exposures from the same or from different ODFs.

The call to epicspeccombine would look like this,

 epicspeccombine pha="src_spectrum_01.ds src_spectrum_02.ds src_spectrum_03.ds"\
   bkg="bkg_spectrum_01.ds bkg_spectrum_02.ds bkg_spectrum_03.ds" \
   rmf="response_01.rmf response_02.rmf response_03.rmf" \
   arf="arf_01.arf arf_02.arf arf_03.arf" \
   filepha = "src_spectrum_grp.ds" \
   filebkg = "bkg_spectrum_grp.ds" \
   filersp = "response_grp.rmf"

Where the three output files, src_spectrum_grp.ds, bkg_spectrum_grp.ds and response_grp.rmf correspond to the merged spectrum. The input response matrix and effective area files are now combined in a single response matrix, response_grp.rmf, hence, no arf file is generated for the merged spectrum. These files are ready to be loaded in packages like xspec.

Further grouping of the spectral files is not possible with, for example, the SAS task specgroup, since the camera information needed for the grouping is no longer relevant in a merged spectrum. Grouping is only possible in spectra of single instruments.

Last, fit the merged spectrum.


 

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.


To extract a spectrum, withspecranges must be checked (set to yes), with specchannelmin set to 0, and specchannelmax set to 11999. It is important to use this PI range. Selecting a spectrum with a non-standard PI range results in wrong response matrices with an impact on any spectral results derived when using them. If a spectrum needs to be generated within a given energy range, this must be done through the selection expression and not by changing the PI range through specchannelmin and specchannelmax.

An alternative method to producing the merge spectrum files is the use of the task multiespecget. This tasks starts with the event files and will produce the files, src_spectrum_grp.ds, bkg_spectrum_grp.ds and response_grp.rmf corresponding to the merged spectrum. multiespecget should be run in this case with withmultiEPICspec=yes.