XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


region (region-7.15.3) [xmmsas_20230412_1735-21.0.0]


Algorithm

   module region_mod

     subroutine region

       Get parameters;

       Read instrument, exposure time etc from event list and set up cal;

       if (--outunit eq 'xy') {read WCS kwds from X and Y columns;}

       Filter source list and load the result into memory;

       if (--radiusstyle ne 'userfixed') {calculate source mean energies;}

       Calculate the position of each source in both DETXY and TELCOORD;

       if (--outunit eq 'xy') {
         Calculate the position of each source in the XY scheme;
       }

       # Calculate the shapes and sizes of the source regions:

       if (--radiusstyle eq 'contour') {
         if (--bkgratestyle eq 'col') {
           get bkg_rates from BG_MAP column of source list;

         } elsif(--bkgratestyle eq 'user') {
           set all bkg_rates to --bkgrateuser;
         }

         Calculate elliptical cutouts (uses ssclib/source_cutouts routine);

         if (--nosrcellipse) {change ellipses to circles of r = l;}

       } elsif(--radiusstyle eq 'userfixed') {

         Calculate region radius by changing --fixedradius to the appropriate
           coordinate system (either detxy or xy);

       } elsif(--radiusstyle eq 'enfrac') {

         Calculate (using cal call) the radius of a circle which encloses
           --energyfraction of the flux of the PSF;

         Convert this radius to the appropriate coordinate system (either
           detxy or xy);
       }

       if ((--radiusstyle ne 'contour' || --nosrcellipse)
         && --operationstyle ne 'global' && --shrinkconfused) {

         Find sets of confused sources (uses a routine in ssclib/confusion);

         Shrink radii of confused regions until they don't overlap;
       }

       if (--operationstyle ne 'global') {
       # Construct the background annuli:

#### fill in some details??
       }

       Construct the region specifications and save them to file.

     end subroutine region

   end module region_mod



XMM-Newton SOC -- 2023-04-16