RectBivariateSpline#
- class scipy.interpolate.RectBivariateSpline(x, y, z, bbox=[None, None, None, None], kx=3, ky=3, s=0, maxit=20)[source]#
Bivariate spline approximation over a rectangular mesh.
Can be used for both smoothing and interpolating data.
- Parameters:
- x,yarray_like
1-D arrays of coordinates in strictly ascending order. Evaluated points outside the data range will be extrapolated.
- zarray_like
2-D array of data with shape (x.size,y.size).
- bboxarray_like, optional
Sequence of length 4 specifying the boundary of the rectangular approximation domain, which means the start and end spline knots of each dimension are set by these values. 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((z[i]-f(x[i], y[i]))**2, axis=0) <= swhere f is a spline function. Default iss=0, which is for interpolation.- maxitint, optional
The maximal number of iterations maxit allowed for finding a smoothing spline with fp=s. Default is
maxit=20.
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
Return spline coefficients.
Return a tuple (tx,ty) where tx,ty contain knots positions of the spline with respect to x-, y-variable, respectively.
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.
See also
BivariateSplinea base class for bivariate splines.
UnivariateSplinea smooth univariate spline to fit a given set of data points.
SmoothBivariateSplinea smoothing bivariate spline through the given points
LSQBivariateSplinea bivariate spline using weighted least-squares fitting
RectSphereBivariateSplinea bivariate spline over a rectangular mesh on a sphere
SmoothSphereBivariateSplinea smoothing bivariate spline in spherical coordinates
LSQSphereBivariateSplinea bivariate spline in spherical coordinates using weighted least-squares fitting
bisplrepa function to find a bivariate B-spline representation of a surface
bispleva function to evaluate a bivariate B-spline and its derivatives
Notes
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.