summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2007-02-18 21:02:46 +0000
committerStefan van der Walt <stefan@sun.ac.za>2007-02-18 21:02:46 +0000
commitb860a39925a5e0a49d54fa363ccdf6113dfef12d (patch)
treeb717f4026701aa9dde001aefc44820ffea5f94c4 /numpy
parentff2ceaa981dd5ef632ae965fcbaf81577dc625d1 (diff)
downloadnumpy-b860a39925a5e0a49d54fa363ccdf6113dfef12d.tar.gz
Fix docstrings for loading with DocFileSuite.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/numerictypes.py2
-rw-r--r--numpy/distutils/ccompiler.py6
-rw-r--r--numpy/lib/function_base.py63
-rw-r--r--numpy/lib/index_tricks.py2
-rw-r--r--numpy/lib/polynomial.py15
-rw-r--r--numpy/lib/shape_base.py47
6 files changed, 75 insertions, 60 deletions
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py
index 0836241cd..0ca208390 100644
--- a/numpy/core/numerictypes.py
+++ b/numpy/core/numerictypes.py
@@ -80,7 +80,7 @@ __all__ = ['sctypeDict', 'sctypeNA', 'typeDict', 'typeNA', 'sctypes',
'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
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 3a9ee48dc..e850569f4 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -8,9 +8,9 @@ from distutils import ccompiler
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.
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 02e7f605e..14f02f797 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -143,6 +143,7 @@ def histogramdd(sample, bins=10, range=None, normed=False):
H, edges = histogramdd(x, bins = (5, 6, 7))
See also: histogram
+
"""
try:
@@ -263,6 +264,7 @@ def average(a, axis=None, weights=None, returned=False):
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 piecewise(x, condlist, funclist, *args, **kw):
def select(condlist, choicelist, default=0):
""" Return an array composed of different elements of choicelist
- depending on the list of conditions.
-
- 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.
-
- 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
-
- Note that one of the condition arrays must be large enough to handle
- the largest array in the choice list.
+ depending on the list of conditions.
+
+ 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.
+
+ 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
+
+ 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 @@ def gradient(f, *varargs):
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 increasing, or bins [i-1] > x >= bins[i] if
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 @@ is specified, every occurrence of i at a position p contributes
weights[p] instead of 1.
See also: histogram, digitize, unique.
+
""")
except RuntimeError:
pass
@@ -570,6 +576,7 @@ Add a docstring to a built-in obj if possible.
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 @@ def sort_complex(a):
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 @@ def trim_zeros(filt, trim='fb'):
>>> 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 @@ def unique(x):
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 @@ def place(arr, mask, vals):
"""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)
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index 8ac065c47..8f8e1b235 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -119,6 +119,7 @@ class nd_grid(object):
>>> 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 @@ class r_class(concatenator):
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)
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index f8bc1f693..ff429e3f8 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -50,13 +50,14 @@ def _lstsq(X, y, rcond):
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.
-
- Example:
-
- >>> b = roots([1,3,1,5,6])
- >>> poly(b)
- array([1., 3., 1., 5., 6.])
+ 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.])
+
"""
seq_of_zeros = atleast_1d(seq_of_zeros)
sh = seq_of_zeros.shape
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py
index cb15a2760..1e9b55bb6 100644
--- a/numpy/lib/shape_base.py
+++ b/numpy/lib/shape_base.py
@@ -274,29 +274,30 @@ def column_stack(tup):
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)