summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_twodim_base.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-04-02 18:25:50 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-04-02 18:25:50 +0000
commita1f65e154f15f1c5b35c2befaeb74f3952b2c3e2 (patch)
tree0dbde984312d3ffbdf7fd940d5090e6848c8c530 /numpy/lib/tests/test_twodim_base.py
parent471ee74d8a32267d438f20074c077efb3b057ee7 (diff)
downloadnumpy-a1f65e154f15f1c5b35c2befaeb74f3952b2c3e2.tar.gz
Add patch in Ticket #189 for histogramdd. Fixes bug reported by Ben Granett
Diffstat (limited to 'numpy/lib/tests/test_twodim_base.py')
-rw-r--r--numpy/lib/tests/test_twodim_base.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py
index 7ef8a94e9..15ffb2777 100644
--- a/numpy/lib/tests/test_twodim_base.py
+++ b/numpy/lib/tests/test_twodim_base.py
@@ -149,6 +149,13 @@ class test_histogram2d(NumpyTestCase):
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0]])
assert_array_equal(H.T, answer)
+ H = histogram2d(x, y, xedges)[0]
+ assert_array_equal(H.T, answer)
+ H,xedges,yedges = histogram2d(range(10),range(10))
+ assert_array_equal(H, eye(10,10))
+ assert_array_equal(xedges, np.linspace(0,9,11))
+ assert_array_equal(yedges, np.linspace(0,9,11))
+
def check_asym(self):
x = array([1, 1, 2, 3, 4, 4, 4, 5])
y = array([1, 3, 2, 0, 1, 2, 3, 4])
@@ -160,6 +167,8 @@ class test_histogram2d(NumpyTestCase):
[0,1,1,1,0],
[0,0,0,0,1]])
assert_array_almost_equal(H, answer/8., 3)
+ assert_array_equal(xed, np.linspace(0,6,7))
+ assert_array_equal(yed, np.linspace(0,5,6))
def check_norm(self):
x = array([1,2,3,1,2,3,1,2,3])
y = array([1,1,1,2,2,2,3,3,3])
@@ -169,5 +178,10 @@ class test_histogram2d(NumpyTestCase):
[.5,.5,.25]])/9.
assert_array_almost_equal(H, answer, 3)
+ def check_all_outliers(self):
+ r = rand(100)+1.
+ H, xed, yed = histogram2d(r, r, (4, 5), range=([0,1], [0,1]))
+ assert_array_equal(H, 0)
+
if __name__ == "__main__":
NumpyTest().run()