[SciPy-user] newscipy interp1d

Travis Oliphant oliphant.travis at ieee.org
Sat Dec 10 13:28:52 CST 2005


Christian Kristukat wrote:

>Christian Kristukat wrote:
>  
>
>>Hi,
>>I get errors when using scipy.interpolate.interp1d from newscipy like the following:
>>
>>x=linspace(-1,4,20)
>>y=x**2
>>ip=interp1e(x,y)
>>xn=linspace(-.5,1,200)
>>yn=ip(xn)
>>
>>Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>>   File "/usr/lib/python2.4/site-packages/scipy/interpolate/interpolate.py", 
>>line 180, in __call__
>>     putmask(y_new, new_out.ravel(), self.fill_value)
>>   File "/usr/lib/python2.4/site-packages/scipy/base/oldnumeric.py", line 187, 
>>in putmask
>>     return a.putmask(v, mask)
>>TypeError: array cannot be safely cast to required type
>>
>>I guess this a bug.?
>>
>>    
>>
This should be fixed.  Now, putmask accepts anything as the second 
argument and converts it to a BOOL array.  Previously it was only 
converting if it could do so "safely".   This was an unneccessary 
restriction. 

Scipy Core in SVN has the fix and I'll be making a new release of scipy 
core in a few days.

>
>I found out that putmask is not accepting an array object as mask, a python list 
>however is ok. I guess this is not the intended behaviour?
>  
>
The problem is that it wasn't taking anything but a BOOL array.  It 
should work better now.

-Travis




More information about the SciPy-user mailing list