SciPy

scipy.interpolate.bisplrep

scipy.interpolate.bisplrep(x, y, z, w=None, xb=None, xe=None, yb=None, ye=None, kx=3, ky=3, task=0, s=None, eps=1e-16, tx=None, ty=None, full_output=0, nxest=None, nyest=None, quiet=1)[source]

Find a bivariate B-spline representation of a surface.

Given a set of data points (x[i], y[i], z[i]) representing a surface z=f(x,y), compute a B-spline representation of the surface. Based on the routine SURFIT from FITPACK.

Parameters
x, y, zndarray

Rank-1 arrays of data points.

wndarray, optional

Rank-1 array of weights. By default w=np.ones(len(x)).

xb, xefloat, optional

End points of approximation interval in x. By default xb = x.min(), xe=x.max().

yb, yefloat, optional

End points of approximation interval in y. By default yb=y.min(), ye = y.max().

kx, kyint, optional

The degrees of the spline (1 <= kx, ky <= 5). Third order (kx=ky=3) is recommended.

taskint, optional

If task=0, find knots in x and y and coefficients for a given smoothing factor, s. If task=1, find knots and coefficients for another value of the smoothing factor, s. bisplrep must have been previously called with task=0 or task=1. If task=-1, find coefficients for a given set of knots tx, ty.

sfloat, optional

A non-negative smoothing factor. If weights correspond to the inverse of the standard-deviation of the errors in z, then a good s-value should be found in the range (m-sqrt(2*m),m+sqrt(2*m)) where m=len(x).

epsfloat, optional

A threshold for determining the effective rank of an over-determined linear system of equations (0 < eps < 1). eps is not likely to need changing.

tx, tyndarray, optional

Rank-1 arrays of the knots of the spline for task=-1

full_outputint, optional

Non-zero to return optional outputs.

nxest, nyestint, optional

Over-estimates of the total number of knots. If None then nxest = max(kx+sqrt(m/2),2*kx+3), nyest = max(ky+sqrt(m/2),2*ky+3).

quietint, optional

Non-zero to suppress printing of messages. This parameter is deprecated; use standard Python warning filters instead.

Returns
tckarray_like

A list [tx, ty, c, kx, ky] containing the knots (tx, ty) and coefficients (c) of the bivariate B-spline representation of the surface along with the degree of the spline.

fpndarray

The weighted sum of squared residuals of the spline approximation.

ierint

An integer flag about splrep success. Success is indicated if ier<=0. If ier in [1,2,3] an error occurred but was not raised. Otherwise an error is raised.

msgstr

A message corresponding to the integer flag, ier.

Notes

See bisplev to evaluate the value of the B-spline given its tck representation.

References

1

Dierckx P.:An algorithm for surface fitting with spline functions Ima J. Numer. Anal. 1 (1981) 267-283.

2

Dierckx P.:An algorithm for surface fitting with spline functions report tw50, Dept. Computer Science,K.U.Leuven, 1980.

3

Dierckx P.:Curve and surface fitting with splines, Monographs on Numerical Analysis, Oxford University Press, 1993.

Examples

Examples are given in the tutorial.

Previous topic

scipy.interpolate.LSQSphereBivariateSpline.get_residual

Next topic

scipy.interpolate.bisplev