scipy.interpolate.Rbf¶
-
class
scipy.interpolate.
Rbf
(*args)[source]¶ A class for radial basis function approximation/interpolation of n-dimensional scattered data.
- Parameters
- *argsarrays
x, y, z, …, d, where x, y, z, … are the coordinates of the nodes and d is the array of values at the nodes
- functionstr or callable, optional
The radial basis function, based on the radius, r, given by the norm (default is Euclidean distance); the default is ‘multiquadric’:
'multiquadric': sqrt((r/self.epsilon)**2 + 1) 'inverse': 1.0/sqrt((r/self.epsilon)**2 + 1) 'gaussian': exp(-(r/self.epsilon)**2) 'linear': r 'cubic': r**3 'quintic': r**5 'thin_plate': r**2 * log(r)
If callable, then it must take 2 arguments (self, r). The epsilon parameter will be available as self.epsilon. Other keyword arguments passed in will be available as well.
- epsilonfloat, optional
Adjustable constant for gaussian or multiquadrics functions - defaults to approximate average distance between nodes (which is a good start).
- smoothfloat, optional
Values greater than zero increase the smoothness of the approximation. 0 is for interpolation (default), the function will always go through the nodal points in this case.
- normstr, callable, optional
A function that returns the ‘distance’ between two points, with inputs as arrays of positions (x, y, z, …), and an output as an array of distance. E.g., the default: ‘euclidean’, such that the result is a matrix of the distances from each point in
x1
to each point inx2
. For more options, see documentation of scipy.spatial.distances.cdist.
Examples
>>> from scipy.interpolate import Rbf >>> x, y, z, d = np.random.rand(4, 50) >>> rbfi = Rbf(x, y, z, d) # radial basis function interpolator instance >>> xi = yi = zi = np.linspace(0, 1, 20) >>> di = rbfi(xi, yi, zi) # interpolated values >>> di.shape (20,)
- Attributes
- Nint
The number of data points (as determined by the input arrays).
- dindarray
The 1-D array of data values at each of the data coordinates xi.
- xindarray
The 2-D array of data coordinates.
- functionstr or callable
The radial basis function. See description under Parameters.
- epsilonfloat
Parameter used by gaussian or multiquadrics functions. See Parameters.
- smoothfloat
Smoothing parameter. See description under Parameters.
- normstr or callable
The distance function. See description under Parameters.
- nodesndarray
A 1-D array of node values for the interpolation.
- Ainternal property, do not use
Methods
__call__
(*args)Call self as a function.