subroutine ommodmap read in task parameters open OM OSW Image file determine file type from datamode in primary header read in the science window keywords from the primary header calculate the image binning extract window data from MODES binary table extension extract quality array extract OM OSW Image if modulo-8 noise is not lost in binning calculate good pixels to be used in producing the mod8 Tile Map using a sigma clipping method calculate size of modulo-8 tile calculate size of sliding box loop over OM OSW Image in steps of modulo-8 tile loop over each pixel in modulo-8 tile use sliding box to calculate mean pixel values end loop use mean pixel values to calculate modulo-8 tile insert modulo-8 tile into modulo-8 map end loop end if correct OM OSW Image for modulo-8 noise create output OM OSW Image file end subroutine ommodmap