[SciPy-user] SciPy cubic interpolation coefficients

josef.pktd@gmai... josef.pktd@gmai...
Sun Jun 21 14:23:27 CDT 2009


On Sun, Jun 21, 2009 at 1:59 PM, Celvin<read.beyond.data@gmx.net> wrote:
>
> Hi all,
>
> I'm currently porting some old FORTRAN code over to Python.
> The code makes heavy use of cubic spline coefficients obtained by
> interpolating a given signal.
>
> Now, while I know that I can obtain coefficients using
> scipy.signal.cspline1d or scipy.interpolate.splrep, all I get is an
> 1-d array.
>
> I'd like to know how to obtain coefficient arrays a, b, c and d to
> be able to use the familiar cubic polynomial a[i]*x*x*x + b[i]*x*x +
> c[i]*x + d[i]. I know how to evaluate the resulting spline, but I
> actually need those coefficients for several calculations.
>
> Any insights on how to do this using SciPy?
>

Did you try
UnivariateSpline.get_coeffs()

UnivariateSpline.get_knots()

>From my experiments with interpolate splines, I would think this
provides what you want. But the documentation is still a bit sparse.

Josef


> Regards,
> Celvin


More information about the SciPy-user mailing list