The procedure takes two identical flat field exposures containing both image and bias pixels and uses the photon transfer relationship to calculate the system gain in e/ADU.

Where :


Mean=Mean signal in ADU in the flat field exposures,

Variance=variance in the resultant image, in ADU,  obtained by subtracting one flat field from another flat field,

Noise= read noise in the bias section of the flat field images, in ADU.

Two flat fields are used to remove the effects of intrinsic pixel to pixel sensitivity variations that would otherwise affect the statistics.

Flat fields can be difficult to arrange. Pseudo flat-fields can also be used where the illumination across the image is smoothly varying.

The images first subtracted and the resultant image broken up into small tiles. The mean and variance of each tile are then plotted on a graph and a gain calculation made using the above relationship. Any tiles that yield a result very different from the others, say because of a cosmic ray or dust spot, are highlighted in red and excluded from further calculations. If the input images are high quality flat fields then all the points in the graph will be concentrated in one place. If input images containing more complex illumination patterns are used, a smoothly varying exposure gradient being the ideal, then the points on the graph will be spread out and yield the classic photon transer curve. Either way it will be possible for the program to calculate the mean gain across the image tiles.

The procedure is called as follows:

CCDgain, [tilesizeX,tilesizeY,



If the parameters identifying the image and bias areas of the images as well as the size of the analysis tiles are not included then the following default values are used:




This is ideal for the commonly used large format E2V CCDs. A example of the variance-against-mean graphical output is shown here. Each point represents one image tile.  The program also prints out the noise in e- and the gain in e-/ADU.

The program will have problems with images that have high levels of read noise since this will prevent it from seeing the photon noise required for the gain calculation. It will also be upset by bias gradients that will cause it to overestimate the read noise. The input flat fields need to contain lots of photoelectrons to get a good result: at least several thousand up to several tens of thousands of photoelectrons per pixel.