scipy/scipy — pull request #197 by jpaalasm (2012-04-20 09:42:14+00:00)
Title: Fix incorrect output shape of UnivariateSpline

The shape of the output of UnivariateSpline.\_\_call\_\_ does not match the shape of the input when the input is a one-item array. The behavior is unexpected and leads to bugs.

In [1]: import scipy.interpolate
In [2]: f = scipy.interpolate.UnivariateSpline([1,2,3,4], [1,2,3,4])

In [3]: f(1)
Out[3]: 0.99999999999999956

In [4]: f([1])
Out[4]: 0.9999999999999995

In [5]: f([1, 2])
Out[5]: array([ 1., 2.])

The consistent bahavior would be f([1]) -> [1.0] rather than the current f([1]) -> 1.0

I added the keyword new_behavior=False, that retains the current erroneous behavior so that existing code does not break.

See http://projects.scipy.org/scipy/ticket/1534