From: John H. <jdh...@ac...> - 2004-12-10 20:52:40
|
>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes: Peter> I use Hardy's multiquadric interpolation to to do the math, Peter> then use imshow (or pcolor) to make a surface map. I only Peter> have data for the 120 points (where the circle are - those Peter> are actuators), and interpolate the rest. Peter> If people are interested, I can clean up the code a little Peter> and post it. This sounds pretty close to matlab's griddata function. It would be very nice to have this in matplotlib.mlab, perhaps as a wrapper to some core scipy functionality, which could be conditionally imported. What requirements does your code have -- pure python, extension code, scipy, numarray? Here is the matlab docstring, FYI GRIDDATA Data gridding and surface fitting. ZI = GRIDDATA(X,Y,Z,XI,YI) fits a surface of the form Z = F(X,Y) to the data in the (usually) nonuniformly-spaced vectors (X,Y,Z) GRIDDATA interpolates this surface at the points specified by (XI,YI) to produce ZI. The surface always goes through the data points. XI and YI are usually a uniform grid (as produced by MESHGRID) and is where GRIDDATA gets its name. XI can be a row vector, in which case it specifies a matrix with constant columns. Similarly, YI can be a column vector and it specifies a matrix with constant rows. [XI,YI,ZI] = GRIDDATA(X,Y,Z,XI,YI) also returns the XI and YI formed this way (the results of [XI,YI] = MESHGRID(XI,YI)). [...] = GRIDDATA(...,'method') where 'method' is one of 'linear' - Triangle-based linear interpolation (default). 'cubic' - Triangle-based cubic interpolation. 'nearest' - Nearest neighbor interpolation. 'v4' - MATLAB 4 griddata method. defines the type of surface fit to the data. The 'cubic' and 'v4' methods produce smooth surfaces while 'linear' and 'nearest' have discontinuities in the first and zero-th derivative respectively. All the methods except 'v4' are based on a Delaunay triangulation of the data. See also GRIDDATA3, GRIDDATAN, DELAUNAY, INTERP2, MESHGRID. |