[SciPy-dev] possible bug in interp1d
John Byrnes
byrnes at bu.edu
Thu Dec 8 00:32:48 CST 2005
In order to get interp1d to work, I commented out the putmask line in
interpolate.py. In my case, I'm dealing with generated data, so there
aren't any dropouts. It seems to work.
John
On Wed, Dec 07, 2005 at 10:21:00AM -0500, Darren Dale wrote:
> 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
>
> reminder of the test script:
>
> from scipy import *
> a = arange(100)
> b = arange(10,90,100)
> i = interpolate.interp1d(a,a)
> i(b)
>
> I checked the values of a and v in putmask. a has dtype 'l', and v is nan. I
> dont understand the TypeError, since a[1]=nan doesn't raise one (it just sets
> a[2] equal to 0).
> If I change the dtype of a to 'f' and keep b the same, I get the following:
>
> /usr/lib64/python2.4/site-packages/scipy/interpolate/interpolate.py in
> __call__(self, x_new)
> 150 # would be inserted.
> 151 # Note: If x_new[n] = x[m], then m is returned by
> searchsorted.
> --> 152 x_new_indices = searchsorted(self.x,x_new)
> 153 # 3. Clip x_new_indices so that they are within the range of
> 154 # self.x indices and at least 1. Removes mis-interpolation
>
> /usr/lib64/python2.4/site-packages/scipy/base/oldnumeric.py in searchsorted(a,
> v)
> 235 a = array(a,copy=False)
> 236 print a.dtypechar, a, v
> --> 237 return a.searchsorted(v)
> 238
> 239 def resize(a, new_shape):
>
> TypeError: array cannot be safely cast to required type
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-dev
--
When a man sits with a pretty girl for an hour, it seems like a minute.
But let him sit on a hot stove for a minute -- and it's longer than any
hour. That's relativity.
-- Albert Einstein
More information about the Scipy-dev
mailing list