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


omlcbuild (omlcbuild-1.41) [xmmsas_20230412_1735-21.0.0]


Algorithm

   subroutine omlcbuild

     read parameters

     if requested the use of the Imaging-window background:
        
	get handle on the Imaging-mode window file
	
	remove all the source from this image
        
	calculate the average value of the remaining pixels
        and use this value as the background estimate  

     loop i=0, nSources

       get handle on source rates file

       get handle on source region file
       if (exposure IDs are different) issue warning

       get handle on background rates file

       get handle on background region file
       if (exposure IDs are different) issue warning

       if (exposure ID source != exposure ID background) call fatal

       get source extraction radius = s_radius

       get CAL coincidence loss correction radius = cal_radius

       get photometry radius = ph_radius 

       calculate the instrumental limiting magnitude from the 
       detection limit count rate 
 
       compute area of source region = s_area
	
       compute area of background region = b_area

       tStart = max(tBack[0], tSource[0])
       eEnd = min(tBack[nBack-1], tSource[nSource-1]
       tDel = (tEnd - tStart)/(nSource-1)

       determine the PSF fraction within the source extraction region
       determine the PSF fraction within the `background` extraction region

       loop i = 0, nTimeBins

         newTime = tStars + i * tDel

         linear interp to get background rate for each source bin
         compute source rate error
         compute background rate error

	 if the use of the Imaging-mode background is requested,
	 use the earlier calculated background value, 
         
	 otherwise:

	    set up equations for counts recorded in each region. These allow 
	    for (point) source contamination of the `background` region:
	    C(S+B) = PSF(S+B) *S   +   NPIX(S+B) * Bpix
	    C(B)   = PSF(B)   *S   +   NPIX(B)   * Bpix

	    solve these for S, the source counts over the coincidence loss (CL) 
	    region (ie the CAL aperture) and for Bpix, the background counts 
	    per pixel. 

	 scale background to the CAL aperture area:
         bkgnd count rate = background count rate * cal_radius area / s_area 

	 recombine these bkgnd and source rates (now determined for the 
         CAL aperture)

         apply CL correction to the source+bkgnd rate

         apply CL correction to the bkgnd rate

         CL corrected source rate = source+bkgnd rate - bkgnd rate

	 correct result for dead time
        
	 correct for PSF beyond the 12 pixel Cal aperture (mainly for UV)

	 compute the source magnitude and insert it into the source 
         list table
 
         perform the variability tests on rebinned net source 
         counts ($\chi^2$ and Kolmogorov-Smirnov statistics) by

            calculating the mean count rate and variance;
            
            testing the null hypothesis (the source is not variable) by:
              - processing a $\chi^2$ fit  between the count distribution
                and constant distribution whose value is equal to the 
                observed mean count
              - processing the Kolmogorov-Smirnov test between the 
                cumulative probability functions of the observed count 
                distributions and theoretical Gaussian distribution whose
                mean and variance are both equal to the observed 
                mean count.            

            calculate the maximal deviation of the light curve 
            from its mean value and express this value 
            in the number of r.m.s. $\sigma_1$.

        introduce the variability tests data into the source list table

       end loop

     write time keywords to header

     write output rates file

     release handle and memory

   end loop

   end subroutine omlcbuild



XMM-Newton SOC -- 2023-04-16