[SciPy-User] scipy.interpolate.Rbf

Brennan Williams brennan.williams@visualreservoir....
Sun Aug 22 20:29:29 CDT 2010


  On 23/08/2010 12:54 p.m., Robert Kern wrote:
> On Sun, Aug 22, 2010 at 17:56, Brennan Williams
> <brennan.williams@visualreservoir.com>  wrote:
>> On 12/08/2010 10:24 a.m., Robert Kern wrote:
>>> On Wed, Aug 11, 2010 at 17:16, Brennan Williams
>>> <brennan.williams@visualreservoir.com>    wrote:
>>>>   I'm coding up using Rbf where the number of coordinates x,y,z.... will
>>>> vary from one dataset to another.
>>>> So I may have...
>>>>
>>>> rbfi=Rbf(x,y,z,d) for one dataset
>>>>
>>>> and then....
>>>>
>>>> rbfi=Rbf(u,v,w,x,y,z,d) for another
>>>>
>>>> This is all inside a Traits GUI app rather than in a user-editable
>>>> script.
>>>> So how should I do this?
>>> Collect the arguments in a list and use Rbf(*args).
>>>
>> See attached code example. I've put the arrays into a list and then called
>> Rbf but I'm getting...
>>
>> Traceback (most recent call last):
>>   File "F:\dev\rezen\code\testrbf.py", line 36, in<module>
>>     rbfi=Rbf(alist)
>>   File "C:\Python26\lib\site-packages\scipy\interpolate\rbf.py", line 176, in
>> __init__
>>     'All arrays must be equal length'
>> AssertionError: All arrays must be equal length
>>
>> and as far as I can tell my arrays are float32 arrays of equal length. So is
>> my syntax in calling Rbf incorrect?
> You didn't do what I said.
Fair enough.
> --- testrbf.py  2010-08-22 19:47:02.000000000 -0500
> +++ correctrbf.py       2010-08-22 19:53:31.000000000 -0500
> @@ -33,5 +33,5 @@
>   alist.append(a6)
>   print 'alist'
>   print alist
> -rbfi=Rbf(alist)
> +rbfi=Rbf(*alist)
>   print 'rbfi=',rbfi
>
Corrected, but now I get...

Traceback (most recent call last):
   File "F:\dev\rezen\code\testrbf.py", line 40, in <module>
     rbfi2=Rbf(*alist)
   File "C:\Python26\lib\site-packages\scipy\interpolate\rbf.py", line 
191, in __init__
     self.A = self._init_function(r) - eye(self.N)*self.smooth
   File "C:\Python26\lib\site-packages\scipy\interpolate\rbf.py", line 
164, in _init_function
     a0 = self._function(r)
TypeError: _h_multiquadric() takes exactly 2 arguments (3 given)

BTW I also tried out the 2D example from 
http://www.scipy.org/Cookbook/RadialBasisFunctions and I'm getting the 
same message.

I'm using EPD 6.2-2 (Python 2.6.5) under Win 7 32-bit which has scipy 
0.8.0b1 and numpy 1.4.0

Brennan






More information about the SciPy-User mailing list