|
Methods defined here:
- __init__(self, x1, x2, bcs1=None, bcs2=None)
- Constructor.
x1, x2: original grid arrays
bcs1, bcs2: boundary conditions. Use bcs{1,2}=1 to apply
periodic boundary conditions (bcs{1,2} 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}=(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}min and/or self.bcval{1,2}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) on the left and
d^2f/dx^2 = b(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) == (n2,) and n2 = len(x2).
The returned value is a spline object.
- derivative(self, i1, i2, p1, p2, meth='cloud')
- Compute the derivative d^i1 d^i2 f/dx1^i1 dx2^i2 at (p1, p2). Must have
i{1,2}>=0 and i1 + i2 <=2. See interp method for a list of possible (p1, p2) shapes.
With checks enabled.
- derivative_array(self, i1, i2, p1, p2)
- Compute the derivative d^i1 d^i2 f/dx1^i1 dx2^i2 for a grid-array (p1, p2). Must have
i{1,2}>=0 and i1 + i2 <=2.
Return the interpolated function, an error flag (=0 if ok) and a warning flag (=0 if ok).
- derivative_cloud(self, i1, i2, p1, p2)
- Compute the derivative d^i1 d^i2 f/dx1^i1 dx2^i2 for a cloud (p1, p2). Must have
i{1,2}>=0 and i1 + i2 <=2.
Return the interpolated function, an error flag (=0 if ok) and a warning flag (=0 if ok).
- derivative_point(self, i1, i2, p1, p2)
- Compute a single point derivative d^i1 d^i2 f/dx1^i1 dx2^i2 at (p1, p2). Must have
i{1,2}>=0 and i1 + i2 <=2.
Return the interpolated function, an error flag (=0 if ok) and a warning flag (=0 if ok).
- gradient(self, p1, p2, meth='cloud')
- Return (df/dy, df/dx). See interp method for a list of possible (p1, p2) shapes.
With checks enabled.
- gradient_array(self, p1, p2)
- Return (df/dy, df/dx) for grid-array (p1, p2).
- gradient_cloud(self, p1, p2)
- Return (df/dy, df/dx) for cloud (p1, p2), an error flag (=0 if ok)
and a warning flag (=0 if ok).
- gradient_point(self, p1, p2)
- Return (df/dy, df/dx) at point (p1, p2), an error flag (=0 if ok)
and a warning flag (=0 if ok).
- interp(self, p1, p2, meth='cloud')
- Interpolatate onto (p1, p2), the coordinate-doublet which can either be a single point
(point interpolation), 2 arrays of identical length (cloud interpolation), or 2 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) for cloud interpolation, or a rank-2 array of shape
(len(p2), len(p1)) for array interpolation.
Use meth='array' to enforce array interpolation when p1 and p2 happen to have
the same length. With checks enabled.
- interp_array(self, p1, p2)
- Array interpolation for all (p1[i1], p2[i2]), i{1,2}=0:len( p{1,2} )
Return the interpolated function, an error flag (=0 if ok) and a warning flag (=0 if ok).
- interp_cloud(self, p1, p2)
- Cloud interpolation for all (p1[:], p2[:]). Assume len(p1)==len(p2).
Return the interpolated function, an error flag (=0 if ok) and a warning flag (=0 if ok).
- interp_point(self, p1, p2)
- Point interpolation at (p1, p2).
Return the interpolated function, an error flag (=0 if ok) and a warning flag (=0 if ok).
- 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[iy, ix], a rank-2 matrix for the function values. The x-index
varies fastest.
Data and non-method functions defined here:
- __doc__ = None
- __module__ = 'pspline2_r4'
- str(object) -> string
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
|