EPIC source finding thread: edetect_chain

Introduction

This tread shows how to produce optimally background-filtered images in five energy bands (from a MOS camera event list in the example), and apply on them the source detection meta-task edetect_chain.

Expected Outcome

Besides the optimally background-filtered images and the associated background light curves, users will be able to generate a single list of the detected sources, as well as a number of associated products such as background and sensitivity maps.

SAS Tasks to be Used

Prerequisites

Useful Links

This thread makes use of the image display and analysis package ds9.

Caveats

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

Last Updated: 16 January 2017

 


Procedure
 

This thread contains a step-by-step recipe to perform a simultaneous EPIC sources searching on 5 images extracted in the 0.2-0.5 keV, 0.5-1 keV, 1-2 keV, 2-4.5 keV, 4.5-12 keV energy bands, respectively. This thread illustrates the usage of the SAS source detection script edetect_chain, which automatically runs all the steps of the detection source algorithm with one single command. Users interested in performing individually each step of the same algorithm may refer to the EPIC source detection step-by-step thread.

For symplicity, we assume in this thread that the event files of the EPIC cameras bear the generic names: MOS1.evt, MOS2.evt, and PN.evt, and the attitude file, AttHk.ds.

Now the thread:

  1. set up your SAS environment (following the SAS start-up thread)
     
  2. Create EPIC calibrated event list (see How to reprocess ODFs to generate calibrated and concatenated EPIC event lists)
     
  3. If necessary, create pn and MOS cleaned and filtered for particle background event files for your observation (see  How to filter EPIC event lists for flaring particle background). Let's assume that filtered files have been created, with names: MOS1clean.fits, MOS2clean.fits and PNclean.fits.
     
  4. Produce images for MOS1 in 5 energy bands and from the whole spectral coverage,

    evselect table=MOS1clean.fits:EVENTS imagebinning='binSize' imageset='m1_image_full.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [200:12000])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS1clean.fits:EVENTS  imagebinning='binSize' imageset='m1_image_b1.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [200:500])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS1clean.fits:EVENTS  imagebinning='binSize' imageset='m1_image_b2.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [500:1000])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS1clean.fits:EVENTS  imagebinning='binSize' imageset='m1_image_b3.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [1000:2000])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS1clean.fits:EVENTS  imagebinning='binSize' imageset='m1_image_b4.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [2000:4500])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS1clean.fits:EVENTS  imagebinning='binSize' imageset='m1_image_b5.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [4500:12000])&&(PATTERN in [0:12])&&(FLAG==0)'

     
  5. Check the quality of the images, e.g.

    ds9 m1_image_b3.fits
     

     
  6. Produce images for MOS2 in 5 energy bands and from the whole spectral coverage,

    evselect table=MOS2clean.fits:EVENTS imagebinning='binSize' imageset='m2_image_full.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [200:12000])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS2clean.fits:EVENTS  imagebinning='binSize' imageset='m2_image_b1.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [200:500])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS2clean.fits:EVENTS  imagebinning='binSize' imageset='m2_image_b2.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [500:1000])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS2clean.fits:EVENTS  imagebinning='binSize' imageset='m2_image_b3.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [1000:2000])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS2clean.fits:EVENTS  imagebinning='binSize' imageset='m2_image_b4.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [2000:4500])&&(PATTERN in [0:12])&&(FLAG==0)'


    evselect table=MOS2clean.fits:EVENTS  imagebinning='binSize' imageset='m2_image_b5.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EM&&(PI in [4500:12000])&&(PATTERN in [0:12])&&(FLAG==0)'

     
  7. Produce images for PN in 5 energy bands and from the whole spectral coverage,

    evselect table=PNclean.fits:EVENTS imagebinning='binSize' imageset='pn_image_full.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EP&&(PI in [200:12000])&&(PATTERN in [0:4])&&(FLAG==0)'


    evselect table=PNclean.fits:EVENTS  imagebinning='binSize' imageset='pn_image_b1.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EP&&(PI in [200:500])&&(PATTERN in [0:4])&&(FLAG==0)'


    evselect table=PNclean.fits:EVENTS  imagebinning='binSize' imageset='pn_image_b2.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EP&&(PI in [500:1000])&&(PATTERN in [0:4])&&(FLAG==0)'


    evselect table=PNclean.fits:EVENTS  imagebinning='binSize' imageset='pn_image_b3.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EP&&(PI in [1000:2000])&&(PATTERN in [0:4])&&(FLAG==0)'


    evselect table=PNclean.fits:EVENTS  imagebinning='binSize' imageset='pn_image_b4.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EP&&(PI in [2000:4500])&&(PATTERN in [0:4])&&(FLAG==0)'


    evselect table=PNclean.fits:EVENTS  imagebinning='binSize' imageset='pn_image_b5.fits' \
      withimageset=yes xcolumn='X' ycolumn='Y' ximagebinsize=40 yimagebinsize=40 \
      expression='#XMMEA_EP&&(PI in [4500:12000])&&(PATTERN in [0:4])&&(FLAG==0)'

     
  8. Run detection chains for all 3 EPIC cameras, one by one (first example below) or all together at once (second example), as it is done in the XMM-Newton pipeline - Note the different Energy Conversion Factors (ecfs) for MOS1 (Thin filter) and MOS2 (Thick filter)

    First example: detection chains by single EPIC camera,

    edetect_chain imagesets=' \
      "m1_image_b1.fits" "m1_image_b2.fits" "m1_image_b3.fits" "m1_image_b4.fits" "m1_image_b5.fits"' \
      eventsets=MOS1clean.fits attitudeset=AttHk.ds \
      pimin='200 500 1000 2000 4500' pimax='500 1000 2000 4500 12000' \
      ecf='
    1.734 1.746 2.041 0.737 0.145' \
      eboxl_list='m1_eboxlist_l.fits' eboxm_list='m1_eboxlist_m.fits' \
      esp_nsplinenodes=16 eml_list='m1_emllist.fits' esen_mlmin=15


    edetect_chain imagesets=' \
      "m2_image_b1.fits" "m2_image_b2.fits" "m2_image_b3.fits" "m2_image_b4.fits" "m2_image_b5.fits"' \
      eventsets=MOS2clean.fits attitudeset=AttHk.ds \
      pimin='200 500 1000 2000 4500' pimax='500 1000 2000 4500 12000' \
      ecf='
    0.991 1.387 1.789 0.703 0.150' \
      eboxl_list='m2_eboxlist_l.fits' eboxm_list='m2_eboxlist_m.fits' \
      esp_nsplinenodes=16 eml_list='m2_emllist.fits' esen_mlmin=15


    edetect_chain imagesets=' \
      "pn_image_b1.fits" "pn_image_b2.fits" "pn_image_b3.fits" "pn_image_b4.fits" "pn_image_b5.fits"' \
      eventsets=PNclean.fits attitudeset=AttHk.ds \
      pimin='200 500 1000 2000 4500' pimax='500 1000 2000 4500 12000' \
      ecf='
    9.525 8.121 5.867 1.953 0.578' \
      eboxl_list='pn_eboxlist_l.fits' eboxm_list='pn_eboxlist_m.fits' \
      esp_nsplinenodes=16 eml_list='pn_emllist.fits' esen_mlmin=15


    OR

    Second example: detection chain with all 3 EPIC cameras simultaneously,

    edetect_chain imagesets=' \
    "m1_image_b1.fits" "m1_image_b2.fits" "m1_image_b3.fits" "m1_image_b4.fits" "m1_image_b5.fits" \
    "m2_image_b1.fits" "m2_image_b2.fits" "m2_image_b3.fits" "m2_image_b4.fits" "m2_image_b5.fits" \
    "pn_image_b1.fits" "pn_image_b2.fits" "pn_image_b3.fits" "pn_image_b4.fits" "pn_image_b5.fits"' \
      eventsets='MOS1clean.fits MOS2clean.fits PNclean.fits' attitudeset=AttHk.ds \
      pimin='200 500 1000 2000 4500 200 500 1000 2000 4500 200 500 1000 2000 4500' \
      pimax='500 1000 2000 4500 12000 500 1000 2000 4500 12000 500 1000 2000 4500 12000' \
      ecf='1.734 1.746 2.041 0.737 0.145 0.991 1.387 1.789 0.703 0.150 9.525 8.121 5.867 1.953 0.578' \
      eboxl_list='all_eboxlist_l.fits' eboxm_list='all_eboxlist_m.fits' \
      esp_nsplinenodes=16 eml_list='all_emllist.fits' esen_mlmin=15


    The file AttHk.ds is the attitude file generated by the SAS task attcalc (silently run by the EPIC reduction tasks epproc, and emproc). The ecf are the Energy Conversion Factors to convert count rates (counts/s) to fluxes (10-11 erg/s/cm2) in a given energy band (a standard definition is reported in Section 6.2.1 of the 3XMM-DR6 EPIC Source Catalogue User Guide). In this example factors were taken for EPIC-MOS1 and EPIC-PN with the Thin filter, and EPIC-MOS2 with the Thick filter. 
     
  9. Display the detected source on top the full energy bandpass image.

    First example (individual detection chains):

       srcdisplay boxlistset=m1_emllist.fits imageset=m1_image_full.fits sourceradius=0.01
       srcdisplay boxlistset=m2_emllist.fits imageset=m2_image_full.fits sourceradius=0.01
       srcdisplay boxlistset=pn_emllist.fits imageset=pn_image_full.fits sourceradius=0.01

     

     
  10. Second example (all EPICs simultaneously) - the images from the three EPIC cameras can be merged  through:

       emosaic imagesets='m1_image_full.fits m2_image_full.fits pn_image_full.fits' mosaicedset=mosaic.ds

    and then display the detected sources on top of the mosaiced image through:

       srcdisplay boxlistset=all_emllist.fits imageset=mosaic.ds
     
     

 

Caveats

None