pspline3_r8
index
/home/ap/pypspline/pypspline/pspline3_r8.py

3-D spline in real*8 precision

 
Modules
            
Numeric
fpspline
time
types
warnings
 
Classes
            
pspline
 
class pspline
       
   Methods defined here:
__init__(self, x1, x2, x3, bcs1=None, bcs2=None, bcs3=None)
Constructor.
 
x1, x2, x3: original grid arrays
 
bcs1, bcs2, bcs3: boundary conditions. Use bcs{1,2,3}=1 to apply
periodic boundary conditions (bcs{1,2,3} defaults to None for
not-a-knot boundary conditions, this should be fine in most cases.
 
More general boundary conditions can be applied by setting
 
bcs{1,2,3}=(bmin, bmax)
 
where bmin/bmax can take values from 0 to 7, as described in
http://w3.pppl.gov/NTCC/PSPLINE/.
 
The boundary conditions (if inhomogeneous) must then be applied
by setting the class members
 
self.bcval{1,2,3}min and/or self.bcval{1,2,3}max
 
explicitly *prior* to calling setup(f).
 
1 -- match slope
2 -- match 2nd derivative
3 -- boundary condition is slope=0
4 -- boundary condition is d2f/dx2=0
5 -- match 1st derivative to 1st divided difference
6 -- match 2nd derivative to 2nd divided difference
7 -- match 3rd derivative to 3rd divided difference
 
For example, if one wishes to apply df/dx = a(x2,x3) on the left and
 
d^2f/dx^2 = b(x1,x2)
 
on the right of x1, use
 
bcs1=(1, 2)
 
and set both
 
self.bcval1min = a
 
and
 
self.bcval1max = b
 
where shape(a) == shape(b) == (n3,n2) and n{2,3} = len(x{2,3}).
 
The returned value is a spline object.
derivative(self, i1, i2, i3, p1, p2, p3, meth='cloud')
Compute the derivative d^i1 d^i2 d^i3 f/dx1^i1 dx2^i2 dx3^i3 at (p1, p2, p3). Must have
i{1,2,3}>=0 and i1 + i2 + i3 <=2. See interp method for a list of possible (p1, p2, p3) shapes.
With checks enabled.
derivative_array(self, i1, i2, i3, p1, p2, p3)
Compute the derivative d^i1 d^i2 d^i3 f/dx1^i1 dx2^i2 dx3^i3 for a grid-array (p1, p2, p3). Must have
i{1,2,3}>=0 and i1 + i2 + i3 <=2. 
 
Return the interpolated function, an error flag  (=0 if ok) and a warning flag (=0 if ok).
derivative_cloud(self, i1, i2, i3, p1, p2, p3)
Compute the derivative d^i1 d^i2 d^i3 f/dx1^i1 dx2^i2 dx3^i3 for a cloud (p1, p2, p3). Must have
i{1,2,3}>=0 and i1 + i2 + i3 <=2. 
 
Return the interpolated function, an error flag  (=0 if ok) and a warning flag (=0 if ok).
derivative_point(self, i1, i2, i3, p1, p2, p3)
Compute a single point derivative d^i1 d^i2 d^i3 f/dx1^i1 dx2^i2 dx3^i3 at (p1, p2, p3). Must have
i{1,2,3}>=0 and i1 + i2 + i3 <=2.
 
Return the interpolated function, an error flag  (=0 if ok) and a warning flag (=0 if ok).
gradient(self, p1, p2, p3, meth='cloud')
Return (df/dz, df/dy, df/dx) at point (p1, p2, p3). See interp method for a list of
possible (p1, p2, p3) shapes.
 
With error checks.
gradient_array(self, p1, p2, p3)
Return (df/dz, df/dy, df/dx) for grid-array (p1, p2, p3), an error flag  (=0 if ok)
and a warning flag (=0 if ok).
gradient_cloud(self, p1, p2, p3)
Return (df/dz, df/dy, df/dx) for cloud (p1, p2, p3), an error flag  (=0 if ok)
and a warning flag (=0 if ok).
gradient_point(self, p1, p2, p3)
Return (df/dz, df/dy, df/dx) at point (p1, p2, p3), an error flag  (=0 if ok)
and a warning flag (=0 if ok).
interp(self, p1, p2, p3, meth='cloud')
Interpolatate onto (p1, p2, p3), the coordinate-triplet which can either be a single point
(point interpolation), 3 arrays of identical length (cloud interpolation), or 3 arrays
of possibly different lengths (array interpolation).
 
The returned value is a single float for point interpolation, it is a rank-1 array of
length len(p1)=len(p2)=len(p3) for cloud interpolation, or a rank-3 array of shape
(len(p3), len(p2), len(p1)) for array interpolation.
 
Use meth='array' to enforce array interpolation when p1, p2 and p3 happen to have
the same length. With checks enabled.
interp_array(self, p1, p2, p3)
Array interpolation for all (p1[i1], p2[i2], p3[i3]), i{1,2,3}=0:len( p{1,2,3} )
interp_cloud(self, p1, p2, p3)
Cloud interpolation for all (p1[:], p2[:], p3[:]). Assume len(p1)==len(p2)==len(p3).
interp_point(self, p1, p2, p3)
Point interpolation at (p1, p2, p3).
load(self, filename)
Save state in NetCDF file
save(self, filename)
Save state in NetCDF file
setup(self, f)
Set up (compute) cubic spline coefficients.
See __init__ for comment about boundary conditions. 
 
Input is f[iz, iy, ix], a rank-3 array for the function values.
The x-index varies fastest, then the y-index.

Data and non-method functions defined here:
__doc__ = None
__module__ = 'pspline3_r8'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
Functions
            
griddata(x1, x2, x3)
 Given grid vectors, return grid data
 
Data
             ICT_F1 = array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
ICT_F2 = array([0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
ICT_F3 = array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
ICT_FVAL = array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0])
ICT_GRAD = array([0, 1, 1, 1, 0, 0, 0, 0, 0, 0])
ICT_MAP = {(0, 0, 0): array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0]), (0, 0, 1): array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0]), (0, 0, 2): array([0, 0, 0, 0, 0, 0, 1, 0, 0, 0]), (0, 1, 0): array([0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), (0, 1, 1): array([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]), (0, 2, 0): array([0, 0, 0, 0, 0, 1, 0, 0, 0, 0]), (1, 0, 0): array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), (1, 0, 1): array([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]), (1, 1, 0): array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0]), (2, 0, 0): array([0, 0, 0, 0, 1, 0, 0, 0, 0, 0])}
__file__ = './pspline3_r8.pyc'
__name__ = 'pspline3_r8'