[SciPy-user] SciPy cubic interpolation coefficients

Celvin read.beyond.data@gmx....
Sun Jun 21 15:13:43 CDT 2009


josef.pktd@gmail.com @ Jun, 21, 2009 09:23PM

> 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.
Yes, I did try using UnivariateSpline. Apart from being "more off"
than using splrep with a smoothing factor of 0, get_coeffs() also
returns an 1-d array, with far too few coefficients.

Assuming a signal with about 390 data points, I also expect about
390 coefficients (which is consistent with what I get using
signal.cspline1d for example, but I need 4 arrays, not just one).

I would expect coefficients to be a list of shape

coeff = [ [a0, b0, c0, d0],
          [a1, b1, c1, d1],
          [a2, b1, c2, d2],
          ...
          ...
          [an, bn, cn, dn],
        ]

but I am only able to obtain 1-d array of coefficients, no matter what
function or module I use.

http://www.physics.utah.edu/~detar/phys6720/handouts/cubic_spline/cubic_spline/node1.html

...is basically what I'm looking for. I used to do the matrix
calculations for Si(x) myself using C++, but I'd prefer to somehow get the
coefficients using numpy/scipy and not use an extension.

Any further ideas?



More information about the SciPy-user mailing list