summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_twodim_base.py
diff options
context:
space:
mode:
authorÅsmund Hjulstad <ahju@statoil.com>2015-02-13 14:10:12 +0100
committerÅsmund Hjulstad <ahju@statoil.com>2015-02-13 15:35:14 +0100
commit40fd50e125755bcf025fba629f8db76b4c2219cc (patch)
tree4061076c356238cf4f025be2bd95c858b0ad061d /numpy/lib/tests/test_twodim_base.py
parent8cf7c4a9534e5444f07974e019383a395a8fac9e (diff)
downloadnumpy-40fd50e125755bcf025fba629f8db76b4c2219cc.tar.gz
DOC: Updated docstring for histogram2d as suggested in issue #5538
Also, added unittest for [int, array] combination arguments
Diffstat (limited to 'numpy/lib/tests/test_twodim_base.py')
-rw-r--r--numpy/lib/tests/test_twodim_base.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py
index 739061a5d..b65a8df97 100644
--- a/numpy/lib/tests/test_twodim_base.py
+++ b/numpy/lib/tests/test_twodim_base.py
@@ -265,6 +265,37 @@ class TestHistogram2d(TestCase):
a, edge1, edge2 = histogram2d([], [], bins=4)
assert_array_max_ulp(a, np.zeros((4, 4)))
+ def test_binparameter_combination(self):
+ x = array(
+ [0, 0.09207008, 0.64575234, 0.12875982, 0.47390599,
+ 0.59944483, 1])
+ y = array(
+ [0, 0.14344267, 0.48988575, 0.30558665, 0.44700682,
+ 0.15886423, 1])
+ edges = (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1)
+ H, xe, ye = histogram2d(x, y, (edges, 4))
+ answer = array(
+ [[ 2., 0., 0., 0.],
+ [ 0., 1., 0., 0.],
+ [ 0., 0., 0., 0.],
+ [ 0., 0., 0., 0.],
+ [ 0., 1., 0., 0.],
+ [ 1., 0., 0., 0.],
+ [ 0., 1., 0., 0.],
+ [ 0., 0., 0., 0.],
+ [ 0., 0., 0., 0.],
+ [ 0., 0., 0., 1.]])
+ assert_array_equal(H, answer)
+ assert_array_equal(ye, array([0., 0.25, 0.5, 0.75, 1]))
+ H, xe, ye = histogram2d(x, y, (4, edges))
+ answer = array(
+ [[ 1., 1., 0., 1., 0., 0., 0., 0., 0., 0.],
+ [ 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],
+ [ 0., 1., 0., 0., 1., 0., 0., 0., 0., 0.],
+ [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]])
+ assert_array_equal(H, answer)
+ assert_array_equal(xe, array([0., 0.25, 0.5, 0.75, 1]))
+
class TestTri(TestCase):
def test_dtype(self):