Barak 0.3.2 documentation

barak.interp.CubicSpline

«  barak.interp.AkimaSpline   ::   Contents   ::   barak.interp.CubicSpline.set_d2  »

barak.interp.CubicSpline

class barak.interp.CubicSpline(x, y, firstderiv=None, lastderiv=None, nochecks=False)[source]

Class to generate a cubic spline through a set of points.

After initialisation, an instance can be called with an array of values xp, and will return the cubic-spline interpolated values yp = f(xp).

The spline can be reset to use a new first and last derivative while still using the same initial points by calling the set_d2() method.

If you want to calculate a new spline using a different set of x and y values, you’ll have to instantiate a new class.

The spline generation is based on the NR algorithms (but not their code.)

__init__(x, y, firstderiv=None, lastderiv=None, nochecks=False)[source]
Parameters :

x, y : arrays of floats, shape (N,)

x and y = f(x).

firstderiv : float (None)

Derivative of f(x) at x[0]

lastderiv : float (None)

Derivative of f(x) at x[-1]

nochecks : bool (False)

If False, check the x array is sorted and unique. Set to True for increased speed.

Methods

__init__(x, y[, firstderiv, lastderiv, nochecks])
Parameters:
set_d2([firstderiv, lastderiv, verbose]) Calculates the second derivative of a cubic spline function y = f(x) for each value in array x.

«  barak.interp.AkimaSpline   ::   Contents   ::   barak.interp.CubicSpline.set_d2  »