Python中的4D插值 [英] 4d interpolation in python

查看:87
本文介绍了Python中的4D插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个4d力场,如x yz,每个点上都附有Force.

So I have a 4d force field as in x y and z with a Force attached to each point.

我对如何进行插值有点迷茫,尽管我遇到了这个问题.

I'm a a bit at a lost on how to interpolate this, I came across this though.

http://docs. scipy.org/doc/scipy-dev/reference/generation/scipy.ndimage.interpolation.map_coordinates.html

看起来我可以创建一个x y z F数组,然后对其进行插值,但我确实不太确定.

It looks like I can make an array of x y z F and then interpolate it but I'm really not too sure.

有人知道如何使用python编写好的库吗?

Anyone know any good libraries for python on how to do this?

示例输入为:

x y z Force  
0 0 0 35  
0 0 1 32  
0 0 2 23  
...  
2 5 9 54  

推荐答案

您描述它(x,y,z)的方式,这是3D字段,而不是4D.

The way you described it (x,y,z), this is a 3D field, not 4D.

插值的目的是在任意点(x,y,z)上指定一个字段(在这种情况下为Force) 即使您没有力,也恰好在该点(x,y,z).取而代之的是,您在许多附近的点处有力,并且内插以获得在点(x,y,z)上的有意义的力.在3D模式中,至少需要一个双线性插值算法,并且对其进行编码(并使索引保持顺序)并非易事.

The purpose of interpolation is to specify a field (in this case Force) at any point (x,y,z) even if you don't have a Force, at precisely that point (x,y,z). Instead, you have the forces at a number of nearby points and you interpolate them to get a meaningful Force at point (x,y,z). In 3D you would need a bilinear interpolation algorithm at the least, and coding it up (and keeping indices in order) is non-trivial.

在Python中,您可以使用 Scipy的插值例程.

In Python, you can use Scipy's interpolation routines.

这篇关于Python中的4D插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆