pttools.speedup.spline

Spline interpolation utilities

These are implemented manually, as SciPy libraries don’t expose the interfaces of the Fortran functions. Only their wrappers written in C are exposed, but those expect Python objects and therefore aren’t callable from Numba without the use of object mode.

Functions

pttools.speedup.spline.fitpack_spl_(x, nu, t, c, k, e)

Numba implementation of the SciPy C wrapper for spline interpolation.

Parameters:
  • x (ndarray) – points to interpolate at

  • t (ndarray) – knots

  • nu (int) – order of the derivative to be taken

  • c (ndarray) – B-spline coefficients

  • k (int) – degree of the spline

  • e (int) – whether to extend the spline beyond the knot data

pttools.speedup.spline.splev(x, tck, der=0, ext=0)

Modified from scipy.interpolate.splev(). See the SciPy documentation for details.

Parameters:
  • x (ndarray) – 1D array

  • tck (Tuple[ndarray, ndarray, int]) – Tuple of spline parameters as given by scipy.interpolate.splrep()

  • der (int) – order of derivative to be computed

  • ext (int) – Extrapolation: 0 = extrapolate, 1 = return 0, 2 = raise ValueError, 3 = return the boundary value

pttools.speedup.spline.splev_linear(x, tck, der=0, ext=0)
Parameters:
  • x – float or 1D array

  • tck (Tuple[ndarray, ndarray, int]) – Tuple of spline parameters as given by scipy.interpolate.splrep()

  • der (int) – order of derivative to be computed

  • ext (int) – Extrapolation: 0 = extrapolate, 1 = return 0, 2 = raise ValueError, 3 = return the boundary value

pttools.speedup.spline.splev_linear_arr(x, tck, der=0, ext=0)
Parameters:
pttools.speedup.spline.splev_linear_core(xp, t, c, ext)
Parameters:
Return type:

float

pttools.speedup.spline.splev_linear_scalar(x, tck, der=0, ext=0)
Parameters:
pttools.speedup.spline.splev_linear_validate(k, der)
Parameters:
  • k (int)

  • der (int)

Return type:

None