GalSim-developers/GalSim — pull request #351 by rmandelb (2013-01-30 18:40:29+00:00)
Title: #238 - noise padding

This branch contains some work done by Bob and me to allow images that are turned into SBInterpolatedImages to be padded by noise fields. In practice, this is useful if (a) the image being turned into an SBInterpolatedImage has noise in it already (as is the case for our galaxies from HST) and (b) it is going to be redrawn in a way that would have gone across the boundaries of the original postage stamp. When padding with zeros, this would have resulted in discontinuous noise properties, which can look kind of ugly.

This functionality is for the InterpolatedImage and RealGalaxy classes, and allows for either uncorrelated and correlated noise to be added. Padding with zeros is still the default, because the need for noise padding depends so much on the circumstances.

There is a slight dependence on Barney's open issue #345, which will provide us with a noise correlation function for HST data measured from significant amounts of blank HST images. However, I have put a small HST noise image into the tests/ directory (for use in the unit tests), and I think it gives a nice demonstration of this functionality. If you sit in the examples directory you can run the following code snippet:
```
image = galsim.fits.read('data/147246.0_150.416558_1.998697_masknoise.fits')
int_im1 = galsim.InterpolatedImage(image)
int_im2 = galsim.InterpolatedImage(image, noise_pad='../tests/blankimg.fits')
im1 = galsim.ImageF(1000,1000)
im2 = galsim.ImageF(1000,1000)
im1 = int_im1.draw(im1)
im2 = int_im2.draw(im2)
im1.write('test_padzero.fits')
im2.write('test_padnoise.fits')
```
The difference between the two output FITS images is a good demonstration of the purpose of this branch.