How to extract MOS spectra of a point-like source and associated matrices using the SAS GUI

Introduction

This thread describes how to extract the spectrum of a point-like source observed with the MOS cameras using the SAS Graphical User Interface (GUI)

Expected Outcome

The final outcome of this thread is the standard suite of spectral products required by spectral analysis packages such as XSPEC:

  • A source+background (commonly referred to as "source") spectrum
  • A background spectrum
  • A redistribution matrix (commonly referred to as a "RMF" file)
  • An effective area vector (commonly referred to as an "ARF" file)

SAS Tasks to be Used

Prerequisites

Useful Links

This thread makes use of the image display software ds9.

Caveats

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

Last Updated: 24 MAY 2022


Procedure

 

This thread contains a step-by-step recipe to extract MOS spectra of a point-like source observed in Imaging mode and to create the associated response matrices, starting from a calibrated, concatenated event list (either produced with emproc or available as PPS product; here it bears the file name MOS.evt). The content of this thread is the same as the thread to extract MOS spectra for point-like sources (command-line version). Here, however, the extraction of scientific products is being done using the SAS task xmmselect. This is a user-friendly, graphical interface to the SAS extractor (evselect), which allows you to create a wide range of scientific products (images and pseudo-images, time series, spectra, histograms), and screen the data prior to any product accumulations. xmmselect takes advantage of the full integration between SAS and plotting tools such as grace and ds9, to define data selection regions on a 1-D (light curve) or 2-D (image) plane.

  1. Set up your SAS environment (following the SAS startup Thread).

  2. If necessary, create a MOS cleaned and filtered for particle background event file for your observation (see the How to filter EPIC event lists for flaring particle background Thread). Let's assume that a filtered file has been created, with name: MOSclean.fits

  3. Start xmmselect

     xmmselect table=MOSclean.fits &

    First a window pops-up, asking if you wish to visualise the "[...] selection expression [...]" corresponding to "[...] data subspace information [...]". In practise, xmmselect is asking you if you wish to see the data screening expression, which was employed to generate the event list. The answer to this question does not affect the following steps.

    The xmmselect call pops-up a window as shown in Fig.1.
     


    Fig.1: The main xmmselect window


    In this window, we identify:
     
    • a data screening widget (top)
    • a data column panel (middle)
    • the buttons 1D region and 2D region, which allow to translate selection expression defined in a grace or ds9 window, respectively, into proper selectlib expressions
    • "action" buttons (bottom)

  4. Extract an image (sky coordinates in this example; extraction in detector - DET[XY] - coordinates is possible as well, and may be preferable for some specific scientific needs). This is accomplished by:
     
    • in the data screening widget use: (PATTERN<=12)
    • clicking the square check-box besides X and Y in the data column xmmselect panel
    • click on Image
    • go to the Image sub-panel in the evselect window (see Fig.2)
    • change at least the file name in the imageset window (e.g. to MOSimage.fits)
    • click Run
     


    Fig.2: The Image panel in the evselect window


    xmmselect will automatically launch a ds9 window on the created image

  5. Select the region, from which the spectrum shall be accumulated, using the Regions/Shape/Circle in ds9 (see Fig.3)
     

    Fig.3: ds9 main window. A circular region (green circle) has been defined using the highlighted menu.

  6. Propagate the selected region into the xmmselect data screening panel, by clicking the 2D region button

  7. Extract a source spectrum, using selection expressions defined so far, and restricting the patterns to single and doubles. It is important to check withspecranges and use the following spectral bin range, specchannelmin=0 and specchannelmax=11999, to accumulate the spectrum (see caveats):
     
    • click the radio button close to PI in the data column xmmselect panel
    • click OGIP Spectrum
    • go to the Spectrum sub-panel in the evselect window (see Fig.4)
    • define the binning parameters:
      • withspectrumset active
      • spectrumset=MOSsource_spectrum.fits
      • spectralbinsize=5
      • withspecranges active
      • specchannelmin=0
      • specchannelmax=11999
    • click Run

    xmmselect launches automatically a grace window, displaying the output spectrum.
     

    Fig.4: The Spectrum panel in the evselect window

  8. Extract a background spectrum using the same steps 2. to 4. above. Have a look at the "EPIC status of calibration and data analysis" document (XMM-SOC-CAL-TN-0018) for latest recommendations on how to select source and background regions. In the following, we assume that the background is extracted from a source-free region on the same CCD and at roughly the same off-axis angle as the source under investigation.

    If you are interested in learning how to extract the background spectra from blank sky event lists, please go to the How to extract background spectra from blank fields event lists thread.

  9. Quit xmmselect

  10. Generate a redistribution matrix

    Currently there are two possible approaches:

    a) use the SAS task rmfgen to create a redistribution matrix for your previously extracted spectrum:
     
    • rmfgen -d. The GUI launch interface will appear (see Fig.5)
    • define the following quantities:
      • spectrumset=MOSsource_spectrum.fits
      • rmfset=MOS.rmf

    NOTE: This can take long (>30 min) on low-performance computers...
     

    Fig.5: The rmfgen launch GUI interface

    b) use the ready-made (canned) response matrices.
     

  11. Generate an ancillary file (for extended sources use extendedsource=yes detmaptype=flat or dataset)

    NOTE: arfgen reads in the pattern range from the Data Sub Space (DSS) information in the spectrum dataset, and accumulates the quantum efficiency curves over those patterns, which is then combined to the other constituents of the ARF. Be aware that the entire range of allowed patterns are assumed if no pattern range is found in the DSS.
     
    • launch the arfgen GUI interface (see Fig.6)

       arfgen -d

    • define the following parameters
       
      • spectrumset=MOSsource_spectrum.fits
      • arfset=MOS.arf
      • withrmfset=yes (on calibration panel)
      • rmfset=MOS.rmf (on calibration panel)
      • badpixlocation=MOS.evt (on effects panel)
      • detmaptype=psf (on detector map panel)
     

    Fig.6: The arfgen launch GUI interface
     
    As of SAS 20.0, a new correction is available through the arfgen call to align the MOS and NuSTAR spectral shapes better (see Caveats).
    ​​​
  12. 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.
     
    • launch the specgroup GUI interface (see Fig.7)

       specgroup -d
       
    • define the following parameters
       
      • spectrumset=MOSsource_spectrum.fits
      • groupedset=MOS_spectrum_grp.fits
      • backgndset=yes
      • backgndset=MOSbackground_spectrum.fits
      • withCounts=yes
      • mincounts=25
      • withoversampling=yes (on panel 1)
      • oversample=3(on panel 1)
      • witharfset=yes (on panel 2)
      • arfset=MOS.arf (on panel 2)
      • withrmfset=yes (on panel 2)
      • rmfset=MOS.rmf (on panel 2)
     

    Fig.7: The specgroup launch GUI interface
     

    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.


  13. Fit the grouped spectrum: MOS_spectrum_grp.fits


Caveats

As of SAS 20.0 a new keyword applyabsfluxcorr is available, which will provide corrections to the effective area removing residuals between simultaneous fits of MOS and NuSTAR observations. The correction is based on simultaneous calibration observations between both observatories. These corrections are intended to align the MOS spectral shape better with the spectra from NuSTAR. Details on the corrections can be found in the corresponding release note, XMM-CCF-REL-388. Note that the correction should be applied to both PN and MOS effective areas to retain the cross-calibration between these instruments.

A further correction, the CORRAREA correction, can be applied to MOS effective areas via applyxcaladjustment=yes in arfgen. This correction is an empirical MOS-to-PN effective area correction that is described in the corresponding CN release note, XMM-CCF-REL-382. Both corrections, applyabsfluxcorr and applyxcaladjustment can be used independently of each other, or they can be combined.

To extract a spectrum, withspecranges must be checked (set to yes), with specchannelmin set to 0, and specchannelmax set to 11999 for the MOS. 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.

In general the user should use PATTERN 0-12. However, PATTERN 0 events can be used to minimise the effects of pile-up in bright sources and for sources in which the best-possible spectral resolution is crucial.

In case of MOS Timing mode observations, PATTERN 0 should only be selected for the source, and PATTERN 0,1,3 for the background spectra extracted from the outer CCDs. For details and the latest recommendations, see XMM-SOC-CAL-TN-0018.