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

denis denis-bz-gg at t-online.de
Thu Jan 28 09:20:20 EST 2010



On Jan 20, 11:56 pm, Tony S Yu <ton... at MIT.EDU> wrote:
> I'm having trouble making splines from scipy.signal work with those in scipy.interpolation.
>
> Both packages have functions for creating (`signal.cspline1d`/`interpolate.splrep`) and evaluating (`signal.cspline1d_eval`/`interpolate.splev`) splines. There are, of course, huge differences between these functions, which is why I'm trying to get them to talk to each other.
>
> In particular, I'd like to create a smoothing spline using `cspline1d` (which allows easier smoothing) and evaluate using `splev` (which allows me to get derivatives of the spline).

Tony,
  bouncing between two murky packages doesn't sound as though it'll
converge ...
interpolate though has both smoothing and derivs --
        interpolator = interpolate.UnivariateSpline( x, y, k=3, s=s )
# s=0 interpolates
        yy = interpolator( xx )
        y1 = interpolator( xx, 1 )  # deriv

Just curious, are your real knots uniform, how many ?

See also http://projects.scipy.org/scipy/ticket/864
"The documentation for class scipy.interpolate.UnivariateSpline? is
misleading, and maybe completely wrong.
UnivariateSpline? behaves in ways that are unpredictable ...
(Fitpack is just a big dense package => big dense doc.)

cheers
  -- denis





More information about the SciPy-User mailing list