Skip to content Skip to sidebar Skip to footer

Interpolation Giving Different Results For Almost Identical Arrays

I'm trying to interpolate two 2-dimensional arrays. The original array is shown in blue in the image below. The second one shown, in red, is the same array in blue but moved up and

Solution 1:

The problem in your code is not the interpolation function, but the data itself. The points in b are not in the "proper" order, i.e. if you parametrize the curve by a variable t, then the points in b are not in the order of increasing t.

You can see this if you take b to be a translated by some vector and with some elements removed:

print np.array(a).shape, np.array(b).shape
b = np.array(a) + np.array([[2, 3]]).T
b = b[:, [x for x in range(len(b[0])) if x < 100or (x > 100and x % 2)]]
print np.array(a).shape, np.array(b).shape

Post a Comment for "Interpolation Giving Different Results For Almost Identical Arrays"