diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/lib/function_base.py | 12 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 435feff80..0ede094f7 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -4,7 +4,7 @@ __all__ = ['logspace', 'linspace', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', 'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', - 'histogram', 'histogramnd', 'bincount', 'digitize', 'cov', + 'histogram', 'histogramdd', 'bincount', 'digitize', 'cov', 'corrcoef', 'msort', 'median', 'sinc', 'hamming', 'hanning', 'bartlett', 'blackman', 'kaiser', 'trapz', 'i0', 'add_newdoc', 'add_docstring', 'meshgrid', 'delete', 'insert', 'append' @@ -103,14 +103,14 @@ def histogram(a, bins=10, range=None, normed=False): else: return n, bins -def histogramnd(sample, bins=10, range=None, normed=False): - """histogramnd(sample, bins = 10, range = None, normed = False) -> H, edges +def histogramdd(sample, bins=10, range=None, normed=False): + """histogramdd(sample, bins = 10, range = None, normed = False) -> H, edges - Return the N-dimensional histogram computed from sample. + Return the D-dimensional histogram computed from sample. Parameters ---------- - sample: A sequence of N arrays, or an KxN array. + sample: A sequence of D arrays, or an NxD array. bins: A sequence of edge arrays, or a sequence of the number of bins. If a scalar is given, it is assumed to be the number of bins for all dimensions. @@ -126,7 +126,7 @@ def histogramnd(sample, bins=10, range=None, normed=False): Example: x = random.randn(100,3) - H, edges = histogramnd(x, bins = (5, 6, 7)) + H, edges = histogramdd(x, bins = (5, 6, 7)) See also: histogram """ diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index a8ccf5eaa..b1d5ec450 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -353,24 +353,24 @@ class test_histogram(NumpyTestCase): (a,b)=histogram(linspace(0,10,100)) assert(all(a==10)) -class test_histogramnd(NumpyTestCase): +class test_histogramdd(NumpyTestCase): def check_simple(self): x = array([[-.5, .5, 1.5], [-.5, 1.5, 2.5], [-.5, 2.5, .5], \ [.5, .5, 1.5], [.5, 1.5, 2.5], [.5, 2.5, 2.5]]) - H, edges = histogramnd(x, (2,3,3), range = [[-1,1], [0,3], [0,3]]) + H, edges = histogramdd(x, (2,3,3), range = [[-1,1], [0,3], [0,3]]) answer = asarray([[[0,1,0], [0,0,1], [1,0,0]], [[0,1,0], [0,0,1], [0,0,1]]]) assert(all(H == answer)) # Check normalization ed = [[-2,0,2], [0,1,2,3], [0,1,2,3]] - H, edges = histogramnd(x, bins = ed, normed = True) + H, edges = histogramdd(x, bins = ed, normed = True) assert(all(H == answer/12.)) # Check that H has the correct shape. - H, edges = histogramnd(x, (2,3,4), range = [[-1,1], [0,3], [0,4]], normed=True) + H, edges = histogramdd(x, (2,3,4), range = [[-1,1], [0,3], [0,4]], normed=True) answer = asarray([[[0,1,0,0], [0,0,1,0], [1,0,0,0]], [[0,1,0,0], [0,0,1,0], [0,0,1,0]]]) assert_array_almost_equal(H, answer/6., 4) # Check that a sequence of arrays is accepted and H has the correct shape. z = [squeeze(y) for y in split(x,3,axis=1)] - H, edges = histogramnd(z, bins=(4,3,2),range=[[-2,2], [0,3], [0,2]]) + H, edges = histogramdd(z, bins=(4,3,2),range=[[-2,2], [0,3], [0,2]]) answer = asarray([[[0,0],[0,0],[0,0]], [[0,1], [0,0], [1,0]], [[0,1], [0,0],[0,0]], |