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


omfastflat (omfastflat-1.22) [xmmsas_20230412_1735-21.0.0]


Algorithm

   subroutine omfastflat
   
    Get task parameters.
    Check data types of ODF input files
    Check if input is an Inorbit flatfield.

    Get a handle on the Inorbit flat field File.
    Get a handle on the ODF OM Fast Mode Event List File.
    Determine file type from file name in primary header.
    Determine if BPE binning is on/off

    if (dataMode == "FAST") then
      Get a handle on the tracking history data binary table extension.    
      Get handles and pointers on the event list binary table extension columns.
      Get the number of rows in the event list binary table extension.
      Get window information from modes extension.
    else
      Incompatible file.
      call fatal("badFileMode","Value for keyword DATAMODE is incompatible")
    end if
     
    Open the CCF.
    Set the state of the cal.
    Get the bad pixel map.

    Add factor and bad pixel columns to event list file.
    Initialise pointer arrays to zero.

    If BPE binning off then need to rebin flatfield.

    Calculate factor and bad pixel flag.
    factorP(i) = (slewFlat(windowX0P(0) + rawXP(i), windowY0P(0) + rawYP(i)))**(-1.0)

    Release the cal memory. 
    Release handles on data.
   
    Create flatfielded fast mode image file.
    Copy attributes.
    Get image handle and pointer.
    Get quality array handle and pointer.
    Build image and quality array.
    do i = 0 , nEvents - 1
         fastImgP(corrXP(i), corrYP(i)) = fastImgP(corrXP(i), corrYP(i)) + factorP(i)
         if badPixel then quality(corrXP(i), corrYP(i)) = 1
    end do
    Calculate the Mod-8 modulation factor
    Copy MODES extension 

    Create OM OSW flat field data product
    Add the keyword MOD8FACTOR to the output image file
    Copy Attributes
    Add HDU keywords
    Add Modes Extension

    Free up memory and pointers.

   end subroutine  omfastflat



XMM-Newton SOC -- 2023-04-16