Interpolator
Interpolator( x, y, method='linear', coords='real_imag', extrapolation='extrapolate', parameter_names=None,)Interpolator object.
Args
- x (Sequence[float] | Sequence[Sequence[float]]): Independent variable (parameter) values.
- y (Sequence[float | complex] | Sequence[Sequence[float | complex]]): Dependent variable values. Multiple variables sharing the same parameter values can be interpolated simultaneously by setting to a sequence of vectors.
- method (str): Interpolation method. See table below for options.
- coords (Literal[“mag_phase”, “real_imag”]): Coordinate system used for interpolation of complex values.
- extrapolation (Literal[“extrapolate”, “constant”]): Extrapolation strategy for query points outside the sampled interval (1D only).
"extrapolate"continues the interpolant;"constant"clamps query points to the sample boundaries. - parameter_names (Sequence[str] | None): Optional names for each parameter.
===================== ================================================
Interpolation method Description
===================== ================================================
"linear" Linear interpolation between neighboring points
"barycentric" Barycentric Lagrange interpolation
"cubicspline" Cubic spline interpolation
"pchip" Piecewise cubic Hermite interpolating polynomial
"akima" Akima interpolation
"makima" Modified Akima interpolation
===================== ================================================
Examples
>>> interp = pf.Interpolator([0, 1, 2], [-1, 1, 1])>>> interp([0, 1.5])array([-1., 1.])>>> interp = pf.Interpolator([0, 1, 2], [[-1, 1, 1], [0, -1, -2]])>>> interp([0.5, 1, 3])array([[ 0. , 1. , 1. ], [-0.5, -1. , -3. ]])>>> # 2D interpolation (2 parameters, 1 value, 3 sample points)>>> interp = pf.Interpolator(... [[0, 0], [1, -1], [2, 0]],... [10, 20, 30],... parameter_names=("param1", "param2"),... )>>> interp([0.5, -0.5])15.0>>> interp([[0, 0], [1.5, 0]])array([10., 25.])Note
Single-dimensional interpolation (single parameter) perform phase unwrapping when interpolating complex values in magnitude and phase. That is not supported for multi-dimensional interpolation.
Methods
Section titled “Methods”| Method | Description |
|---|---|
copy | Create a copy of this layer specification. |
copy(self)Create a copy of this layer specification.
Returns
Interpolator: New copy.
Attributes
Section titled “Attributes”| Attribute | Description |
|---|---|
coords | str: Interpolation coordinate system for complex values (read-only). |
extrapolation | str: Extrapolation strategy for out-of-range query points (read-only). |
method | str: Interpolation method (read-only). |
parameter_names | tuple[str, …] | None: Names for each parameter in x. |
properties | Properties: Object properties. |
x | ndarray: Independent variable values (read-only). |
y | ndarray | list[ndarray]: Dependent variable values (read-only). |
coords
Section titled “coords”str: Interpolation coordinate system for complex values (read-only).
extrapolation
Section titled “extrapolation”str: Extrapolation strategy for out-of-range query points (read-only).
method
Section titled “method”str: Interpolation method (read-only).
parameter_names
Section titled “parameter_names”tuple[str, …] | None: Names for each parameter in x.
properties
Section titled “properties”Properties: Object properties.
ndarray: Independent variable values (read-only).
ndarray | list[ndarray]: Dependent variable values (read-only).