SmoothBivariateSpline — SciPy v1.15.3 Manual (original) (raw)
scipy.interpolate.
class scipy.interpolate.SmoothBivariateSpline(x, y, z, w=None, bbox=[None, None, None, None], kx=3, ky=3, s=None, eps=1e-16)[source]#
Smooth bivariate spline approximation.
Parameters:
x, y, zarray_like
1-D sequences of data points (order is not important).
warray_like, optional
Positive 1-D sequence of weights, of same length as x, y and z.
bboxarray_like, optional
Sequence of length 4 specifying the boundary of the rectangular approximation domain. By default,bbox=[min(x), max(x), min(y), max(y)]
.
kx, kyints, optional
Degrees of the bivariate spline. Default is 3.
sfloat, optional
Positive smoothing factor defined for estimation condition:sum((w[i]*(z[i]-s(x[i], y[i])))**2, axis=0) <= s
Default s=len(w)
which should be a good value if 1/w[i]
is an estimate of the standard deviation of z[i]
.
epsfloat, optional
A threshold for determining the effective rank of an over-determined linear system of equations. eps should have a value within the open interval (0, 1)
, the default is 1e-16.
Notes
The length of x, y and z should be at least (kx+1) * (ky+1)
.
If the input data is such that input dimensions have incommensurate units and differ by many orders of magnitude, the interpolant may have numerical artifacts. Consider rescaling the data before interpolating.
This routine constructs spline knot vectors automatically via the FITPACK algorithm. The spline knots may be placed away from the data points. For some data sets, this routine may fail to construct an interpolating spline, even if one is requested via s=0
parameter. In such situations, it is recommended to use bisplrep / bisplev directly instead of this routine and, if needed, increase the values of nxest
and nyest
parameters of bisplrep.
For linear interpolation, prefer LinearNDInterpolator. See https://gist.github.com/ev-br/8544371b40f414b7eaf3fe6217209bff
for discussion.
Methods
__call__(x, y[, dx, dy, grid]) | Evaluate the spline or its derivatives at given positions. |
---|---|
ev(xi, yi[, dx, dy]) | Evaluate the spline at points |
get_coeffs() | Return spline coefficients. |
get_knots() | Return a tuple (tx,ty) where tx,ty contain knots positions of the spline with respect to x-, y-variable, respectively. |
get_residual() | Return weighted sum of squared residuals of the spline approximation: sum ((w[i]*(z[i]-s(x[i],y[i])))**2,axis=0) |
integral(xa, xb, ya, yb) | Evaluate the integral of the spline over area [xa,xb] x [ya,yb]. |
partial_derivative(dx, dy) | Construct a new spline representing a partial derivative of this spline. |