This tool takes an image file and matching quality image (bad pixel map) in order to correct the modulo-8 spatial fixed pattern noise. The tool outputs a corrected image file and optionally a map of the corrections. The quality image is expected to match the image file in number of extensions and dimensions of each image.
The final stage of the UVOT detector is a 256 by 256 pixel CCD. Individual events are centroided to one eighth of a physical CCD detector pixel by the onboard electronics. However, the centroiding algorithm distributes the photons unevenly within each physical CCD pixel, corresponding to 8 by 8 image pixels or a single mod-8 tile.
The tool first steps a box of size ncell across the image, and within the box a sigma clipping algorithm is used to mask out sources more significant than nsig and any surrounding pixels affected by coincidence loss. Then the average of all remaining mod-8 tiles within a sliding box of size ncell is computed and used to produce the mod-8 map.
The algorithm resamples the image to give each image pixel equal area within a mod-8 tile. For each mod-8 tile in the mod-8 map, the pixel x-boundaries are determined such that within each row of pixels the counts/unit pixel area is the same for each pixel. This is then taken as the spatial layout of the pixel x-boundaries in the same mod-8 tile in the science image and the science image is resampled to a grid of evenly spaced pixels. Then the y-boundaries of each row are determined such that each row has the same number of counts/unit pixel area. This is then taken as the spatial layout of pixel y-boundaries in the same mod-8 tile in the science image, which is then resampled to a grid of evenly spaced rows. The same procedure is then repeated with the order reversed (remapping in y followed by remapping in x) and the final corrected science image is made from an average of the two resamplings. This is to ensure that the redistribution of photons is performed in an identical fashion in x and y.
uvotmodmap infile=input.fits badpixfile=quality.fits outfile=output.fits
Alternatively, you could just run uvotmodmap and be prompted for the inputs.