Skip to content

Commit

Permalink
Add mplhep examples
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Nov 16, 2024
1 parent 51eb84a commit cb42a49
Show file tree
Hide file tree
Showing 13 changed files with 516 additions and 13 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ import babyyoda.yoda as yoda

## Interfaces

| Interface | Status | Examples |
| ---------------------------------------------------------------- | ------ | ------------------------------------------------------ |
| [histoprint](https://github.com/scikit-hep/histoprint) || [histoprint1d](examples/interface/histoprint/1d.ipynb) |
| [mplhep](https://github.com/scikit-hep/mplhep) || [mplhep1d](examples/interface/mplhep/1d.ipynb) |
| [plothist](https://github.com/scikit-hep/plothist) || [histoprint1d](examples/interface/plothist/1d.ipynb) |
| [uproot](https://github.com/scikit-hep/uproot) || |
| [hist](https://github.com/scikit-hep/hist) || |
| [boost-histogram](https://github.com/scikit-hep/boost-histogram) || |
| [cuda-histogram](https://github.com/scikit-hep/cuda-histogram) || |
| [boost-histogram](https://github.com/scikit-hep/cuda-histogram) || |
| [ROOT](https://github.com/root-project/root) || |
| Interface | Status | Examples |
| ---------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
| [histoprint](https://github.com/scikit-hep/histoprint) || [histoprint histo1d](examples/interface/histoprint/histo1d.ipynb) |
| [mplhep](https://github.com/scikit-hep/mplhep) || [mplhep histo1d](examples/interface/mplhep/histo1d.ipynb), [mplhep histo2d](examples/interface/mplhep/histo2d.ipynb) |
| [plothist](https://github.com/scikit-hep/plothist) || [plothist1d](examples/interface/plothist/1d.ipynb) |
| [uproot](https://github.com/scikit-hep/uproot) || |
| [hist](https://github.com/scikit-hep/hist) || |
| [boost-histogram](https://github.com/scikit-hep/boost-histogram) || |
| [cuda-histogram](https://github.com/scikit-hep/cuda-histogram) || |
| [boost-histogram](https://github.com/scikit-hep/cuda-histogram) || |
| [ROOT](https://github.com/root-project/root) || |

## License

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"id": "615547eb-5c01-4749-9069-e75dbaf24d83",
"metadata": {},
"outputs": [],
"source": [
"from histoprint import print_hist\n",
"import babyyoda"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "556cb6d5-a1e3-472f-854a-ad0ac230a622",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'/': GROGU_HISTO1D_V3(d_annotations={'Path': '/', 'Title': 'test', 'Type': 'Histo1D'}, d_key='/', d_edges=[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], d_bins=[GROGU_HISTO1D_V3.Bin(d_sumw=3.0, d_sumw2=3.0, d_sumwx=-5.0, d_sumwx2=9.0, d_numentries=3.0), GROGU_HISTO1D_V3.Bin(d_sumw=0.0, d_sumw2=0.0, d_sumwx=0.0, d_sumwx2=0.0, d_numentries=0.0), GROGU_HISTO1D_V3.Bin(d_sumw=1.0, d_sumw2=1.0, d_sumwx=1.0, d_sumwx2=1.0, d_numentries=1.0), GROGU_HISTO1D_V3.Bin(d_sumw=2.0, d_sumw2=2.0, d_sumwx=4.0, d_sumwx2=8.0, d_numentries=2.0), GROGU_HISTO1D_V3.Bin(d_sumw=3.0, d_sumw2=3.0, d_sumwx=9.0, d_sumwx2=27.0, d_numentries=3.0), GROGU_HISTO1D_V3.Bin(d_sumw=4.0, d_sumw2=4.0, d_sumwx=16.0, d_sumwx2=64.0, d_numentries=4.0), GROGU_HISTO1D_V3.Bin(d_sumw=5.0, d_sumw2=5.0, d_sumwx=25.0, d_sumwx2=125.0, d_numentries=5.0), GROGU_HISTO1D_V3.Bin(d_sumw=6.0, d_sumw2=6.0, d_sumwx=36.0, d_sumwx2=216.0, d_numentries=6.0), GROGU_HISTO1D_V3.Bin(d_sumw=7.0, d_sumw2=7.0, d_sumwx=49.0, d_sumwx2=343.0, d_numentries=7.0), GROGU_HISTO1D_V3.Bin(d_sumw=8.0, d_sumw2=8.0, d_sumwx=64.0, d_sumwx2=512.0, d_numentries=8.0), GROGU_HISTO1D_V3.Bin(d_sumw=9.0, d_sumw2=9.0, d_sumwx=81.0, d_sumwx2=729.0, d_numentries=9.0), GROGU_HISTO1D_V3.Bin(d_sumw=21.0, d_sumw2=21.0, d_sumwx=221.0, d_sumwx2=2331.0, d_numentries=21.0)])}"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"h = babyyoda.read(\"../../../tests/test_histo1d_v3.yoda\")\n",
"h"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8d443f31-3ce2-49ee-ae3f-79d3103cf1d7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" test \n",
" 0.000 _ x 10^+01 9/row ╷\n",
" 0.100 _\n",
" 0.200 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.300 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.400 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.500 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.600 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.700 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.800 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 0.900 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" 1.000 _\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\u001b[90;40m█\u001b[39;49m\n",
" \u001b[90;40m█\u001b[39;49m \n",
" Tot: 4.50e+01 \n",
" Avg: 6.83e-01 \n",
" Std: 2.21e-01 \n"
]
}
],
"source": [
"v=h['/']\n",
"print_hist(v, summary=True, title=v.title())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit cb42a49

Please sign in to comment.