问题
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/generated/scipy.ndimage.interpolation.map_coordinates.html
It looks like I can make an array of x y z F and then interpolate it but I'm really not too sure.
Anyone know any good libraries for python on how to do this?
Example input is:
x y z Force
0 0 0 35
0 0 1 32
0 0 2 23
...
2 5 9 54
回答1:
The way you described it (x,y,z), this is a 3D field, not 4D.
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.
In Python, you can use Scipy's interpolation routines.
回答2:
So, if i understand you corret, you have the force given at some points and at others not and want to come up with an interpolation? At NMR the use of linear interpolation is till up to date. As an alternative, you can give splines a try, but thats more costly. But it mostly depends on the kind of your force - how fast is it going changing? Build your interpolation rouinte out of that.
来源:https://stackoverflow.com/questions/19409078/4d-interpolation-in-python