In [1]:
import escape as esc
esc.require("0.9.8")
import numpy as np
Loading material database from /home/dkor/Data/Development/workspace_escape/escape-core/python/src/escape/scattering/../data/mdb/materials.db
Linear interpolation functor¶
ESCAPE library supports basic piecewise linear interpolation which is functionally the same as provided by numpy library (see numpy.interp function).
The x-coordinates of the interpolated data points must be always increasing and there is no internal sorting procedure. If data points are not increasing the values returned by linear interpolation functor are meaningless.
In [2]:
X = esc.var("X")
xp = np.linspace(0, 2 * np.pi, 100)
yp = np.sin(xp)
yinterp = esc.linterp(X, xp, yp)
yinterp.show(coordinates=np.linspace(0, 2 * np.pi, 100)).config(
xlabel="X", ylabel="Y", title="Linear interpolation sin(X)"
)
Out[2]:
In [ ]: