[Numpy-svn] r3549 - in trunk/numpy: core distutils lib
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Feb 18 16:03:20 EST 2007
Author: stefan
Date: 2007-02-18 15:02:46 -0600 (Sun, 18 Feb 2007)
New Revision: 3549
Modified:
trunk/numpy/core/numerictypes.py
trunk/numpy/distutils/ccompiler.py
trunk/numpy/lib/function_base.py
trunk/numpy/lib/index_tricks.py
trunk/numpy/lib/polynomial.py
trunk/numpy/lib/shape_base.py
Log:
Fix docstrings for loading with DocFileSuite.
Modified: trunk/numpy/core/numerictypes.py
===================================================================
--- trunk/numpy/core/numerictypes.py 2007-02-18 20:34:30 UTC (rev 3548)
+++ trunk/numpy/core/numerictypes.py 2007-02-18 21:02:46 UTC (rev 3549)
@@ -80,7 +80,7 @@
'ScalarType', 'obj2sctype', 'cast', 'nbytes', 'sctype2char',
'maximum_sctype', 'issctype', 'typecodes']
-from multiarray import typeinfo, ndarray, array, empty, dtype
+from numpy.core.multiarray import typeinfo, ndarray, array, empty, dtype
import types as _types
# we don't export these for import *, but we do want them accessible
Modified: trunk/numpy/distutils/ccompiler.py
===================================================================
--- trunk/numpy/distutils/ccompiler.py 2007-02-18 20:34:30 UTC (rev 3548)
+++ trunk/numpy/distutils/ccompiler.py 2007-02-18 21:02:46 UTC (rev 3549)
@@ -8,9 +8,9 @@
from distutils.sysconfig import customize_compiler
from distutils.version import LooseVersion
-import log
-from exec_command import exec_command
-from misc_util import cyg2win32, is_sequence, mingw32
+from numpy.distutils import log
+from numpy.distutils.exec_command import exec_command
+from numpy.distutils.misc_util import cyg2win32, is_sequence, mingw32
from distutils.spawn import _nt_quote_args
# hack to set compiler optimizing options. Needs to integrated with something.
Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py 2007-02-18 20:34:30 UTC (rev 3548)
+++ trunk/numpy/lib/function_base.py 2007-02-18 21:02:46 UTC (rev 3549)
@@ -143,6 +143,7 @@
H, edges = histogramdd(x, bins = (5, 6, 7))
See also: histogram
+
"""
try:
@@ -263,6 +264,7 @@
Raises ZeroDivisionError if appropriate. (The version in MA does
not -- it returns masked values).
+
"""
if axis is None:
a = array(a).ravel()
@@ -376,31 +378,32 @@
def select(condlist, choicelist, default=0):
""" Return an array composed of different elements of choicelist
- depending on the list of conditions.
+ depending on the list of conditions.
- condlist is a list of condition arrays containing ones or zeros
+ condlist is a list of condition arrays containing ones or zeros
- choicelist is a list of choice arrays (of the "same" size as the
- arrays in condlist). The result array has the "same" size as the
- arrays in choicelist. If condlist is [c0, ..., cN-1] then choicelist
- must be of length N. The elements of the choicelist can then be
- represented as [v0, ..., vN-1]. The default choice if none of the
- conditions are met is given as the default argument.
+ choicelist is a list of choice arrays (of the "same" size as the
+ arrays in condlist). The result array has the "same" size as the
+ arrays in choicelist. If condlist is [c0, ..., cN-1] then choicelist
+ must be of length N. The elements of the choicelist can then be
+ represented as [v0, ..., vN-1]. The default choice if none of the
+ conditions are met is given as the default argument.
- The conditions are tested in order and the first one statisfied is
- used to select the choice. In other words, the elements of the
- output array are found from the following tree (notice the order of
- the conditions matters):
+ The conditions are tested in order and the first one statisfied is
+ used to select the choice. In other words, the elements of the
+ output array are found from the following tree (notice the order of
+ the conditions matters):
- if c0: v0
- elif c1: v1
- elif c2: v2
- ...
- elif cN-1: vN-1
- else: default
+ if c0: v0
+ elif c1: v1
+ elif c2: v2
+ ...
+ elif cN-1: vN-1
+ else: default
- Note that one of the condition arrays must be large enough to handle
- the largest array in the choice list.
+ Note that one of the condition arrays must be large enough to handle
+ the largest array in the choice list.
+
"""
n = len(condlist)
n2 = len(choicelist)
@@ -452,7 +455,8 @@
Outputs:
N arrays of the same shape as f giving the derivative of f with respect
- to each dimension.
+ to each dimension.
+
"""
N = len(f.shape) # number of dimensions
n = len(varargs)
@@ -542,6 +546,7 @@
bins is monotonically decreasing.
Beyond the bounds of the bins 0 or len(bins) is returned as appropriate.
+
""")
except RuntimeError:
pass
@@ -558,6 +563,7 @@
weights[p] instead of 1.
See also: histogram, digitize, unique.
+
""")
except RuntimeError:
pass
@@ -570,6 +576,7 @@
If the obj already has a docstring raise a RuntimeError
If this routine does not know how to add a docstring to the object
raise a TypeError
+
""")
except RuntimeError:
pass
@@ -612,6 +619,7 @@
the imaginary part if the real part is equal (the default sort order
for complex arrays). This function is a wrapper ensuring a complex
return type.
+
"""
b = array(a,copy=True)
b.sort()
@@ -633,6 +641,7 @@
>>> a = array((0, 0, 0, 1, 2, 3, 2, 1, 0))
>>> numpy.trim_zeros(a)
array([1, 2, 3, 2, 1])
+
"""
first = 0
trim = trim.upper()
@@ -657,6 +666,7 @@
Example:
>>> unique([5,2,4,0,4,4,2,2,1])
array([0,1,2,4,5])
+
"""
try:
tmp = x.flatten()
@@ -682,6 +692,7 @@
"""Similar to putmask arr[mask] = vals but the 1D array vals has the
same number of elements as the non-zero values of mask. Inverse of
extract.
+
"""
return _insert(arr, mask, vals)
Modified: trunk/numpy/lib/index_tricks.py
===================================================================
--- trunk/numpy/lib/index_tricks.py 2007-02-18 20:34:30 UTC (rev 3548)
+++ trunk/numpy/lib/index_tricks.py 2007-02-18 21:02:46 UTC (rev 3549)
@@ -119,6 +119,7 @@
>>> ogrid = nd_grid(sparse=True)
>>> ogrid[0:5,0:5]
[array([[0],[1],[2],[3],[4]]), array([[0, 1, 2, 3, 4]])]
+
"""
def __init__(self, sparse=False):
self.sparse = sparse
@@ -312,6 +313,7 @@
For example:
>>> r_[array([1,2,3]), 0, 0, array([4,5,6])]
array([1, 2, 3, 0, 0, 4, 5, 6])
+
"""
def __init__(self):
concatenator.__init__(self, 0)
Modified: trunk/numpy/lib/polynomial.py
===================================================================
--- trunk/numpy/lib/polynomial.py 2007-02-18 20:34:30 UTC (rev 3548)
+++ trunk/numpy/lib/polynomial.py 2007-02-18 21:02:46 UTC (rev 3549)
@@ -50,13 +50,14 @@
def poly(seq_of_zeros):
""" Return a sequence representing a polynomial given a sequence of roots.
- If the input is a matrix, return the characteristic polynomial.
+ If the input is a matrix, return the characteristic polynomial.
- Example:
-
- >>> b = roots([1,3,1,5,6])
- >>> poly(b)
- array([1., 3., 1., 5., 6.])
+ Example:
+
+ >>> b = roots([1,3,1,5,6])
+ >>> poly(b)
+ array([1., 3., 1., 5., 6.])
+
"""
seq_of_zeros = atleast_1d(seq_of_zeros)
sh = seq_of_zeros.shape
Modified: trunk/numpy/lib/shape_base.py
===================================================================
--- trunk/numpy/lib/shape_base.py 2007-02-18 20:34:30 UTC (rev 3548)
+++ trunk/numpy/lib/shape_base.py 2007-02-18 21:02:46 UTC (rev 3549)
@@ -274,29 +274,30 @@
def dstack(tup):
""" Stack arrays in sequence depth wise (along third dimension)
- Description:
- Take a sequence of arrays and stack them along the third axis.
- All arrays in the sequence must have the same shape along all
- but the third axis. This is a simple way to stack 2D arrays
- (images) into a single 3D array for processing.
- dstack will rebuild arrays divided by dsplit.
- Arguments:
- tup -- sequence of arrays. All arrays must have the same
- shape.
- Examples:
- >>> import numpy
- >>> a = array((1,2,3))
- >>> b = array((2,3,4))
- >>> numpy.dstack((a,b))
- array([ [[1, 2],
- [2, 3],
- [3, 4]]])
- >>> a = array([[1],[2],[3]])
- >>> b = array([[2],[3],[4]])
- >>> numpy.dstack((a,b))
- array([[ [1, 2]],
- [ [2, 3]],
- [ [3, 4]]])
+ Description:
+ Take a sequence of arrays and stack them along the third axis.
+ All arrays in the sequence must have the same shape along all
+ but the third axis. This is a simple way to stack 2D arrays
+ (images) into a single 3D array for processing.
+ dstack will rebuild arrays divided by dsplit.
+ Arguments:
+ tup -- sequence of arrays. All arrays must have the same
+ shape.
+ Examples:
+ >>> import numpy
+ >>> a = array((1,2,3))
+ >>> b = array((2,3,4))
+ >>> numpy.dstack((a,b))
+ array([ [[1, 2],
+ [2, 3],
+ [3, 4]]])
+ >>> a = array([[1],[2],[3]])
+ >>> b = array([[2],[3],[4]])
+ >>> numpy.dstack((a,b))
+ array([[ [1, 2]],
+ [ [2, 3]],
+ [ [3, 4]]])
+
"""
return _nx.concatenate(map(atleast_3d,tup),2)
More information about the Numpy-svn
mailing list