[SciPy-user] three interpolation scenarios

Bryan Fodness bryan.fodness@gmail....
Tue Jun 17 18:10:52 CDT 2008


i have three different sets of data that need interpolation.

the first with a single x and y was easy and works.

x    y
0.0 0.999
0.1 1.006
0.2 1.014
0.3 1.021
0.4 1.000
0.5 1.001
...

data = loadtxt('data.txt', skiprows=1)
x, y = data[:,0], data[:,1]
interp = interpolate.interp1d(x, y)

the second with multiple y values is a little more complicated.
x    y1     y2      y3     y4      y5
0.0 1.000 0.999 0.999 0.999 1.000
0.1 1.000 1.000 1.001 1.005 1.006
0.2 1.000 1.001 1.004 1.008 1.014
0.3 1.000 1.002 1.006 1.012 1.021
0.4 1.000 1.003 1.009 1.015 1.028
0.5 1.001 1.005 1.012 1.019 1.036
...

y = 'y3'
data = loadtxt('oaf.txt', skiprows=1)
label = line.split()
d = label[0]
if d == 'd':
    dlist = label
x, y = data[:,0], data[:,dlist.index(y)]
interp = interpolate.interp1d(x, y)

and the third, is the 2d case.

       10     20      30     40      50
0.0 1.000 0.999 0.999 0.999 1.000
0.1 1.000 1.000 1.001 1.005 1.006
0.2 1.000 1.001 1.004 1.008 1.014
0.3 1.000 1.002 1.006 1.012 1.021
0.4 1.000 1.003 1.009 1.015 1.028
0.5 1.001 1.005 1.012 1.019 1.036
...

not sure how to get the x, y and z's

is the 1st and 2nd way the best way to do this, and can someone help with
the third case.


-- 
"The game of science can accurately be described as a never-ending insult to
human intelligence." - João Magueijo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080617/f0485f63/attachment.html 


More information about the SciPy-user mailing list