Analysing EPIC spectra from multi-pointing mode data


If an observation has been made in RGS multi-pointing mode, then the position of the source on the detector changes in each exposure. Ordinarily, the shift between exposures is 15 or 30 arcseconds. In these cases, the SAS needs to find the satellite pointing in each exposure using the attitude file. In particular, the task arfgen, which needs to convert sky coordinates into detector coordinates, needs to be given the attitude file so that it can find the satellite pointing at the time of each exposure.

Expected Outcome

The spectral files and detector matrices should be self-consistent.

SAS Tasks to be Used


Useful Links


Last Reviewed: 25 May 2023, for SAS v21.0

Last Updated: 27 MAY 2019




This thread explains how to correctly analyse EPIC spectra from observations made in multi-pointing mode.


Fig.1: An example of a source observed in multi-pointing mode in the EPIC-pn small window.


  1. Ensure that the environment variable SAS_ODF points to the directory containing the multi-pointing observation. This must include the attitude file for the observation which will have a name like RRRR_OOOOOOOOOO_SCX00000ATS.FIT, where RRRR is the revolution number and OOOOOOOOOO the observation number.
  2. Produce EPIC-pn and EPIC-MOS event files using the SAS task epproc and emproc respectively (see How to reprocess ODFs to generate calibrated and concatenated EPIC event lists). Once done, the procedure to obtain the different sub-pointings is different for EPIC-pn and EPIC-MOS.


    epproc will produce by default an event file per sub-pointing with names of the form RRRR_OOOOOOOOOO_EPN_SXXX_ImagingEvts.ds, where SXXX contain the sub-pointing exposure number. For simplicity in the thread, let the names of these files be PNEvt_subpnt[n].fits, where [n] indicates the pointing number from 1 to 4 corresponding to  -30, -15, 15 and 30 arcseconds shift.


    MOS1 and MOS2 event files produced by emproc have to be separated by hand according to the different sub-pointings as they are all merged in one single event file. Lets assume that the name of the event file, for either MOS1 or MOS2, produced by emproc is MOSEvt.fits. In order to split the event file into the different sub-pointings, these steps have to be followed,

       a) Run the SAS task preqgti

         this task will produce a file called containing information for each sub-pointing included in the odf. In this case, 4 sub-pointings.

       b) Split the event file using evselect,

            evselect table=MOSEvt.fits withfilteredset=Y filteredset=MOSEvt_subpnt[n].fits \
          destruct=Y keepfilteroutput=T \

         where Selection_Expression[n] takes the form (TIME >= START[n] && TIME <= STOP[n]). START[n] and STOP[n] correspond to the start and stop time of pointing [n] and their values can be found in Extension 1 (STDGTI) of the file produced by preqgti in step a.. The filtered event file MOSEvt_subpnt[n].fits will contain those events corresponding to sub-pointing [n].

       c) Since by following this procedure neither the DATE-OBS and DATE-END nor the RA_PNT and DEC_PNT keywords of the sub-pointing are correct in the header of the sub-pointing event files, a special call to attcalc is needed:

       attcalc eventset=MOSEvt_subpnt[n].fits \
          setpnttouser=yes nominalra=RA[n] nominaldec=DEC[n] \

      with this, the different sub-pointing event files get the correct optical axis positions. RA[n] and DEC[n] correspond to the RA and DEC of pointing [n] and their values can be found in Extension 2 (POINTATT) of the file produced by preqgti in step a).

    Steps b) and c) have to be repeated for every sub-pointing included in the odf.


  3. Once all the event files of all the sub-pointings are obtained, if necessary, create EPIC cleaned and filtered for particle background event files for the sub-pointings (see the How to filter EPIC event lists for flaring particle background Thread). Let's assume that the filtered files have names: EPICEvtclean_subpnt[n].fits, where EPIC refers to either PN, MOS1 or MOS2.

  4. Generate EPIC source and background spectra only from each sub-pointing following the steps in the threads How to extract PN spectra of a point-like source and associated matrices or Spectral analysis of MOS point-like sources.
  5. Set the source and background BACKSCAL values.

    The geometrical area used to extract the source and background files needs to be written into the file headers using the attitude file by:

    for EPIC-pn,

          backscale spectrumset=PNSRCSpec_subpnt[n].fits \
          badpixlocation=PNEvt_subpnt[n].fits useodfatt=yes

          backscale spectrumset=PNBKGSpec_subpnt[n].fits \
          badpixlocation=PNEvt_subpnt[n].fits useodfatt=yes


    for EPIC-MOS,

          backscale spectrumset=MOSSRCSpec_subpnt[n].fits \
          badpixlocation=MOSEvt_subpnt[n].fits useodfatt=yes

          backscale spectrumset=MOSBKGSpec_subpnt[n].fits \
          badpixlocation=MOSEvt_subpnt[n].fits useodfatt=yes

  6. Generate an ancillary response file (ARF) for each sub-pointing using the attitude file with a command of the form:

    for EPIC-pn,

          arfgen spectrumset=PNSRCSpec_subpnt[n].fits arfset=PNARF_subpnt[n].arf \
          badpixlocation=PNEvt_subpnt[n].fits useodfatt=yes

    for EPIC-MOS,

         arfgen spectrumset=MOSSRCSpec_subpnt[n].fits arfset=MOSARF_subpnt[n].arf \
         badpixlocation=MOSEvt_subpnt[n].fits useodfatt=yes

    where EPICSRCSpec_subpnt[n].fits is the source spectrum for pointing [n], and EPICARF_subpnt[n].arf the output ARF file. The important aspect in this calle id the use of useodfatt=yes when generating the ARF.
  7. Generate a redistribution file for each exposure with the command:

         rmfgen spectrumset=[PN,MOS]SRCSpec_subpnt[n].fits rmfset=[PN,MOS]RMF_subpnt[n].rmf
  8. Rebin the spectrum and link associated files. In the following example the spectrum is rebinned in order to have at least 25 counts for each background-subtracted spectral channel and not to oversample the intrinsic energy resolution by a factor larger than 3.

          specgroup spectrumset=[PN,MOS]SRCSpec_subpnt[n].fits mincounts=25 oversample=3 \
         rmfset=[PN,MOS]RMF_subpnt[n].rmf arfset=[PN,MOS]ARF_subpnt[n].arf \
         backgndset=[PN,MOS]BKGSpec_subpnt[n].fits groupedset=[PN,MOS]_spectrum_grp_subpnt[n].fits

    The rebinning options shown in the example above, are by no means the only possible binning available, or the recommended one, more binning options are available in the description of the task specgroup.

  9. Fit the grouped spectrum: EPIC_spectrum_grp_subpnt[n].fits


arfgen takes the satellite pointing information from the first record in the attitude file which falls within the time range of the exposure used to make the spectrum, i.e. between the times in the header keywords DATE-OBS and DATE-END. Usually this will be fine, but very occasionally the satellite will still be moving to the target when the observation starts and the attitude reconstruction within arfgen will not quite be right.