-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
261 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import pytest | ||
|
||
import babyyoda | ||
import babyyoda.read | ||
from babyyoda import grogu | ||
from babyyoda.test import init_yoda | ||
|
||
yoda, yoda_available, yoda2 = init_yoda() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_boost_histogram_histo1d_v2(mod): | ||
hists = mod("tests/test_histo1d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
v.to_boost_histogram() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_boost_histogram_histo1d_v3(mod): | ||
hists = mod("tests/test_histo1d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
v.to_boost_histogram() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_boost_histogram_histo2d_v2(mod): | ||
hists = mod("tests/test_histo2d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto2D) | ||
v.to_boost_histogram() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_boost_histogram_histo2d_v3(mod): | ||
hists = mod("tests/test_histo2d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto2D) | ||
v.to_boost_histogram() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import pytest | ||
|
||
import babyyoda | ||
import babyyoda.read | ||
from babyyoda import grogu | ||
from babyyoda.test import init_yoda | ||
|
||
yoda, yoda_available, yoda2 = init_yoda() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_hist_histo1d_v2(mod): | ||
hists = mod("tests/test_histo1d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
v.to_hist() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_hist_histo1d_v3(mod): | ||
hists = mod("tests/test_histo1d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
v.to_hist() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_hist_histo2d_v2(mod): | ||
hists = mod("tests/test_histo2d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto2D) | ||
v.to_hist() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_hist_histo2d_v3(mod): | ||
hists = mod("tests/test_histo2d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto2D) | ||
v.to_hist() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
from histoprint import print_hist | ||
|
||
import babyyoda | ||
import babyyoda.read | ||
from babyyoda import grogu | ||
from babyyoda.test import init_yoda | ||
|
||
yoda, yoda_available, yoda2 = init_yoda() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_histoprint_histo1d_v2(mod): | ||
hists = mod("tests/test_histo1d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
print_hist(v, summary=True, title=v.title()) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_histoprint_histo1d_v3(mod): | ||
hists = mod("tests/test_histo1d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
print_hist(v, summary=True, title=v.title()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import mplhep | ||
import pytest | ||
|
||
import babyyoda | ||
import babyyoda.read | ||
from babyyoda import grogu | ||
from babyyoda.test import init_yoda | ||
|
||
yoda, yoda_available, yoda2 = init_yoda() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_mplhep_histo1d_v2(mod): | ||
hists = mod("tests/test_histo1d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
mplhep.histplot(v) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_mplhep_histo1d_v3(mod): | ||
hists = mod("tests/test_histo1d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto1D) | ||
mplhep.histplot(v) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
def test_mplhep_histo2d_v2(mod): | ||
hists = mod("tests/test_histo2d_v2.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto2D) | ||
mplhep.hist2dplot(v) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"mod", | ||
[ | ||
babyyoda.read, | ||
grogu.read, | ||
yoda.read, | ||
], | ||
) | ||
@pytest.mark.skipif(not yoda2, reason="yoda >= 2.0.0 is required") | ||
def test_mplhep_histo2d_v3(mod): | ||
hists = mod("tests/test_histo2d_v3.yoda") | ||
for _, v in hists.items(): | ||
assert isinstance(v, babyyoda.histo1d.UHIHisto2D) | ||
mplhep.hist2dplot(v) |