[Numpy-discussion] Using interpolate with zero-rank array raises error
Ralf Gommers
ralf.gommers@googlemail....
Fri Jul 17 12:27:25 CDT 2009
On Fri, Jul 17, 2009 at 9:51 AM, Tony Yu <tsyu80@gmail.com> wrote:
>
> Date: Thu, 16 Jul 2009 23:37:58 -0400
> From: Ralf Gommers <ralf.gommers@googlemail.com>
>
> It seems to me that there are quite a few other functions that will give
> errors with 0-D arrays (apply_along/over_axis are two that come to mind).
> There is nothing to interpolate so I'm not surprised.
>
>
> Hmm, I don't quite understand. In the example below, the 0-D array (`x0`)
> gives the x-value(s) where you want interpolated values. This shouldn't
> require a non-scalar, and in fact, interp currently accepts python scalars
> (but not Numpy scalars).
>
> If the 0-D array replaced `x` and `y`---the known data points--- then, I
> agree there would be nothing to interpolate. I believe the example functions
> you cite are similar to replacing `x` and `y` below with scalar values.
>
You're right, sorry for the confusion, i did swap the roles of x/y with that
of x0 in my mind. That's what I get for writing emails at midnight.
If it works with scalars it should work with 0-D arrays I think. So you
should probably open a ticket and attach your patch.
Cheers,
Ralf
> ... or am I just missing something?
>
> Thanks,
> -Tony
>
>
> When using interpolate with a zero-rank array, I get "ValueError:
>
> object of too small depth for desired array". The following code
>
> reproduces this issue
>
>
> import numpy as np
>
> x0 = np.array(0.1)
>
> x = np.linspace(0, 1)
>
> y = np.linspace(0, 1)
>
> np.interp(x0, x, y)
>
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090717/9670283e/attachment.html
More information about the NumPy-Discussion
mailing list