[Scipy-svn] r4868 - trunk/scipy/interpolate

scipy-svn@scip... scipy-svn@scip...
Sat Nov 1 07:00:24 CDT 2008


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

Modified:
   trunk/scipy/interpolate/rbf.py
Log:
interpolate.Rbf: fix thin-plate spline interpolation

Modified: trunk/scipy/interpolate/rbf.py
===================================================================
--- trunk/scipy/interpolate/rbf.py	2008-11-01 11:59:38 UTC (rev 4867)
+++ trunk/scipy/interpolate/rbf.py	2008-11-01 12:00:05 UTC (rev 4868)
@@ -42,7 +42,8 @@
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 """
 
-from numpy import sqrt, log, asarray, newaxis, all, dot, float64, exp, eye
+from numpy import (sqrt, log, asarray, newaxis, all, dot, float64, exp, eye,
+                   isnan)
 from scipy import linalg
 
 class Rbf(object):
@@ -109,7 +110,9 @@
         elif self.function.lower() == 'quintic':
             return r**5
         elif self.function.lower() == 'thin-plate':
-            return r**2 * log(r)
+            result = r**2 * log(r)
+            result[r == 0] = 0 # the spline is zero at zero
+            return result
         else:
             raise ValueError, 'Invalid basis function name'
 



More information about the Scipy-svn mailing list