evaluate_bspline

sofia_redux.toolkit.splines.spline_utils.evaluate_bspline(knot_line, degree, x, knot_index, spline=None)[source]

Evaluate b-splines for given knots at a coordinate.

Evaluates the (degree + 1) non-zero b-splines at t[i] <= x < t[i + 1] where t is the line of knots knot_line and i is the knot_index. This uses the stable recurrence relation of DeBoor and Cox (2007).

Parameters:
knot_linenumpy.ndarray (float)

The line of monotonically increasing knots of shape (>=n_knots).

degreeint

The degree of spline to evaluate.

xfloat

The coordinate at which the spline should be evaluated.

knot_indexint

The index (i) of the knot satisfying t[i] <= x < t[i + 1] where t is the knot_line.

splinenumpy.ndarray (float), optional

An optionally created array to hold the results of this function of shape (>=degree + 1).

Returns:
splinenumpy.ndarray (float)

The output spline of shape (degree + 1) if spline is not supplied as an input parameter, or (spline.size,) otherwise.