scipy.signal.bspline#

scipy.signal.bspline(x, n)[source]#

Deprecated since version 1.11.0: scipy.signal.bspline is deprecated in SciPy 1.11 and will be removed in SciPy 1.13.

The exact equivalent (for a float array x) is:

>>> import numpy as np
>>> from scipy.interpolate import BSpline
>>> knots = np.arange(-(n+1)/2, (n+3)/2)
>>> out = BSpline.basis_element(knots)(x)
>>> out[(x < knots[0]) | (x > knots[-1])] = 0.0

B-spline basis function of order n.

Parameters:
xarray_like

a knot vector

nint

The order of the spline. Must be non-negative, i.e., n >= 0

Returns:
resndarray

B-spline basis function values

See also

cubic

A cubic B-spline.

quadratic

A quadratic B-spline.

Notes

Uses numpy.piecewise and automatic function-generator.

Examples

We can calculate B-Spline basis function of several orders:

>>> import numpy as np
>>> from scipy.signal import bspline, cubic, quadratic
>>> bspline(0.0, 1)
1
>>> knots = [-1.0, 0.0, -1.0]
>>> bspline(knots, 2)
array([0.125, 0.75, 0.125])
>>> np.array_equal(bspline(knots, 2), quadratic(knots))
True
>>> np.array_equal(bspline(knots, 3), cubic(knots))
True