spline
index
spline.py

Spline module for smooth interpolation in one and two dimensions
 
 
class: FloatSpline - 1D cubic spline
 
Constructor
  FloatSpline( listOfXYPairs , isPeriodic=False)
 
    where listOfXYPairs is a sequence of sequences containing two
    floating point elements listing (x,y) datapoints. The x values do
    not have to lie on a regular grid. 
 
    If isPeriodic is set to True, an additional point is added to 
    listOfXYPairs at (x,y), where
      x = 2 listOfXYPairs[N-1][0] -  listOfXYPairs[N-1][0]
      y = listOfXYPairs[0][1]
 
    also, in this case the slope at the first and final points are set to
    match.
 
Use:
  
  interpolated y values are obtained using the __call__() method. For example,
    spline = FloatSpline( [(0,1), (1,2), (2,3)] )
    spline(0.5)
 
  will return the value 1.5
 
 
class: FloatSpline2D - 2D bicubic interpolation
 
Constructor
  FloatSpline2D(xList,yList,zList, periodic=PERIODIC_NOT)
 
    xList and yList contain x and y values of gridpoints. These values
    should be monotonically increasing, but do not need to be equally 
    spaced. zList is a row-major list of data on this grid.
 
    The optional periodic argument is a bit field specifying whether the x- 
    or y- dimensions contain periodic data. Valid values are PERIODIC_NOT,
    PERIODIC_X and PERIODIC_Y. If a dimension is marked as periodic, the
    corresponding dimension in zList should be one less: the final row of
    z values is taken from the first.
 
    If, for instance PERIODIC_X is set, zList should have one less row than
    xList has values. The values in the final row are set to those in the 
    first. First derivatives at the top and the bottom of zList are also 
    matched. 
 
    Note that, unlike the 1D case, the spline coefficients are not taken
    from a global fit. This is possible, but not yet implemented.
 
Methods:
 
   __call__(x,y) - return the interpolated value at (x,y).
 
   derivs(x,y) - return derivatives wrt x and y at (x,y) in a tuple (dx,dy).
                 The Python implementation needs to be completed. 
   
 
Use:
  
  interpolated z values are obtained using the __call__() method. For example,
    x=[1,2,3]
    y=[4,7]
    z=[7,9,
       1,3,
       3,6]
    spline2d=spline.FloatSpline2D(x,y,z)
    spline2d(1.4,5.1)
 
  will return the value 4.93173
 
 
 
 
 
 
 
 
# This file was created automatically by SWIG.
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.

 
Classes
       
__builtin__.object
FloatSpline
FloatSplinePtr
FloatSpline2D
FloatSpline2DPtr

 
class FloatSpline(__builtin__.object)
   
 

 
  Methods defined here:
__call__(*args)

 
__del__(self, destroy=<built-in function delete_FloatSpline>)

 
__getattr__ lambda self, name

 
__init__(self, *args)

 
__repr__(self)

 
__setattr__ lambda self, name, value

 

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x253a638>

 
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FloatSpline' objects>

 
list of weak references to the object (if defined)

 
class FloatSpline2D(__builtin__.object)
   
 

 
  Methods defined here:
__call__(*args)

 
__del__(self, destroy=<built-in function delete_FloatSpline2D>)

 
__getattr__ lambda self, name

 
__init__(self, *args)

 
__repr__(self)

 
__setattr__ lambda self, name, value

 
derivs(*args)

 
init(*args)

 

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x253a600>

 
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FloatSpline2D' objects>

 
list of weak references to the object (if defined)

 
class FloatSpline2DPtr(FloatSpline2D)
   
 

 
 
Method resolution order:
FloatSpline2DPtr
FloatSpline2D
__builtin__.object

Methods defined here:
__init__(self, this)

 

Methods inherited from FloatSpline2D:
__call__(*args)

 
__del__(self, destroy=<built-in function delete_FloatSpline2D>)

 
__getattr__ lambda self, name

 
__repr__(self)

 
__setattr__ lambda self, name, value

 
derivs(*args)

 
init(*args)

 

Data and other attributes inherited from FloatSpline2D:
__dict__ = <dictproxy object at 0x253a558>

 
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FloatSpline2D' objects>

 
list of weak references to the object (if defined)

 
class FloatSplinePtr(FloatSpline)
   
 

 
 
Method resolution order:
FloatSplinePtr
FloatSpline
__builtin__.object

Methods defined here:
__init__(self, this)

 

Methods inherited from FloatSpline:
__call__(*args)

 
__del__(self, destroy=<built-in function delete_FloatSpline>)

 
__getattr__ lambda self, name

 
__repr__(self)

 
__setattr__ lambda self, name, value

 

Data and other attributes inherited from FloatSpline:
__dict__ = <dictproxy object at 0x253a590>

 
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FloatSpline' objects>

 
list of weak references to the object (if defined)

 
Functions
       
help(...)

 

 
Data
        PERIODIC_NOT = 0
PERIODIC_X = 1
PERIODIC_Y = 2
__package__ = None
pyXplorHelp = Type help() for interactive help, or help(object) for help about object.