[SciPy-dev] bug in array.putmask (was possible bug in interp1d)

Darren Dale dd55 at cornell.edu
Thu Dec 8 08:25:32 CST 2005


On Wednesday 07 December 2005 07:57, Tyler W. Wilson wrote:
> Well, that fixed the that issue, but now I get the following:
>
>   File "E:\Python24\Lib\site-packages\scipy\interpolate\interpolate.py",
> line 180, in __call__
>     putmask(y_new, new_out.ravel(), self.fill_value)
>   File "E:\Python24\Lib\site-packages\scipy\base\oldnumeric.py", line
> 170, in putmask
>     return a.putmask(v, mask)
> TypeError: array cannot be safely cast to required type

Line 179 in scipy/Lib/interpolate/interpolate.py can be changed from

        new_out = ones(new_shape)*out_of_bounds

to

        new_out = ones(new_shape, '?')*out_of_bounds

But that raises a new question. I dont understand why this raises a casting 
error:

ones(10).putmask(0.01, ones(10))

and this does not:

ones(10).astype('?')




More information about the Scipy-dev mailing list