rgpycrumbs.interpolation

Functions

spline_interp(x, y[, num, knots])

Interpolate using B-splines.

Module Contents

rgpycrumbs.interpolation.spline_interp(x, y, num=100, knots=3)[source]

Interpolate using B-splines.

Fits a B-spline representation to the data (x, y) and evaluates it on a uniformly spaced grid.

Args:
x: Independent variable values (1D array, must be monotonically

increasing).

y: Dependent variable values (same length as x). num: Number of evaluation points on the output grid. knots: Degree of the spline (passed as k to

scipy.interpolate.splrep).

Returns:

tuple: (x_fine, y_fine) where x_fine is a uniform grid of length num spanning [x.min(), x.max()] and y_fine is the spline evaluated on that grid.

Added in version 1.0.0.