# [SciPy-User] Splines in scipy.signal vs scipy.interpolation

denis denis-bz-gg@t-online...
Wed Feb 10 11:38:14 CST 2010

```On Feb 9, 6:05 pm, Zachary Pincus <zachary.pin...@yale.edu> wrote:

>
> I had always thought that the splines produced by fitpack were plain
> (and local) non-uniform B-splines (as opposed to the uniform kind,
> which Denis's really helpful demo code uses). However, the way that
> those B-splines are fit to the given data by fitpack is definitely
> global and can lead to odd artifacts if you're incautious.
>
> Is this correct?
>
> Then is reason that the B-splines from scipy.interpolate.fitpack and
> from scipy.signal are a bit different is that the latter are also
> strictly uniform? (E.g. evenly-spaced knot vector.) Probably this is
> easy to test...

Zach,
if UnivariateSpline were local, its response to 0 0 1 0 0 1000
should be 0 0 1 0 ...
i.e. shouldn't see the 1000, right ?  Doesn't look so --

""" is scipy UnivariateSpline local ?  1 0 0 1000 """
from __future__ import division
import numpy as np
from scipy.interpolate import UnivariateSpline  # fitpack
import pylab as pl

N = 10
H = 10
NH = N * H
N2 = N//2
x = np.arange(N+1)
y = np.zeros(N+1);  y[N2] = 1;  y[N2+3] = 1000
xup = np.arange( 0, N, 1/H )  # N * H
np.set_printoptions( 1, threshold=100, edgeitems=3*H, suppress=True )
# .1f

#..............................................................................
title = __doc__
interpolator = UnivariateSpline( x, y, k=3, s=0 )  # s=0 interpolates
yup = interpolator( xup )
print "yup:", yup[N2*H - 1 : (N2+3)*H]

pl.title( title )
pl.plot( xup, yup )
ax = pl.gca()
ax.set_xlim( N2 - 1, N2 + 5 )
ax.set_ylim( -10, 10 )
pl.show()

The real problem imho is that the doc doesn't say
"we have more software, with less doc, than at any time in history"

cheers
-- denis
```