GalSim-developers/GalSim — pull request #456 by rmjarvis (2013-08-18 07:06:58+00:00)
Title: #430 Add whitening to config and make it easier in python layer

This PR is for some new functionality related to whitening the noise for RealGalaxy objects. Now to have a RealGalaxy get the correct noise in a config script, you just add the item `whiten : true`. This will keep track of the correct correlated noise for that object, whiten it after drawing, and then add whatever variance is left according to the `noise` attribute.

This is facilitated by Rachel's [new catalogs](https://github.com/GalSim-developers/GalSim/wiki/RealGalaxy%20Data%20Download%20Page) that include the name of the file with the correlated noise for each object, so GalSim can start with the correct noise profile.

It is also easier now to get the whitening correct in the python layer. The RealGalaxy object keeps track of its noise in a `noise` attribute, and any function that changes the noise also updates this attribute. This includes things like `Convolve` which end up with a whole new object -- the `noise` attribute is propagated to the new object. So one can do the following:
```
gal = galsim.RealGalaxy(...)
gal.applyShear(g1,g2)
big_gal = gal.createDilated(scale)
final = galsim.Convolve([big_gal,psf,pix])
final.draw(im)
var = final.noise.applyWhiteningTo(im)
```
The returned `var`

Other related changes included here:
* Made RealGalaxy objects keep track of their (correlated) noise. Functions like applyShear,
Convolve, and such automatically keep this updated so the final object also knows the current
noise profile so it can be appropriately whitened. (Issue #430)
* Added option to set a minimum pad size for RealGalaxy. Required to make sure whitening will
work correctly. (Issue #430)
* Added whiten option to config for RealGalaxy objects to whiten the image. (Issue #430)
* Added VariableGaussianNoise to apply Gaussian noise with a variable sigma across the image.
(Issue #430)