, 당신은 보간 ndimage.map_coordinates
을 사용할 수
import numpy as np
import scipy.ndimage as ndimage
import matplotlib.pyplot as plt
# given 2 arrays arr1, arr2
arr1 = np.linspace(0, 1, 100).reshape(10,10)
arr2 = np.linspace(1, 0, 100).reshape(10,10)
# rejoin arr1, arr2 into a single array of shape (2, 10, 10)
arr = np.r_['0,3', arr1, arr2]
# define the grid coordinates where you want to interpolate
X, Y = np.meshgrid(np.arange(10), np.arange(10))
# 0.5 corresponds to half way between arr1 and arr2
coordinates = np.ones((10,10))*0.5, X, Y
# given arr interpolate at coordinates
newarr = ndimage.map_coordinates(arr, coordinates, order=2).T
fig, ax = plt.subplots(ncols=3)
cmap = plt.get_cmap('Greys')
vmin = np.min([arr1.min(), newarr.min(), arr2.min()])
vmax = np.max([arr1.max(), newarr.max(), arr2.max()])
ax[0].imshow(arr1, interpolation='nearest', cmap=cmap, vmin=vmin, vmax=vmax)
ax[1].imshow(newarr, interpolation='nearest', cmap=cmap, vmin=vmin, vmax=vmax)
ax[2].imshow(arr2, interpolation='nearest', cmap=cmap, vmin=vmin, vmax=vmax)
ax[0].set_xlabel('arr1')
ax[1].set_xlabel('interpolated')
ax[2].set_xlabel('arr2')
plt.show()
무엇에 대한 ['scipy.interpolate.griddata'] (HTTP : //docs.scipy합니다. org/doc/scipy/reference/generated/scipy.interpolate.griddata.html # scipy.interpolate.griddata)? "크기 배열 (N, ndim) 또는 ndim 배열의 튜플"을 취합니다. –