Extraction of spectra in a few clicks: especget

Introduction

This thread explains how to process spectral data taken with the EPIC cameras using the SAS in a quick, semi-automatic manner.

Expected Outcome

At the end of this thread a spectrum will have been created together with a background file and compatible detector matrices. These will be in a format where they may be used directly in a spectral fitting package such as XSPEC.

SAS Tasks to be Used

Prerequisites

Useful Links

Caveats

Last Reviewed: 02 DECEMBER 2021, for SAS v20.0

Last Updated: 30 October 2014

 


Procedure
 

The SAS task especget has been designed to allow extraction of a source+background and background spectra, a redistribution matrix, and an effective area vector from an EPIC event list with a single command. especget can be launched from the main xmmselect window, in which case an extraction region size optimization algorithm is also ran, which maximizes the signal-to-noise of the net source spectrum. From xmmselect the user is guided by the GUI through the especget steps. This thread illustrates how to use this functionality.

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.

  • Set up your SAS environment (following the SAS Startup Thread)

  • Create an EPIC cleaned and filtered for particle background event file for your observation (see Prerequisites for this thread at the top of the page). Let the name of the filtered file be: EPICclean.fits.

  • Start xmmselect,

      xmmselect table=EPICclean.fits

    The xmmselect call pops-up a window similar to that 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)

  • 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:
     
    • click the square checkbox besides X and Y in the data column xmmselect panel
    • click on Image
    • go the the Image sub-panel in the evselect window (see Fig.2)
    • change at least the file name in the imageset window (e.g. to PNimage.fits if we are using an EPIC-pn event file)
    • click Run
     


    Fig.2: The Image panel in the evselect window

    xmmselect will automatically launch a ds9 window on the created image.

  • Select the region, from which the source+background spectrum shall be accumulated, using the Region/Circle menu in ds9.
    Properties should be set to Source (the green circle on the ds9 window will appear as a solid line)

  • Select the region, from which the background spectrum shall be accumulated, using the Region/Circle menu in ds9.
    Properties should be set to Background (the green circle on the ds9 window will appear as a dashed line)

  • Click the function button OGIP Spectral Products in the main xmmselect window

  • A window pops-up, asking the user for the preferred method to determine the source+background extraction region:
     


    Fig.3: Spectrum extraction region optimization window in especget
     
    • Use optimized region: allows the user to extract the source+background spectrum from a circular region, which maximizes the signal-to-noise ratio. The properties of this optimal region are displayed in the window.
    • Use initial region: allows the user to extract the source+background spectrum from the region initially chosen.
    • Start over: allows the user to start the whole process again, from the definition of spectral extraction regions in the field-of-view image.

  • A current window pops-up, asking for confirmation of the input parameters (see Fig.4). Click Run for producing the spectral products.
     


    Fig.4: Main especget window

    The optimum pattern and event flag selections are set automatically for the detector being used (EPIC-MOS or EPIC-pn). If the expression wants to be changed, it can be done through the Main tag of the especget task.


    Be reminded that xmmselect silently overwrites files with the same name. The choices in Fig.4 are the defaults. It is recommended to change the filestem parameter to a string of user's choice, or write directly the names of your choice. For example:
     

    • EPICsource_spectrum.fits: source+background spectrum
    • EPICbackground_spectrum.fits: background spectrum
    • EPIC.rmf: redistribution matrix
    • EPIC.arf: effective area vector

  • 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 then 3.
     
    • launch the specgroup GUI interface (see Fig.5)

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


    Fig.5: The specgroup launch GUI interface

  • Everything is now ready to fit the grouped spectrum: EPIC_spectrum_grp.fits.

 

Caveats

  • NOTE ON PATTERN SELECTION IN PN SPECTRA:

    For bright sources and sources with narrow lines it might be better to extract two spectra and corresponding backgrounds, response and ancillary files: one set for single pixel events (PATTERN==0) and another set for doubles (PATTERN IN [1:4]).

    Fitting these two spectra simultaneously will show if there are any problems with pile-up (see also SAS task epatplot) and - as the energy resolution for singles is slightly better than the one for doubles - will show the line features at highest energy resolution in the single events spectra.

    However, in case of TIMING mode observations (where the rate of single to double events depends on the source position) one should always create and fit a spectrum of the combined single and double events.