我有点困惑scipy.interpolate.RegularGridInterpolator 的文档 http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RegularGridInterpolator.html.
举例来说,我有一个函数 f: R^3 => R ,它在单位立方体的顶点上采样。我想进行插值以便找到立方体内的值。
import numpy as np
# Grid points / sample locations
X = np.array([[0,0,0], [0,0,1], [0,1,0], [0,1,1], [1,0,0], [1,0,1], [1,1,0], [1,1,1.]])
# Function values at the grid points
F = np.random.rand(8)
Now, RegularGridInterpolator
需要一个points
论证,以及一个values
争论。
points:float 的 ndarray 元组,形状为 (m1, ), ..., (mn, )
定义 n 维规则网格的点。
values: 类似数组,形状 (m1, ..., mn, ...)
n 维规则网格上的数据。
我将此解释为能够这样调用:
import scipy.interpolate as irp
rgi = irp.RegularGridInterpolator(X, F)
但是,当我这样做时,我收到以下错误:
ValueError:有 8 个点数组,但值有 1 个维度
我在文档中误解了什么?