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 x values can be interpolated simultaneously by setting y to 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

coords

Interpolation coordinate system for complex values (read-only).

method

Interpolation method (read-only).

properties

Object properties.

x

Independent variable values (read-only).

y

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:

Interpolator

method

Interpolation method (read-only).

Type:

str

properties

Object properties.

Type:

Properties

x

Independent variable values (read-only).

Type:

ndarray

y

Dependent variable values (read-only).

Type:

ndarray | list[ndarray]