Scipy.Interpolation运行时警告错误

时间:2018-06-11 13:59:00

标签: python scipy interpolation

我在使用Python中的interp2d时遇到问题,即使是使用线性插值的简单数组也是如此。以下示例:

import numpy as np
from scipy.interpolate import interp2d

# Create image
nx, ny = 10, 10
image = np.zeros((nx,ny))

for i in range(nx):
    for j in range(ny):
        image[i,j] = float(i + j/2)

# Define pixel centers along each direction
x = np.linspace(0.5, float(nx) - 0.5, nx)
y = np.linspace(0.5, float(ny) - 0.5, ny)

# Create interpolating function
f = interp2d(x,y,image, kind='linear')

返回以下警告

Warning:     No more knots can be added because the number of B-spline coefficients
    already exceeds the number of data points m. Probably causes: either
    s or m too small. (fp>s)
    kx,ky=1,1 nx,ny=13,12 m=100 fp=0.000000 s=0.000000

使用插值函数的一些结果是错误的。到底是怎么回事?我不明白为什么甚至会提到样条系数,因为我指定我只想要线性插值。

有人可以重现这个问题吗?我正在使用scipy svn r6368。

谢谢,

0 个答案:

没有答案
相关问题