On Feb 5, 2013, at 4:12 PM, Barnaby Rowe <notifications@github.com> wrote:

> In tests/test_InterpolatedImage.py:
> 
> > @@ -455,9 +455,162 @@ def test_operations():
> >      t2 = time.time()
> >      print 'time for %s = %.2f'%(funcname(),t2-t1)
> >  
> > +def test_uncorr_padding():
> > +    """Test for uncorrelated noise padding of InterpolatedImage."""
> > +    import time
> > +    t1 = time.time()
> > +
> > +    # Set up some defaults: use weird image sizes / shapes and noise variances.  But, important
> > +    # note: SBInterpolatedImage identifies centroid via summation over pixels to get unweighted
> > +    # moments.  This means that if we make the noise images too huge, then those moments will
> > +    # diverge and the estimated centroids can be outside of the image, which causes seg faults in
> > +    # the C++ layer.  So make the images decently big but not enormous.
> Two things:
> 
> I thought that the SBInterpolatedImage (or more specifically the MultipleImageHelper) didn't re-centroid using unweighted moments (or necessarily need to calculate the centroid at all) if it was initialized with only one input Image. I'm kind of banking on this fact for the InterpolatedImage implementation of the ImageCorrFunc, for which any recentroiding would be a very bad thing. So I think this is a somewhat misleading statement. There seems to be some centroid calculation stuff inside the calculateKMax() etc. functions, which I guess would fail in such cases if these were called.
> 
This definitely was a problem here (ask me how I know this…) but you're right, it was only in calculateStepK().   So if InterpolatedImage is initialized with ```calculate_stepk=False``` then that won't happen.  I will update this comment to be more specific about where the failure comes in.
> Also, this behaviour at the C++ layer (centroid wandering out of the image boundaries) should be catchable without a segfault.
> 
You are absolutely right.  It was pure lzainess on my part that I didn't put in some error-catcher so someone else wouldn't have to do what I had to do to find the problem!  I will fix this tonight when I do the other stuff I promised.