[SciPy-user] interp1d question

Touma Jimmy E CTR USAF AFRL/MNGG jimmy.touma.ctr at eglin.af.mil
Thu Oct 19 08:29:50 CDT 2006

Thanks Robert. I will update my version. However, x is an array with one
dimension(Mx1). 'u' on the other hand is an array with MxN dimensions and I
was wanting to interpolate column wise as opposed to row wise (that'll save
me a couple of operation after reading the data in from a file)


PS. It works row wise...

-----Original Message-----
From: scipy-user-bounces at scipy.org [mailto:scipy-user-bounces at scipy.org] On
Behalf Of Robert Kern
Sent: Wednesday, October 18, 2006 4:35 PM
To: SciPy Users List
Subject: Re: [SciPy-user] interp1d question

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

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
  an underlying truth."
   -- Umberto Eco
SciPy-user mailing list
SciPy-user at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20061019/c0ea9151/attachment.html 

More information about the SciPy-user mailing list