python - line interpolation on grid with python3 -
i new python(say 1 week) , numpy/scipy not new programming @ wondering how following correctly (preferably numpy/scipy):
so have 150x200 ndarray float values. want interpolate line 20:40 100:150 500 points in between.
getting x:y interpolation have with:
xvalues = numpy.linspace(20,100,500) yvalues = numpy.linspace(40,150,500)
but how values(on line only) interpolated using numpy/scipy?
ps use python3
check out scipy.interpolate
import numpy np scipy.interpolate import interp1d xvalues = numpy.linspace(20,100,500) yvalues = numpy.linspace(40,150,500) f = interpolate.interp1d(x, y) xnew = np.arange(20, 30, 0.1) ynew = f(xnew)
Comments
Post a Comment