GalSim-developers/GalSim — pull request #329 by barnabytprowe (2012-12-11 15:53:22+00:00)
Title: #297 - Storing 2D correlation functions and generating noise with these correlations

This is the pull request for Issue #297.

* I've written a new type of `SBProfile`, which I call the `SBCorrFunc`. This is for storing, and interpolating, across discrete correlation functions such as might be generated from images of correlated noise (this is the main GREAT3 use case). It inherits from the `SBInterpolatedImage`, but I modified its `xValue` and `kValue` functions to ensure two-fold rotational symmetry (by only using half the lookup table - I could make this slightly more efficient by discarding the unused half, but I don't yet have this implemented).

* Using an SBProfile is very handy for interpolating, transforming and (needed for whitening), convolving correlation functions.

* The Python layer container is the `CorrFunc`. This is initialized with an image - e.g. an image of correlated noise - and the `__init__` function then calculates the discrete correlation function, stores useful internal stuff, and initializes an `SBCorrFunc`.

* There are some extra methods beyond the normal container for an `SBInterpolatedImage`: one is for applying noise according to the `CorrFunc` to an input image, which will be a main use of this class. Another outputs covariance matrices for animage assuming that the `CorrFunc` in question is stationary across the image. This was *going* to be useful for performing noise whitening, but thanks to a very illuminating chat with @gbernstein last night, this may now be primarily useful as a check of FFT-based methods... Anyway, that's a story for another pull request....

* I've written unit tests, so take a look there for some examples of use. Hopefully, we'll be able to get this working to pad real galaxy images with HST-style correlated noise.

There are a couple of additional queries I want to raise on this PR, but I'll do this using the forum of the comments below and reference in place- it's just so much easier to review code once it's in a PR! But there's a little here to look at, so I wanted to get it up now.