[SciPy-Dev] maybe a bug into scipy.interpolate.Rbf?
Luca Penasa
luca.penasa@gmail....
Tue May 17 10:12:07 CDT 2011
scipy version 0.9.0-r1
I am trying to use scipy.interpolate.Rbf to interpolate a
multidimensional function.
I see the Rbf class permits to use a callable function as radial basis
function, but gives me an error, see below:
My self defined rbf:
def ElasticDeformationRBF(this, r):
ratio = ((r**2) / this.epsilon)
out = ratio * np.log(ratio) + 1 - ratio
return out
interpolator = scipy.interpolate.Rbf(somex, somey,
function=ElasticDeformationRBF)
The error is:
/usr/lib64/python2.6/site-packages/scipy/interpolate/rbf.pyc in
__init__(self, *args, **kwargs)
195 setattr(self, item, value)
196
--> 197 self.A = self._init_function(r) -
eye(self.N)*self.smooth
198 self.nodes = linalg.solve(self.A, self.di)
199
/usr/lib64/python2.6/site-packages/scipy/interpolate/rbf.pyc in
_init_function(self, r)
159 self._function = self.function
160 elif argcount == 2:
--> 161 if sys.version_info[0] >= 3:
162 self._function = function.__get__(self, Rbf)
163 else:
NameError: global name 'sys' is not defined
Maybe a missing import sys??
test_function_is_callable() from rbf's tests does not give any error.
help docs say, about callable function:
"If callable, then it must take 2 arguments (self, r). The epsilon
parameter will be available as self.epsilon."
So i cannot understand if it is my fault.
Any idea?
Thank you
--
---------------------------
Luca Penasa
Student at Geosciences Dpt.
University of Padua (IT)
luca.penasa@email.it
---------------------------
More information about the SciPy-Dev
mailing list