开发者

interpolation with python numpy

I have an array of samples y, and corresponding x values. Some y-values may be missing and I'd like to use linear interpolation to compute them. What is开发者_如何学JAVA the best way of doing it with python (I'm using numpy arrays). If you could provide me a sample code that would be great.

thanks


See the interpolation method in the numpy documentation that has examples:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.interp.html

There are also a more extensive set of methods available through scipy:

http://docs.scipy.org/doc/scipy/reference/interpolate.html


I couldn't find anything similar to Matlab's fast interpn function, so I coded one myself:

https://github.com/fejikso/interpolator

It requires the data to be in a grid, but the coordinates don't need to be equally spaced.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜