【发布时间】:2015-11-10 13:22:23
【问题描述】:
我有以下代码用于2D 插值:
myInterpolator = NearestNDInterpolator(XY_product, grid_data)
当我为新数据点运行此插值器时:
new_grid_data = myInterpolator(new_XY)
我收到以下错误:
xi = self._check_call_shape(xi)
File "interpnd.pyx", line 133, in
scipy.interpolate.interpnd.NDInterpolatorBase._check_call_shape
(scipy/interpolate/interpnd.c:3261)
ValueError: number of dimensions in xi does not match x
我该如何解决这个问题?
【问题讨论】:
-
你确定
XY_product和特别是new_XY是他们应该的样子吗? -
@heltonbiker
XY_product是以下代码中的np.asarray(cart_product):cart_product = [] for element in itertools.product(ChromX,ChromY): cart_product.append(element) -
@heltonbiker 另外,
new_XY如下:shifted_cart_product = zip(ChromX_shifted,ChromY_shifted)
标签: python scipy interpolation