Python interpolation
numpy.interp
seems to be the function you want: pass your X1
as the first argument x, your X2
as the second argument xp, your Y2
as the third argument fp, and you'll get the Y values corresponding to the X1
coordinates.
Y2_at_X1 = np.interp(X1, X2, Y2)
I'm assuming you want to completely ignore the existing Y1
values. This is what the above snippet does. Otherwise you'll have to clarify your question to explain what role you might have for Y1
!
If you want more than linear interpolation, I suggest you look at scipy.interpolate
and its tutorial rather than trying to stretch numpy beyond its simplicity ;-).