Menu

[r6270]: / trunk / toolkits / natgrid / test.py  Maximize  Restore  History

Download this file

16 lines (15 with data), 475 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from matplotlib.mlab import griddata
import numpy as np
# test case that scikits.delaunay fails on, but natgrid passes..
data = np.array([[-1, -1], [-1, 0], [-1, 1],
[ 0, -1], [ 0, 0], [ 0, 1],
[ 1, -1 - np.finfo(np.float_).eps], [ 1, 0], [ 1, 1],
])
x = data[:,0]
y = data[:,1]
z = x*np.exp(-x**2-y**2)
# define grid.
xi = np.linspace(-1.1,1.1,100)
yi = np.linspace(-1.1,1.1,100)
# grid the data.
zi = griddata(x,y,z,xi,yi)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.