Using RectBivariateSpline to interpolate over a 2D image (raw data illustrated below), if smoothing is 0, I get an interpolation, but if I set smoothing to a non-zero value, even 0.001, the result contains only nan values. My "image" is a 1000x800 grid of numbers from 0~14.
from scipy import interpolate
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x=np.arange(img.shape[1])
y=np.arange(img.shape[0])
X, Y = np.meshgrid(x,y)
fig=plt.figure(1)
for smooth in [0,.001,.01,.1]:
plt.clf()
plt.cla()
ax=fig.add_subplot(111,projection='3d')
bvspl=interpolate.RectBivariateSpline(x,y,np.transpose(img),s=smooth)
print(np.min(bvspl(x,y)),np.max(bvspl(x,y)))
ax.plot_surface(X,Y,np.transpose(bvspl(x,y)))
fig.savefig(path+str(smooth)+'_3d.png')
The result of the print statement is:
-2.15105711021e-15 14.3944312333
nan nan
nan nan
nan nan