
Thanks, Stefan.
In [25]: import numpy as N In [26]: x = N.array([[4,3,8,1],[4,3,8,1.]]) In [27]: ndi.geometric_transform(x,shift,output_shape=(2,6),prefilter=False,order=0,cval=-1) Out[27]: array([[-1., 3., 8., 1., 8., -1.], [-1., 3., 8., 1., 8., -1.]])
Your example seems to be missing a definition for "shift", but I see that shift = lambda (y, x): (y, x-xoff) reproduces your result for any 0. < xoff <= 0.5.
Looks like the spline fit is done on mirrored input data, instead of padding the input with the cval.
Yes, that makes sense. I suppose the idea is to *avoid* creating edge effects due to an artificial sharp cut-off(?). That is fine for calculating the interpolant, but it seems like a mistake to include the mirrored values in the output result, doesn't it? Do people agree that points outside the bounds of the original data should be blank, such that the correct result in the above case would be [-1., 3., 8., 1., -1., -1.]? If so, I can go ahead and file a bug report (should it be a scipy-ticket, an email to STScI or both?). I would offer to have a go at changing the nd_image code, but I think I might be well out of my depth at this point... Cheers, James.