Peter Weilbacher Processing first handles each raw input image separately: it trims the
raw data and records the overscan statistics, subtracts the bias (taking
account of the overscan, if --overscan is not "none"), converts the
images from adu to count, subtracts the dark, divides by the flat-field
and combines all the exposures using input parameters.
The input calibrations geometry table, trace table, and wavelength
calibration table are used to assign 3D coordinates to each CCD-based
pixel, thereby creating a pixel table from the master sky-flat. These
pixel tables are then cut in wavelength using the --lambdamin and
--lambdamax parameters. The integrated flux in each IFU is computed as
the sum of the data in the pixel table, and saved in the header, to be
used later as estimate for the relative throughput of each IFU.
If an ILLUM exposure was given as input, it is then used to correct the
relative illumination between all slices of one IFU. For this, the data
of each slice within the pixel table of each IFU is multiplied by the
normalized median flux of that slice in the ILLUM exposure.
The pixel tables of all IFUs are then merged, using the integrated
fluxes as inverse scaling factors, and a cube is reconstructed from the
merged dataset, using given parameters. A white-light image is created
from the cube. This skyflat cube is then saved to disk, with the
white-light image as one extension.
To construct a smooth 3D illumination correction, the cube is
post-processed in the following way: the white-light image is used to
create a mask of the illuminated area. From this area, the optional
vignetting mask is removed. The smoothing is then computed for each
plane of the cube: the illuminated area is smoothed (by a 5x7 median
filter), normalized, fit with a 2D polynomial (of given polynomial
orders), and normalized again.
A smooth white image is then created by collapsing the smooth cube.
If a vignetting mask was given, the corner area given by the mask is
used to compute a 2D correction for the vignetted area: the original
unsmoothed white-light image is corrected for large scale gradients by
dividing it with the smooth white image. The residuals in the corner
area then smoothed using input parameters. This smoothed vignetting
correction is the multiplied onto each plane of the smooth cube,
normalizing each plane again.
This twilight cube is then saved to disk.