def analysis.spline.splint (   xa,
  ya,
  y2a,
  x,
  derivs = False 
)

returns the interpolated from from the spline
x can either be a scalar or a listable item, in which case a Numeric Float array will be
returned and the multiple interpolations will be done somewhat more efficiently.
If derivs is not False, return y, y', y'' instead of just y.

Definition at line 95 of file spline.py.

00095                                         :
00096     """returns the interpolated from from the spline
00097     x can either be a scalar or a listable item, in which case a Numeric Float array will be
00098     returned and the multiple interpolations will be done somewhat more efficiently.
00099     If derivs is not False, return y, y', y'' instead of just y."""
00100     if type(x) is types.IntType or type(x) is types.FloatType: 
00101         if (x<xa[0] or x>xa[-1]):
00102             raise RangeError, "%f not in range (%f, %f) in splint()" % (x, xa[0], xa[-1])
00103              
00104         khi=max(searchsorted(xa,x),1)
00105         klo=khi-1
00106         h=float(xa[khi]-xa[klo])
00107         a=(xa[khi]-x)/h; b=1.0-a
00108         ylo=ya[klo]; yhi=ya[khi]; y2lo=y2a[klo]; y2hi=y2a[khi]
00109     else:
00110         #if we got here, we are processing a list, and should do so more efficiently
00111         if (min(x)<xa[0] or max(x)>xa[-1]):
00112             raise RangeError, "(%f, %f) not in range (%f, %f) in splint()" % (min(x), max(x), xa[0], xa[-1])
00113     
00114         npoints=len(x)
00115         khi=clip(searchsorted(xa,x),1,len(xa)) 
00116         
00117         klo=khi-1
00118         xhi=take(xa, khi)
00119         xlo=take(xa, klo)
00120         yhi=take(ya, khi)
00121         ylo=take(ya, klo)
00122         y2hi=take(y2a, khi)
00123         y2lo=take(y2a, klo)
00124         
00125         h=(xhi-xlo).astype(Float)
00126         a=(xhi-x)/h
00127         b=1.0-a
00128         
00129     y=a*ylo+b*yhi+((a*a*a-a)*y2lo+(b*b*b-b)*y2hi)*(h*h)/6.0
00130     if derivs:
00131         return y, (yhi-ylo)/h+((3*b*b-1)*y2hi-(3*a*a-1)*y2lo)*h/6.0, b*y2hi+a*y2lo
00132     else:
00133         return y
00134 
00135         
def cubeinterpolate(xlist, ylist, x3):


Generated on Wed Nov 21 10:18:33 2007 for analysis by  doxygen 1.5.4