diff options
author | Jarrod Millman <millman@berkeley.edu> | 2010-02-17 23:55:16 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2010-02-17 23:55:16 +0000 |
commit | 1c7167378e9f654a80b3cb57b7c0dd7ee573a109 (patch) | |
tree | 1926d178db2e66c19552f8216926c07155f7cde3 /numpy | |
parent | e2bb09430d90c73a7be6e47ea8c4528f094f693f (diff) | |
download | numpy-1c7167378e9f654a80b3cb57b7c0dd7ee573a109.tar.gz |
updated documentation from pydoc website (thanks to everyone who contributed!)
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/add_newdocs.py | 6 | ||||
-rw-r--r-- | numpy/core/code_generators/ufunc_docstrings.py | 12 | ||||
-rw-r--r-- | numpy/doc/constants.py | 26 |
3 files changed, 30 insertions, 14 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index bbb93f6f2..b6c5853e0 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -3985,6 +3985,12 @@ add_newdoc('numpy.core', 'ufunc', """ Functions that operate element by element on whole arrays. + To see the documentation for a specific ufunc, use np.info(). For + example, np.info(np.sin). Because ufuncs are written in C + (for speed) and linked into Python with NumPy's ufunc facility, + Python's help() function finds this page whenever help() is called + on a ufunc. + A detailed explanation of ufuncs can be found in the "ufuncs.rst" file in the NumPy reference guide. diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index 4adbf2376..c63df7c8f 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -1641,7 +1641,7 @@ add_newdoc('numpy.core.umath', 'left_shift', x1 : array_like of integer type Input values. x2 : array_like of integer type - Number of zeros to append to `x1`. + Number of zeros to append to `x1`. Has to be non-negative. Returns ------- @@ -1849,6 +1849,16 @@ add_newdoc('numpy.core.umath', 'log2', handles the floating-point negative zero as an infinitesimal negative number, conforming to the C99 standard. + Examples + -------- + >>> x = np.array([0, 1, 2, 2**4]) + >>> np.log2(x) + array([-Inf, 0., 1., 4.]) + + >>> xi = np.array([0+1.j, 1, 2+0.j, 4.j]) + >>> np.log2(xi) + array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) + """) add_newdoc('numpy.core.umath', 'logaddexp', diff --git a/numpy/doc/constants.py b/numpy/doc/constants.py index adb7c7e02..722147dd8 100644 --- a/numpy/doc/constants.py +++ b/numpy/doc/constants.py @@ -75,8 +75,8 @@ add_newdoc('numpy', 'NINF', isnan : Shows which elements are Not a Number - isfinite : Shows which elements are finite (not one of - Not a Number, positive infinity and negative infinity) + isfinite : Shows which elements are finite (not one of Not a Number, + positive infinity and negative infinity) Notes ----- @@ -214,7 +214,7 @@ add_newdoc('numpy', 'e', """ Euler's constant, base of natural logarithms, Napier's constant. - `e = 2.71828182845904523536028747135266249775724709369995...` + ``e = 2.71828182845904523536028747135266249775724709369995...`` See Also -------- @@ -246,8 +246,8 @@ add_newdoc('numpy', 'inf', isnan : Shows which elements are Not a Number - isfinite : Shows which elements are finite (not one of - Not a Number, positive infinity and negative infinity) + isfinite : Shows which elements are finite (not one of Not a Number, + positive infinity and negative infinity) Notes ----- @@ -322,20 +322,20 @@ add_newdoc('numpy', 'newaxis', Examples -------- - >>> np.newaxis is None + >>> newaxis is None True >>> x = np.arange(3) >>> x array([0, 1, 2]) - >>> x[:, np.newaxis] + >>> x[:, newaxis] array([[0], [1], [2]]) - >>> x[:, np.newaxis, np.newaxis] + >>> x[:, newaxis, newaxis] array([[[0]], [[1]], [[2]]]) - >>> x[:, np.newaxis] * x + >>> x[:, newaxis] * x array([[0, 0, 0], [0, 1, 2], [0, 2, 4]]) @@ -343,20 +343,20 @@ add_newdoc('numpy', 'newaxis', Outer product, same as ``outer(x, y)``: >>> y = np.arange(3, 6) - >>> x[:, np.newaxis] * y + >>> x[:, newaxis] * y array([[ 0, 0, 0], [ 3, 4, 5], [ 6, 8, 10]]) ``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``: - >>> x[np.newaxis, :].shape + >>> x[newaxis, :].shape (1, 3) - >>> x[np.newaxis].shape + >>> x[newaxis].shape (1, 3) >>> x[None].shape (1, 3) - >>> x[:, np.newaxis].shape + >>> x[:, newaxis].shape (3, 1) """) |