Interpolator¶
- class photonforge.Interpolator(x, y, method='linear', coords='real_imag')¶
Interpolator object.
- Parameters:
x – Independent variable values.
y – Dependent variable values. Multiple variables sharing the same
xvalues can be interpolated simultaneously by settingyto a sequence of vector.method – Interpolation method. See table below for options.
coords – Coordinate system used for interpolation of complex values. One of
"mag_phase"or"real_imag".
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. ]])
Methods
copy()Create a copy of this layer specification.
Attributes
Interpolation coordinate system for complex values (read-only).
Interpolation method (read-only).
Object properties.
Independent variable values (read-only).
Dependent variable values (read-only).
- coords¶
Interpolation coordinate system for complex values (read-only).
- Type:
str
- copy()¶
Create a copy of this layer specification.
- Returns:
New copy.
- Return type:
- method¶
Interpolation method (read-only).
- Type:
str
- properties¶
Object properties.
- Type:
- x¶
Independent variable values (read-only).
- Type:
ndarray
- y¶
Dependent variable values (read-only).
- Type:
ndarray | list[ndarray]