Page MenuHomeHEPForge

No OneTemporary

diff --git a/tests/pytest-h2d b/tests/pytest-h2d
--- a/tests/pytest-h2d
+++ b/tests/pytest-h2d
@@ -1,22 +1,24 @@
#! /usr/bin/env python
+from __future__ import print_function
import yoda, random
h = yoda.Histo2D(5,0.,10., 5,0.,10., "/foo")
for _ in range(100):
h.fill(random.gauss(5, 3), random.gauss(5, 2))
print(h)
+print(h.bins)
yoda.write([h], "h2d.yoda")
aos = yoda.read("h2d.yoda")
for _, ao in aos.items():
print(ao)
yoda.write([h], "h2d.dat")
# aos = yoda.read("h2d.dat")
# for _, ao in aos.iteritems():
# print ao
s = yoda.mkScatter(h)
s = h.mkScatter()
s2 = s.mkScatter()
diff --git a/tests/pytest-rebin b/tests/pytest-rebin
--- a/tests/pytest-rebin
+++ b/tests/pytest-rebin
@@ -1,41 +1,42 @@
#! /usr/bin/env python
import yoda
+import numpy as np
h = yoda.Histo1D(10, 0, 5)
for x in (0.1, 0.2, 1.3, 2.1, 2.7, 2.8, 4.0, 4.1):
h.fill(x)
print(h.numBins)
-print(h.xEdges)
+print(h.xEdges())
print("Ha1")
ha1 = h.clone()
ha1.rebinBy(2)
print(ha1.numBins)
-print(ha1.xEdges)
+print(ha1.xEdges())
assert ha1.numBins == 5
-assert ha1.xEdges == [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
+assert np.allclose(ha1.xEdges(), [0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
print("Ha2")
ha2 = h.clone()
ha2.rebinBy(2, 2, 7)
print(ha2.numBins)
-print(ha2.xEdges)
+print(ha2.xEdges())
assert ha2.numBins == 7
-assert ha2.xEdges == [0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 4.5, 5.0]
+assert np.allclose(ha2.xEdges(), [0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 4.5, 5.0])
print("Hb1")
hb1 = h.clone()
hb1.rebinTo([0., 1., 3., 5.])
print(hb1.numBins)
-print(hb1.xEdges)
+print(hb1.xEdges())
assert hb1.numBins == 3
-assert hb1.xEdges == [0.0, 1.0, 3.0, 5.0]
+assert np.allclose(hb1.xEdges(), [0.0, 1.0, 3.0, 5.0])
print("Hb2")
hb2 = h.clone()
hb2.rebin([1., 1.5, 3., 4.5])
print(hb2.numBins)
-print(hb2.xEdges)
+print(hb2.xEdges())
assert hb2.numBins == 3
-assert hb2.xEdges == [1.0, 1.5, 3.0, 4.5]
+assert np.allclose(hb2.xEdges(), [1.0, 1.5, 3.0, 4.5])

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 5:36 PM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3805423
Default Alt Text
(1 KB)

Event Timeline