diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-04-02 20:21:57 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-04-02 20:21:57 +0000 |
commit | 1cd5403e91c066910c85d1e326cffa701c7e5101 (patch) | |
tree | 54b20112542b63167cd2a2246bbcec36048a6c6d /numpy/lib/function_base.py | |
parent | a1f65e154f15f1c5b35c2befaeb74f3952b2c3e2 (diff) | |
download | numpy-1cd5403e91c066910c85d1e326cffa701c7e5101.tar.gz |
Add interp to numpy.lib adapted from arrayfns. Add an unfinished arrayfns compatibility module to old_numeric.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 69c9359f1..e35f8a00f 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -8,7 +8,8 @@ __all__ = ['logspace', 'linspace', 'histogram', 'histogramdd', 'bincount', 'digitize', 'cov', 'corrcoef', 'msort', 'median', 'sinc', 'hamming', 'hanning', 'bartlett', 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc', - 'add_docstring', 'meshgrid', 'delete', 'insert', 'append' + 'add_docstring', 'meshgrid', 'delete', 'insert', 'append', + 'interp' ] import types @@ -24,7 +25,7 @@ from numpy.core.numerictypes import typecodes from numpy.lib.shape_base import atleast_1d, atleast_2d from numpy.lib.twodim_base import diag from _compiled_base import _insert, add_docstring -from _compiled_base import digitize, bincount +from _compiled_base import digitize, bincount, interp from arraysetops import setdiff1d #end Fernando's utilities @@ -592,6 +593,25 @@ raise a TypeError except RuntimeError: pass +try: + add_docstring(interp, +r"""interp(x, xp, fp, left=None, right=None) + +Return the value of a piecewise-linear function at each value in x. + +The piecewise-linear function, f, is defined by the known data-points fp=f(xp). +The xp points must be sorted in increasing order but this is not checked. + +For values of x < xp[0] return the value given by left. If left is None, then +return fp[0]. +For values of x > xp[-1] return the value given by right. If right is None, then +return fp[-1]. +""" + ) +except RuntimeError: + pass + + def angle(z, deg=0): """Return the angle of the complex argument z. """ |