[SciPy-Dev] empty input to spline from UnivariateSpline

Pauli Virtanen pav@iki...
Wed Jul 28 05:55:24 CDT 2010

Wed, 28 Jul 2010 18:36:12 +0800, Ralf Gommers wrote:
> In ticket http://projects.scipy.org/scipy/ticket/1014 there is a request
> to return an empty array instead of getting an error when an empty array
> is passed to the spline object generated by UnivariateSpline. This is
> easy to fix, but is it the desired behavior? The submitter wants an
> empty array, maybe other users would want an exception. Change this or
> not?

x = UnivariateSpline(...)
x([]) == np.array([])

is the correct behavior, IMO. The user is asking for the interpolant 
evaluated at 0 input points -- so the correct result is the interpolant 
at 0 input points, i.e., an empty array.

That's what we do with sin, cos, and other ufuncs, and since the 
interpolant is also essentially a function, it should behave in the same 

Pauli Virtanen

More information about the SciPy-Dev mailing list