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


ommosaic (ommosaic-2.11) [xmmsas_20230412_1735-21.0.0]


Algorithm- Sky Images

This section describes how ommosaic works when the input images are all OM product sky-images.

STAGE 1- Checking of input files

  Read in the list of input images from the parameter imagesets

  Check that all the input files are either sky-images or unrotated images- if not stop the program with an error message.

  Check that all the files have different names- if not stop the program with an error message

STAGE 2- Some initialization- Inputting of various bits of information from the input files.

Loop over each input file

    1) Extract the values for the following FITS keywords in the file header
        1) FILTER   - the OM filter 
        2) OBS_ID   - the observation identifier
        3) RA_PNT   - RA pointing direction of OM (degees)
        4) DEC_PNT  - Dec pointing direction of OM (degrees)
        5) POSCOROK - True if astrometry correction applied, FALSE otherwise
        6) RAOFFSET - Computed RA offset correction * cos(DEC_PNT) (arcsecs) - 0 if POSCOROK = FALSE
        7) DEOFFSET - Computed Dec offset correction (arcsecs)- 0 if POSCORK  = FALSE 
        8) CDELT1   - Plate-scale in RA direction
        9) CDELT2   - Plate-scale in Dec direction
       10) CRPIX1   - Reference x pixel
       11) CRPIX2   - Reference y pixel
       12) CRVAL1   - RA value at CRPIX1
       13) CRVAL2   - Dec value at CRPIX2
       14) BINAX1   - Binning factor (0 or 1)
       15) BINBPE   - Binning on (True or False)
       16) WINDOWDX - Image x-axis length
       17) WINDOWDY - Image y-axis length
       18) DATE_OBS - Start time of observation
       19) DATE_END - End time of observation 
       20) EXPOSURE - The exposure time (secs)
       
    2) Compute the following quantities
        1) RA of bottom left-hand corner of image
        2) Dec of bottom left-hand corner of image          
        3) RA of bottom right-hand corner of image
        4) Dec of top left-hand corner of image  
        5) Modified Julian date of mid-point of exposure

End loop

STAGE 3- Checking the astrometry of the images- Some images may have had an astrometry correction applied to their CRVAL1 and CRVAL2 values. For those that don't, a correction will be applied to CRVAL1 and CRVAL2 by interpolation/extrapolation using a list of the corrections applied to the rest and a list of their mid-point exposure times.

    Create an empty list (raList) to store  computed astrometry RA  offsets
    Create an empty list (decList) to store computed astrometry Dec offsets
    Create an empty list (timeList) to store the computed mid-observation times 


    Loop over each input file

        If POSCOROK is true then:
            1) Add the RA astrometry correction to raList.
            2) Add the Dec astrometry correction to decList.
            3) Add the mid-point exposure time to timeList.
         End if
       End Loop

    If the size of raList is zero then terminate STAGE 3 and go on to STAGE 4 

    Sort raList, decList and timeList into increasing time order


    Loop over each input file
        If POSCOROK is false then:
            1) Compute an interpolated/extrapolated RA astrometry correction and replace its RAOFFSET value with it.
            2) Compute an interpolated/extrapolated Dec astrometry correction and replace its DEOFFSET value with it.           
        End if
    End Loop

STAGE 4- Adding extra astrometric keywords to the image files FITS headers to say whether or not an interpolated/extrapolated astrometric correction has been computed.

    Loop over each input file
        If POSCOROK is TRUE then:
            1) Add a new boolean FITS keyword POSINTRP to the FITS header and set its value to FALSE.
            2) Add a new 32-bit float keyword RA_OFF to the FITS header and set its value to 0.      
            3) Add a new 32-bit float keyword DEC_OFF to the FITS header and set its value to 0.      
        else
            1) Add a new boolean FITS keyword POSINTRP to the FITS header and set its value to TRUE.
            2) Add a new 32-bit float keyword RA_OFF to the FITS header and set its value to the 
               interpolated/extrapolated value.      
            3) Add a new 32-bit float keyword DEC_OFF to the FITS header and set its value to the 
               interpolated/extrapolated value.      
        end if
      
    End Loop

STAGE 5 - Alignment of images by cross-correlation (This stage is optional and in the omichain will be skipped)

Read in the value of the input parameter mincorr. If its absolute value is less than 0.0001 then skip this stage and go on to STAGE 6. Otherwise, please refer to Section Image Alignment.

STAGE 6 - Creation of the output image, exposure-image and quality-image.

    1)  Find the maximum left-hand corner RA coordinate (RAL) from all the images 
        (remember that the RA increase leftwards)  
    2)  Find the minimun right-hand corner RA coordinate (RAR) from all the images   
    3)  Find the minumum bottom edge Dec coordinate (DECL) from all the images  
    4)  Find the maximum top edge Dec coordinate (DECU) from all the images  
    5)  Determine the number of pixels in the x-direction (nx) using the plate-scale
    6)  If nx exceeds 5000 (possible if using images from different observations),
        give a warning message and reset nx to 5000. 
    7)  Determine the number of pixels in the y-direction (ny) using the plate-scale
    8)  If ny exceeds 5000 (possible if using images from different observations),
        give a warning message and reset ny to 5000. 
    9)  Create a 2-d 32-bit float image to store the stacked PRIMARY image.
   10)  Create a 2-d 32-bit float image to store the computed EXPOSURE image.
   11)  Create a 2-d 16-bit integer image to store the computed QUALITY image.
   12)  Set CRPIX1 to nx / 2 and CRPIX2 to ny / 2 (these refer to the output image)
   13)  Set CRVAL1 to (RAL+RAR) / 2 and CRVAL2 to (DECL+DECU)/2 (these refer to the 
        output images)

STAGE 7 - Set the pixels in the output PRIMARY, EXPOSURE and QUALITY images.

1) If the images are comprised of a mixture of low/high resolution images set a variable mixedImages to
true- otherwise set it to false.  

2)  Loop over input image files

    Load the image from the PRIMARY block in the file.
    If mixedImages=true and the image is a high-resolution one, then multiply each pixel of the image
    by four (to effectively convert it into a low-resolution one for interpolation purposes).   
  

     Loop over pixels in output image
        1) Convert the tangent-plane coordinates, x and y, of the pixel to RA and Dec. 
        2) Convert RA and Dec to input image tangent-plane coordinates, x1 and y1, using the WCS values 
           for the image. 
        3) Check to see that x1, y1 lies within the image, if not move onto the next pixel.
        4) Compute the value of the image at x1, y1 by 2-d bilinear interpolation and add this 
           value to the output image pixel value at x, y.
        5) Compute the value of the exposure image at x1, y1 by 2-d bilinear interpolation and add 
           this value to the output exposure image pixel value at x, y.
        6) Compute the value of the quality image at x1, y1 by determining which bits are set at 
           each of the 9 neighbouring pixels and then by setting the corresponding bits of the quality-image 
           pixels at x, y.
 
     End loop
  End loop


3)  Divide each pixel value of the output PRIMARY image by its corresponding EXPOSURE pixel value.

STAGE 8 - Creation of the mosaiced image file.

Determine the name of the output image file from the parameter MOSAICEDSET Create a FITS file with that name.

Add various keywords to the FITS header, including the following-

  1. FILTER - the OM filter (could be more than one)
  2. OBS_ID - the observation identifier (could be more than one)
  3. RA_PNT - Aveaged RA pointing direction of OM (degrees)
  4. DEC_PNT - Averaged Dec pointing direction of OM (degrees)
  5. CDELT1 - Plate-scale in RA direction
  6. CDELT2 - Plate-scale in Dec direction
  7. CRPIX1 - Reference x pixel
  8. CRPIX2 - Reference y pixel
  9. CRVAL1 - RA value at CRPIX1
  10. CRVAL2 - Dec value at CRPIX2
  11. BINAX1 - Binning factor (0 or 1)
  12. BINBPE - Binning on (True or False)
  13. WINDOWDX - Image x-axis length
  14. WINDOWDY - Image y-axis length
  15. DATE_OBS - Minimum DATE_OBS of all the input images DATE_OBS
  16. DATE_END - Maximum DATE_END of all the input images DATE_END
  17. POSCOROK - The input images CRVAL1 and CRVAL2 coordinates were astrometrically corrected (some maybe by interpolation or extrapolation)
  18. RAOFFSET - The mean RAOFFSET value from all the input images.
  19. DEOFFSET - The mean DEOFFSET value from all the input images.

   
    Add the PRIMARY image to the output file.
    Add the EXPOSURE image to the output file.
    Add the QUALITY image to the output file.



Subsections
XMM-Newton SOC -- 2023-04-16