Skip to main content

Module b_spline

Module b_spline 

Source
Expand description

B-splines of any degree, following scipy.interpolate: the BSpline type (evaluation, derivatives, antiderivatives and integrals), interpolating splines with a choice of end conditions (make_interp_spline), least-squares splines on given knots (make_lsq_spline) and parametric interpolating curves (make_interp_curve).

A spline of degree k with knots t₀ ≤ t₁ ≤ … ≤ t_{n+k} is a sum s(x) = Σ cⱼ Bⱼ,ₖ(x) of the B-spline basis functions, each a piecewise polynomial of degree k that is non-zero only on [tⱼ, tⱼ₊ₖ₊₁). They are evaluated by the Cox-de Boor recurrence, and an interpolating spline is found by solving a banded linear system for the coefficients.

See the book entry B-splines and smoothing splines.

Structs§

BSpline
A spline s(x) = Σ cⱼ Bⱼ,ₖ(x) of degree k in the B-spline basis (SciPy’s BSpline).

Enums§

BoundaryCondition
End conditions for make_interp_spline (SciPy’s bc_type).
Extrapolate
What a BSpline returns outside its base interval [t_k, t_n].

Functions§

make_interp_curve
An interpolating parametric curve through the rows of points (an n × d array): the parameter is the cumulative chord length normalised to [0, 1] (as splprep chooses it), and each coordinate is interpolated with make_interp_spline. Returns the parameter values and one spline per coordinate.
make_interp_spline
The interpolating spline of degree k through (x, y) (SciPy’s make_interp_spline).
make_lsq_spline
The least-squares spline of degree k on the knots t: minimises Σ (wᵢ (yᵢ − s(xᵢ)))² (SciPy’s make_lsq_spline; note that the weights multiply the residuals, not their squares). The data must satisfy the Schoenberg-Whitney conditions (each basis function must be non-zero at some data point) for the solution to be unique.
nonzero_basis
The k + 1 B-splines of degree k that are non-zero on the knot interval t[l] ≤ x < t[l + 1], namely B_{l−k}, …, B_l, by the Cox-de Boor recurrence (de Boor’s bsplvb). Each degree is built from the previous one; the values are non-negative and sum to one.
nonzero_basis_derivatives
The nu-th derivatives of the k + 1 B-splines that are non-zero on interval l, from the basis of degree k − nu and the derivative formula B'ⱼ,ₖ = k (Bⱼ,ₖ₋₁ / (tⱼ₊ₖ − tⱼ) − Bⱼ₊₁,ₖ₋₁ / (tⱼ₊ₖ₊₁ − tⱼ₊₁)).