[SciPy-dev] new function regrid for fitpack2

Stefan van der Walt stefan at sun.ac.za
Fri Oct 13 11:40:30 CDT 2006

Hi John

On Fri, Oct 13, 2006 at 03:42:13PM +0100, John Travers wrote:
> Attached is a very simple script (will make it a test later) which
> uses the test data from netlib->dierckx to check the use fo regrid and
> surfit. The plot attached shows the results. There could be an error
> in my dealing with meshgrid (I hate they way it swaps axes), but I
> think it is right. The surfit part issues a warning on interpolation.
> If you increase s to say 20 (0 is needed for interpolation) then the
> warning goes, but then you are smoothing (as can be seen from the
> corresponding output plot - which was down sampled for file size).

I think matplotlib may be throwing a spanner in the wheels here by
using its own interpolation.  If you use


you get a plot like


(I changed to a more densely sampled grid).

As for the meshgrid behaviour, take a look at numpy's mgrid, which
doesn't do the argument swapping.

> I'll make this into a test at some point and also improve the interp2d
> interface to be more flexible to input array layout - but this will
> have to be nest week due to time constraints (I need to work...)

I'm sorry, I still havn't had time to merge the patch -- will
hopefully be able to do that over the weekend at least.

> Hope this demonstrates my point (and that yopu don't find an obvious
> error in my code...)

Thanks for the demo!  Pretty pictures always make for a convincing


More information about the Scipy-dev mailing list