In our tests of various scattered-light removal techniques we are using synthetic images to which various realistic things have been done – smearing by a PSF and ‘adding’ Poisson noise, etc.

Poisson noise should not be ‘added’ because this will increase the mean value of a region of an image. Instead, Poissonian noise should be drawn from the Poisson distribution with a mean at the value of the image pixel under consideration.

We have two codes to generate Poisson noise in images and we test these next. We take one synthetic (i.e. noise-free) image and define a region on it. In that region we calculaet the mean. We then generate Poisson-noisy images using our IDL code and a Fortran code. These are different in that the IDL code writes out floating-point images while the Fortran code writes out integer images.

In a loop over 1000 trials we generate noisy images from the original image and each tine calculate the mean in the predefined region. We set aside the percentage difference between the IDL code and the ideal image and the Fortran code and the ideal image.

Then we plot these percentage differences:

The two distributions are symmetric about 0 and practically identical. From this we conclude that both codes ‘add’ Poisson noise to the image correctly and that the writing-out of the integer resulting image in the case of the Fortran code does not cause any rundoff problems, even if the region inside of which we tested had a small mean value (about 3.9 pcounts). The regiion was 19×19 pixels large.

We do note that the spread, although similar, is quite large – SD is 4 and 6 counts respectively. This implies, unsurprisingly, that the number of boxes of size 19×19 that must be averaged over is in the hundreds if the standard error of the mean is to be at our science goal of 0.1%. We knew that – this is just a reminder …

Final note: the Fortran code uses a fixed seed to generate random numbers. A modification was needed to read in a random seed instead, from the command line. This is supplied when the code is called by the user.