[SciPy-user] Change in behaviour of interpolate.interp1d

Jeremy Sanders jeremy at jeremysanders.net
Tue Mar 3 06:08:23 EST 2009


Hi - I just got hit by the change in behaviour of interpolate.interp1d as 
Fedora have just pushed scipy 0.7.0.

The Scipy release notes seem to be inaccurate to me, as they say:

The shape of return values from ``scipy.interpolate.interp1d`` used to
be incorrect, if interpolated data had more than 2 dimensions and the
axis keyword was set to a non-default value. This has been fixed.
Users of ``scipy.interpolate.interp1d`` may need to revise their code
if it relies on the incorrect behavior.
However I'm only using 1D interpolation. The function used to return a 1D
array as a result. Now it returns a 0D array:
In [1]: import scipy.interpolate.interpolate
In [2]: import numpy

In [3]: f = scipy.interpolate.interpolate.interp1d( numpy.array([1,2,3,4]), 
numpy.array([1,2,3,4]), kind='cubic')

In [4]: f(3.1)
Out[4]: array(3.1000000000000019)

Maybe the release notes should be changed?

Jeremy





More information about the SciPy-User mailing list