Spectral analysis of MOS point-like sources

This thread contains a step-by-step recipe to extract MOS spectra of a point-like source, together with the associated response matrices, starting from a calibrated, concatenated event list (file MOS.evt)
  1. set the SAS_ODF environmental variable:
    setenv SAS_ODF /path_to_my_ODF_directory/my_ODF_directory
    
  2. set the SAS_CCF environmental variable (one needs to have already created a Calibration Index File, CIF!)
    setenv SAS_CCF /path_to_my_CIF/ccf.cif
    
    [Be reminded that the variable SAS_CCFPATH needs to be set as well, unless the CIF was generated with the cifbuild option: withccfpath=yes]

  3. extract an image (sky coordinates in this example; extraction in detector - DET[XY] - or raw - RAW[XY] - coordinates is possible as well, and may be preferable for some specific scientific needs)
    evselect table='MOS.evt:EVENTS' imagebinning='binSize' imageset='image.fits' withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=20 yimagebinsize=20
    
  4. display the image
    imgdisplay withimagefile=true imagefile=image.fits
    
  5. select the region, from which the spectrum shall be accumulated, using the Region/Circle in ds9 (see Fig.1)

    SAO DS9 Screen capture

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

  6. double-click with the cursor on the defined region. A window pops-up, showing the properties of the region (Fig.2). Write down the coordinates of the Center (1290,1293.5) and the Radius (20)

    SAO DS9 circle define

    Fig.2: selection region properties window, pop'd-up by double-clicking on the region in the main ds9 window

  7. calculate the center coordinates and the size of the selection region in natural coordinates, by multiplying the numbers derived in the previous step by ximagebinsize and yimagebinsize, In our example:

  8. extract a single event (i.e. pattern zero only), high energy (E > 10 keV) light curve, to identify intervals of flaring particle background
     
    evselect table='MOS.evt:EVENTS' expression='#XMMEA_EM&&(PI>10000)&&(PATTERN==0)' rateset="background_lightcurve.fits" timebinsize=10 withrateset=yes maketimecolumn=yes
    

  9. determine a threshold on the light curve counts, defining "low background" intervals (in our example: 15)

  10. create a Good Time Interval (GTI) file, corresponding to the threshold:
    tabgtigen table=background_lightcurve.fits expression="COUNTS<15" gtiset=background_gti.fits
    
  11. extract a source+background spectrum, using all the selection expressions defined so far
    evselect table="MOS.evt:EVENTS" energycolumn='PI' expression='#XMMEA_EM&&(PATTERN<=12)&>i(background_gti.fits,TIME)&&((X,Y) IN circle(25800,25870,400))' spectrumset=source_spectrum.fits withspectrumset=yes
    
  12. extract a background spectrum (in the following, we assume that it is being extracted from an annulus around the source, of radii 50 to 100 arcseconds)
    evselect table="MOS.evt:EVENTS" energycolumn='PI' expression='#XMMEA_EM&&(PATTERN<=12)&>i(background_gti.fits,TIME)&&((X,Y) IN annulus(25800,25870,500,1000))' spectrumset=background_spectrum.fits withspectrumset=yes
    
  13. generate a redistribution matrix
    rmfgen spectrumset=source_spectrum.fits rmfset=response.rmf
    
  14. generate an ancillary file
    arfgen spectrumset=source_spectrum.fits arfset=ancillary.arf rmfset=response.rmf withrmfset=yes