简体   繁体   中英

4d interpolation in python

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

I'm aa 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 xyz 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  

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM