[SciPy-user] interp1d question

Robert Kern robert.kern at gmail.com
Wed Oct 18 16:34:56 CDT 2006

Touma Jimmy E CTR USAF AFRL/MNGG wrote:
> Hi all,
> I am trying to interpolate in 1d along a columns as opposed to rows
> and it doesn't seem to work. The code below emulates reading data
> where interpolation should be done column wise. The error when
> running this code follows. If you could please tell me what I am doing
> wrong and how to interpolate along columns.

> /usr/lib/python2.4/site-packages/scipy/interpolate/interpolate.py in 
> __init__(self, x, y, kind, axis, copy, bounds_error, fill_value)
>     143         len_x,len_y = shape(oriented_x)[interp_axis], 
> shape(oriented_y)[interp_axis]
>     144         if len_x != len_y:
> --> 145             raise ValueError, "x and y arrays must be equal in 
> length along "\
>     146                               "interpolation axis."
>     147         if len_x < 2 or len_y < 2:
> ValueError: x and y arrays must be equal in length along interpolation 
> axis.
> WARNING: Failure executing file: <d1.py>
> In [3]: numpy.__version__
> Out[3]: '1.0b5'
> In [4]: scipy.__version__
> Out[4]: '0.3.2'

You have a *very* old version of scipy. It uses Numeric, not numpy. Please upgrade.

In recent versions, interp1d does not accept x arrays with more than one 
dimension. I'm not entirely sure why the old version did; it makes no sense.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the SciPy-user mailing list