On Feb 6, 2013, at 9:24 AM, Barnaby Rowe <notifications@github.com> wrote:

> In galsim/base.py:
> 
> > @@ -1384,15 +1391,45 @@ class InterpolatedImage(GSObject):
> >      choose interpolants and pad factors, and no warnings are raised when the code is modified to
> >      choose some combination that is known to give significant error.
> >  
> > +    The user can choose to have the image padding use zero (default), Gaussian random noise of some
> > +    variance, or a Gaussian but correlated noise field that is specified either as an ImageCorrFunc,
> > +    an Image (from which a noise correlation function is derived), or a string (interpreted as a
> > +    filename containing an image to use for deriving the noise correlation function).  The user can
> > +    also pass in a random number generator to be used for noise generation.
> It looks you are both OK with making this an additive change to the __init__ kwarg list: I'm perfectly happy with that.
> 
Okay, I plan to do a bunch of things today/tomorrow, and can include this.  For InterpolatedImage, my plan was to make the keyword `pad_image`, so if an image for padding is passed in, it uses it directly (doing something intelligent if it is larger than necessary).  If `noise_pad` is also specified, then it will add noise on top of that `pad_image`.  If `noise_pad` is the only one that is specified, then it will simply proceed as it does now, creating a new `pad_image`.  I guess it can work essentially the same way for RealGalaxy.

> Perhaps I'm being stupid, but I still don't see how the Image option for noise_pad strikes a sensible balance between potentially useful and potentially inefficient. I'll try and explain more clearly.
> In Python it's obviously just a replacement for InterpolatedImage(..., noise_pad=galsim.ImageCorrFunc(noise_image)) which is fine but I agree it should be documented that this is likely to be wasteful.
> 
> As for config... If I understand correctly, config has to take a string containing an image filename for the noise image to use for the correlation function. An efficient way to then proceed would be to have config generate an ImageCorrFunc for the image saved at the string location, one time only, and pass that to noise_pad repeatedly until (perhaps for a later object) the string changes. Does config not currently work this way? Perhaps this is impossible for a reason I don't understand? If it's possible, I'd be happy to try and implement it.
> 
No, it does not work that way currently.  I do see your point, though, given that people will often use config to mass-produce images possibly with very similar / identical ImageCorrFunc for the noise padding.  So, I have an idea for how this could possibly be done, but maybe Mike could comment on whether this is feasible:

We have this `takes_rng` parameter for our base classes that says whether the base class might need to be initialized with an RNG that has been created at some point earlier in the config script.  Could we have an analogous `takes_cf` option that would let us hand an ImageCorrFunc (or rather, the filename of an image to create one) to config, and then the base classes in question (InterpolatedImage and RealGalaxy) could automatically use that ImageCorrFunc?

On a random note, I just realized I didn't update the config wiki to reflect that noise padding is possibly.  I should do that, too…