[Scipy-svn] r4869 - trunk/scipy/interpolate/tests

scipy-svn@scip... scipy-svn@scip...
Sat Nov 1 07:01:10 CDT 2008


Author: ptvirtan
Date: 2008-11-01 07:00:34 -0500 (Sat, 01 Nov 2008)
New Revision: 4869

Modified:
   trunk/scipy/interpolate/tests/test_rbf.py
Log:
interpolate.Rbf: Test all available basis functions

Modified: trunk/scipy/interpolate/tests/test_rbf.py
===================================================================
--- trunk/scipy/interpolate/tests/test_rbf.py	2008-11-01 12:00:05 UTC (rev 4868)
+++ trunk/scipy/interpolate/tests/test_rbf.py	2008-11-01 12:00:34 UTC (rev 4869)
@@ -4,36 +4,39 @@
 
 from numpy.testing import assert_array_almost_equal
 from numpy import linspace, sin, random, exp
-
-
 from scipy.interpolate.rbf import Rbf
 
+FUNCTIONS = ('multiquadric', 'inverse multiquadric', 'gaussian',
+             'cubic', 'quintic', 'thin-plate')
 
-def test_rbf1d():
+def check_rbf1d(function):
     x = linspace(0,10,9)
     y = sin(x)
-    rbf = Rbf(x, y)
+    rbf = Rbf(x, y, function=function)
     yi = rbf(x)
     assert_array_almost_equal(y, yi)
 
-def test_rbf2d():
+def check_rbf2d(function):
     x = random.rand(50,1)*4-2
     y = random.rand(50,1)*4-2
     z = x*exp(-x**2-y**2)
-    rbf = Rbf(x, y, z ,epsilon=2)
+    rbf = Rbf(x, y, z, epsilon=2, function=function)
     zi = rbf(x, y)
     zi.shape = x.shape
     assert_array_almost_equal(z, zi)
 
-def test_rbf3d():
+def check_rbf3d(function):
     x = random.rand(50,1)*4-2
     y = random.rand(50,1)*4-2
     z = random.rand(50,1)*4-2
     d = x*exp(-x**2-y**2)
-    rbf = Rbf(x, y, z, d ,epsilon=2)
+    rbf = Rbf(x, y, z, d, epsilon=2, function=function)
     di = rbf(x, y, z)
     di.shape = x.shape
     assert_array_almost_equal(di, d)
 
-if __name__ == "__main__":
-    run_module_suite()
+def test_rbf_interpolation():
+    for function in FUNCTIONS:
+        yield check_rbf1d, function
+        yield check_rbf2d, function
+        yield check_rbf3d, function



More information about the Scipy-svn mailing list