scipy.interpolate.insert¶

scipy.interpolate.
insert
(x, tck, m=1, per=0)[source]¶ Insert knots into a Bspline.
Given the knots and coefficients of a Bspline representation, create a new Bspline with a knot inserted m times at point x. This is a wrapper around the FORTRAN routine insert of FITPACK.
Parameters:  x (u) : array_like
A 1D point at which to insert a new knot(s). If tck was returned from
splprep
, then the parameter values, u should be given. tck : a
BSpline
instance or a tuple If tuple, then it is expected to be a tuple (t,c,k) containing the vector of knots, the Bspline coefficients, and the degree of the spline.
 m : int, optional
The number of times to insert the given knot (its multiplicity). Default is 1.
 per : int, optional
If nonzero, the input spline is considered periodic.
Returns:  BSpline instance or a tuple
A new Bspline with knots t, coefficients c, and degree k.
t(k+1) <= x <= t(nk)
, where k is the degree of the spline. In case of a periodic spline (per != 0
) there must be either at least k interior knots t(j) satisfyingt(k+1)<t(j)<=x
or at least k interior knots t(j) satisfyingx<=t(j)<t(nk)
. A tuple is returned iff the input argument tck is a tuple, otherwise a BSpline object is constructed and returned.
Notes
Based on algorithms from [1] and [2].
Manipulating the tcktuples directly is not recommended. In new code, prefer using the
BSpline
objects.References
[1] (1, 2) W. Boehm, “Inserting new knots into bspline curves.”, Computer Aided Design, 12, p.199201, 1980. [2] (1, 2) P. Dierckx, “Curve and surface fitting with splines, Monographs on Numerical Analysis”, Oxford University Press, 1993.