rgsproc, coordinates and masks


This thread contains a step-by-step recipe to select the correct source coordinates and extraction masks for the processing of RGS point-like sources.

Expected Outcome

Source lists with correct source coordinates and extraction masks.

SAS Tasks to be Used


Useful Links


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

Last Updated: 14 October 2014



This thread contains a step-by-step recipe to select the correct source coordinates and extraction masks for the processing of RGS point-like sources.

These are some of the most common problems found during the processing of RGS data:

  1. Wrong source coordinates


  2. Sources in the background region


  3. The size of the extraction region


  1. The coordinates of the source selected as 'prime' in the source list are wrong. How can I change them?

    In the example shown below, the coordinates of the PROPOSAL source are incorrect (click on the table to see an enlarged version). They should be R.A.=184.61100 and Dec=+29.81267.

    As a result of this, the extraction mask is far off the source position and, after processing using the proposal coordinates, the final spectrum is wrong (note the empty regions in the dispersion vs energy image):


    Wrong source coordinates

    Wrong Source List


    To change the coordinates of the prime source, the new coordinates have to be entered, and rgsproc has to be run starting at least from the angles stage, to calculate the correct aspect drift corrections.

    This can be done in two different ways:

    • Start the full reprocessing from the beginning:

         rgsproc withsrc=yes srclabel=USER srcra=184.61100 srcdec=+29.81267

      where entrystage and finalstage are left to their default values. withscr=yes is used to define a new prime source by the parameters srclabel, srcra and srcdec. The label is the name that the new source will get in the source list, coordinates are J2000 in decimal degrees.


    • Alternatively, skip the first rgsproc stage (events), modify the existing source list, and start rgsproc at the second stage (angles).

         rgssources srclist=PxxxxxxyyyyRrzeeeSRCLI_0000.FIT addusersource=yes \
            ra=184.61100 dec=+29.81267 label=USER \
            changeprime=yes userasprime=yes primelabel=USER

         rgsproc entrystage=2:angles

      where ra, dec and label are similar to srcra, srcdec and srclabel, and changeprime and userasprime have both to be set to yes in order to change the primary source.


      Correct source coordinates

      Source List


  2. There are several X-ray sources in the field of view! How is this taken into account in the processing?

    In case you find sources not included in the source list, you may want to add them for processing (i.e. getting spectra, but not as a primary source) and/or, more important, for excluding them from the background extraction region.

    This example shows an observation of YY Gem, in which the nearby star Castor is visible at the top of the EPIC image (left panel). The spectrum of this second source is also present in the RGS spatial image (right panel).


    EPIC image RGS Image

    If the observation is processed with the default rgsproc parameters, the spectrum of Castor would be included in the background:


    Wrong background extraction region

    RGS Image

    and therefore the net spectrum of YY Gem would be underestimated.

    The image shown above has been created with the command:

       evselect table='PxxxxxxyyyyRrzeeeEVENLI0000.FIT:EVENTS' \
         imageset='background.fit' xcolumn='M_LAMBDA' ycolumn='XDSP_CORR'\

    • To exclude the spectrum of Castor from the background, the first step is to add the coordinates of this source to the already existing source list:

         rgssources srclist='PxxxxxxyyyyRrzeeeSRCLI_0000.FIT' \
           addusersource=yes label='CASTOR' \
           ra=113.64942 dec=31.88828 \

      where bkgexclude=yes indicates that a region around the location of this source should be excluded in the computation of the background.


    • The next step is to compute the new extraction masks, both for the source and for the background:

         rgsregions srclist='PxxxxxxyyyyRrzeeeSRCLI_0000.FIT' \
           evlist='PxxxxxxyyyyRrzeeeEVENLI0000.FIT' \

      where procsrcsexpr='INDEX==1' indicates that the extraction mask is computed for the first entry in the source list (i.e. the PROPOSAL coordinates of YY Gem).


    • and finally, extract the source spectrum:

         rgsspectrum evlist='PxxxxxxyyyyRrzeeeEVENLI0000.FIT' \
           srclist='PxxxxxxyyyyRrzeeeSRCLI_0000.FIT' \


    The new background is now correctly estimated, as the contribution from Castor is not included any more:


    Correct background extraction region


  3. The extraction mask is too small for the size of my source...

    It may happen that the source observed is extended and fills part or all of the extraction region. The use of the default values for the size of the source and background extraction regions would lead to erroneous results, both by underestimating the source countrate and by overestimating the background.

    The image below shows the case of a moderately (1.5 arcmin) extended Supernova Remnant N49 in the LMC. The standard 95%-of-the-PSF extraction region is clearly too small for the actual size of the source (left panel), while a 98% region seems to be more appropriate (right panel).


    95% of the PSF

    98% of the PSF


    • First, the size of the extraction region has to be changed in the source list, and new extraction masks have to be computed:

         rgsregions srclist='PxxxxxxyyyyRrzeeeSRCLI_0000.FIT' \
           evlist='PxxxxxxyyyyRrzeeeEVENLI0000.FIT' \
           xpsfbelow=98 xpsfabove=98 xpsfexcl=99

      where the last parameter, xpsfexcl=99, increases the size of the exclusion region around the source used to determine the background (the default value is 98%).

      Note: RGS extraction regions can be loaded into ds9 converting them to the appropriate format with the SAS task cxctods9:

           cxctods9 table='PxxxxxxyyyyRrzeeeSRCLI_0000.FIT:extension' regtype=linear -V 0 > ds9.reg

        where extension is the desired extension (e.g. RGS1_SRC1_SPATIAL or RGS1_BACKGROUND)


    • Finally, the spectrum must be re-extracted using the new region:

         rgsspectrum evlist='PxxxxxxyyyyRrzeeeEVENLI0000.FIT' \