[Numpy-svn] r2842 - in trunk/numpy: core core/src lib
numpy-svn at scipy.org
numpy-svn at scipy.org
Tue Jul 18 17:10:41 EDT 2006
Author: cookedm
Date: 2006-07-18 16:10:39 -0500 (Tue, 18 Jul 2006)
New Revision: 2842
Modified:
trunk/numpy/core/fromnumeric.py
trunk/numpy/core/src/arraymethods.c
trunk/numpy/lib/function_base.py
Log:
add some more docstrings
Modified: trunk/numpy/core/fromnumeric.py
===================================================================
--- trunk/numpy/core/fromnumeric.py 2006-07-18 19:19:28 UTC (rev 2841)
+++ trunk/numpy/core/fromnumeric.py 2006-07-18 21:10:39 UTC (rev 2842)
@@ -468,9 +468,17 @@
mean = a.mean
except AttributeError:
return _wrapit(a, 'mean', axis, dtype)
- return mean(axis, dtype)
+ return mean(axis, dtype)
def std(a, axis=0, dtype=None):
+ """std(sample, axis=0, dtype=None)
+ Return the standard deviation, a measure of the spread of a distribution.
+
+ The standard deviation is the square root of the average of the squared
+ deviations from the mean, i.e. std = sqrt(mean((x - x.mean())**2)).
+
+ For multidimensional arrays, std is computed by default along the first axis.
+ """
try:
std = a.std
except AttributeError:
Modified: trunk/numpy/core/src/arraymethods.c
===================================================================
--- trunk/numpy/core/src/arraymethods.c 2006-07-18 19:19:28 UTC (rev 2841)
+++ trunk/numpy/core/src/arraymethods.c 2006-07-18 21:10:39 UTC (rev 2842)
@@ -1385,7 +1385,13 @@
return PyArray_All(self, axis);
}
-static char doc_stddev[] = "a.std(axis=None, dtype=None)";
+static char doc_stddev[] = "a.std(axis=None, dtype=None)\n"
+"Return the standard deviation, a measure of the spread of a distribution.\n"
+"\n"
+"The standard deviation is the square root of the average of the squared\n"
+"deviations from the mean, i.e. std = sqrt(mean((x - x.mean())**2)).\n"
+"\n"
+"For multidimensional arrays, std is computed by default along the first axis.\n";
static PyObject *
array_stddev(PyArrayObject *self, PyObject *args, PyObject *kwds)
Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py 2006-07-18 19:19:28 UTC (rev 2841)
+++ trunk/numpy/lib/function_base.py 2006-07-18 21:10:39 UTC (rev 2842)
@@ -64,6 +64,23 @@
return 1
def histogram(a, bins=10, range=None, normed=False):
+ """histogram(sample, bins = 10, range = None, normed = False) -> H, ledges
+
+ Return the distribution of a sample.
+
+ Parameters
+ ----------
+ bins: Number of bins
+ range: Lower and upper bin edges (default: [sample.min(), sample.max()]).
+ Does not really work, all values greater than range are stored in
+ the last bin.
+ normed: If False (default), return the number of samples in each bin.
+ If True, return a frequency distribution.
+
+ Output
+ ------
+ histogram array, left bin edges array.
+ """
a = asarray(a).ravel()
if not iterable(bins):
if range is None:
More information about the Numpy-svn
mailing list