[ ]:
# to get the test root file manually
# !wget {'https://github.com/ikrommyd/coffea-virtual-array-demo/raw/de75f6d8a17be5cb1c71dbbf962b366fc92dc251/data/DYto2E.root'}
--2025-07-28 11:01:12-- https://github.com/ikrommyd/coffea-virtual-array-demo/raw/de75f6d8a17be5cb1c71dbbf962b366fc92dc251/data/DYto2E.root
Resolving github.com (github.com)... 140.82.114.3
Connecting to github.com (github.com)|140.82.114.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://media.githubusercontent.com/media/ikrommyd/coffea-virtual-array-demo/de75f6d8a17be5cb1c71dbbf962b366fc92dc251/data/DYto2E.root [following]
--2025-07-28 11:01:12-- https://media.githubusercontent.com/media/ikrommyd/coffea-virtual-array-demo/de75f6d8a17be5cb1c71dbbf962b366fc92dc251/data/DYto2E.root
Resolving media.githubusercontent.com (media.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to media.githubusercontent.com (media.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3376397 (3.2M) [application/octet-stream]
Saving to: ‘DYto2E.root’
DYto2E.root 100%[===================>] 3.22M --.-KB/s in 0.08s
2025-07-28 11:01:12 (42.6 MB/s) - ‘DYto2E.root’ saved [3376397/3376397]
Install libraries
[ ]:
!pip install awkward coffea
Collecting awkward
Downloading awkward-2.8.5-py3-none-any.whl.metadata (6.9 kB)
Collecting coffea
Downloading coffea-2025.7.3-py3-none-any.whl.metadata (8.1 kB)
Collecting awkward-cpp==47 (from awkward)
Downloading awkward_cpp-47-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (2.1 kB)
Requirement already satisfied: fsspec>=2022.11.0 in /usr/local/lib/python3.11/dist-packages (from awkward) (2025.3.0)
Requirement already satisfied: importlib-metadata>=4.13.0 in /usr/local/lib/python3.11/dist-packages (from awkward) (8.7.0)
Requirement already satisfied: numpy>=1.18.0 in /usr/local/lib/python3.11/dist-packages (from awkward) (2.0.2)
Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from awkward) (25.0)
Requirement already satisfied: aiohttp in /usr/local/lib/python3.11/dist-packages (from coffea) (3.12.14)
Requirement already satisfied: cachetools in /usr/local/lib/python3.11/dist-packages (from coffea) (5.5.2)
Requirement already satisfied: cloudpickle>=1.2.3 in /usr/local/lib/python3.11/dist-packages (from coffea) (3.1.1)
Collecting correctionlib>=2.6.0 (from coffea)
Downloading correctionlib-2.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.3 kB)
Collecting dask-awkward>=2025.5.0 (from coffea)
Downloading dask_awkward-2025.5.0-py3-none-any.whl.metadata (3.9 kB)
Collecting dask-histogram>=2025.2.0 (from coffea)
Downloading dask_histogram-2025.2.0-py3-none-any.whl.metadata (3.8 kB)
Requirement already satisfied: dask>=2024.3.0 in /usr/local/lib/python3.11/dist-packages (from dask[array]>=2024.3.0->coffea) (2025.5.0)
Collecting hist>=2 (from coffea)
Downloading hist-2.8.1-py3-none-any.whl.metadata (16 kB)
Collecting lz4 (from coffea)
Downloading lz4-4.4.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.8 kB)
Requirement already satisfied: matplotlib>=3 in /usr/local/lib/python3.11/dist-packages (from coffea) (3.10.0)
Collecting mplhep>=0.1.18 (from coffea)
Downloading mplhep-0.4.0-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: numba>=0.58.1 in /usr/local/lib/python3.11/dist-packages (from coffea) (0.60.0)
Requirement already satisfied: pandas in /usr/local/lib/python3.11/dist-packages (from coffea) (2.2.2)
Requirement already satisfied: pyarrow<21.0.0,>=6.0.0 in /usr/local/lib/python3.11/dist-packages (from coffea) (18.1.0)
Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from coffea) (2.32.3)
Requirement already satisfied: scipy>=1.1.0 in /usr/local/lib/python3.11/dist-packages (from coffea) (1.16.0)
Requirement already satisfied: toml>=0.10.2 in /usr/local/lib/python3.11/dist-packages (from coffea) (0.10.2)
Requirement already satisfied: tqdm>=4.27.0 in /usr/local/lib/python3.11/dist-packages (from coffea) (4.67.1)
Collecting uproot>=5.6.0 (from coffea)
Downloading uproot-5.6.3-py3-none-any.whl.metadata (33 kB)
Collecting vector!=1.6.0,>=1.4.1 (from coffea)
Downloading vector-1.6.3-py3-none-any.whl.metadata (16 kB)
Requirement already satisfied: pydantic>=2 in /usr/local/lib/python3.11/dist-packages (from correctionlib>=2.6.0->coffea) (2.11.7)
Requirement already satisfied: rich in /usr/local/lib/python3.11/dist-packages (from correctionlib>=2.6.0->coffea) (13.9.4)
Requirement already satisfied: click>=8.1 in /usr/local/lib/python3.11/dist-packages (from dask>=2024.3.0->dask[array]>=2024.3.0->coffea) (8.2.1)
Requirement already satisfied: partd>=1.4.0 in /usr/local/lib/python3.11/dist-packages (from dask>=2024.3.0->dask[array]>=2024.3.0->coffea) (1.4.2)
Requirement already satisfied: pyyaml>=5.3.1 in /usr/local/lib/python3.11/dist-packages (from dask>=2024.3.0->dask[array]>=2024.3.0->coffea) (6.0.2)
Requirement already satisfied: toolz>=0.10.0 in /usr/local/lib/python3.11/dist-packages (from dask>=2024.3.0->dask[array]>=2024.3.0->coffea) (0.12.1)
Collecting dask>=2024.3.0 (from dask[array]>=2024.3.0->coffea)
Downloading dask-2025.3.0-py3-none-any.whl.metadata (3.8 kB)
Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.11/dist-packages (from dask-awkward>=2025.5.0->coffea) (4.14.1)
Collecting boost-histogram>=1.3.2 (from dask-histogram>=2025.2.0->coffea)
Downloading boost_histogram-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (23 kB)
INFO: pip is looking at multiple versions of dask[array] to determine which version is compatible with other requirements. This could take a while.
Collecting dask[array]>=2024.3.0 (from coffea)
Downloading dask-2025.7.0-py3-none-any.whl.metadata (3.8 kB)
Downloading dask-2025.5.1-py3-none-any.whl.metadata (3.8 kB)
Downloading dask-2025.4.1-py3-none-any.whl.metadata (3.8 kB)
Downloading dask-2025.4.0-py3-none-any.whl.metadata (3.8 kB)
Collecting histoprint>=2.2.0 (from hist>=2->coffea)
Downloading histoprint-2.6.0-py3-none-any.whl.metadata (17 kB)
Requirement already satisfied: zipp>=3.20 in /usr/local/lib/python3.11/dist-packages (from importlib-metadata>=4.13.0->awkward) (3.23.0)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (1.3.2)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (4.59.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (1.4.8)
Requirement already satisfied: pillow>=8 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (11.3.0)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (3.2.3)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3->coffea) (2.9.0.post0)
Collecting mplhep-data>=0.0.4 (from mplhep>=0.1.18->coffea)
Downloading mplhep_data-0.0.4-py3-none-any.whl.metadata (3.4 kB)
Collecting uhi>=0.2.0 (from mplhep>=0.1.18->coffea)
Downloading uhi-0.5.0-py3-none-any.whl.metadata (7.5 kB)
Requirement already satisfied: llvmlite<0.44,>=0.43.0dev0 in /usr/local/lib/python3.11/dist-packages (from numba>=0.58.1->coffea) (0.43.0)
Requirement already satisfied: cramjam>=2.5.0 in /usr/local/lib/python3.11/dist-packages (from uproot>=5.6.0->coffea) (2.10.0)
Requirement already satisfied: xxhash in /usr/local/lib/python3.11/dist-packages (from uproot>=5.6.0->coffea) (3.5.0)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (2.6.1)
Requirement already satisfied: aiosignal>=1.4.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (1.4.0)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (25.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (1.7.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (6.6.3)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (0.3.2)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->coffea) (1.20.1)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas->coffea) (2025.2)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas->coffea) (2025.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->coffea) (3.4.2)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests->coffea) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->coffea) (2.5.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests->coffea) (2025.7.14)
Requirement already satisfied: locket in /usr/local/lib/python3.11/dist-packages (from partd>=1.4.0->dask>=2024.3.0->dask[array]>=2024.3.0->coffea) (1.0.0)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2->correctionlib>=2.6.0->coffea) (0.7.0)
Requirement already satisfied: pydantic-core==2.33.2 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2->correctionlib>=2.6.0->coffea) (2.33.2)
Requirement already satisfied: typing-inspection>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2->correctionlib>=2.6.0->coffea) (0.4.1)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.7->matplotlib>=3->coffea) (1.17.0)
Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.11/dist-packages (from rich->correctionlib>=2.6.0->coffea) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.11/dist-packages (from rich->correctionlib>=2.6.0->coffea) (2.19.2)
Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.11/dist-packages (from markdown-it-py>=2.2.0->rich->correctionlib>=2.6.0->coffea) (0.1.2)
Downloading awkward-2.8.5-py3-none-any.whl (886 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 886.8/886.8 kB 15.1 MB/s eta 0:00:00
Downloading awkward_cpp-47-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (638 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 638.8/638.8 kB 30.9 MB/s eta 0:00:00
Downloading coffea-2025.7.3-py3-none-any.whl (281 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 281.9/281.9 kB 15.0 MB/s eta 0:00:00
Downloading correctionlib-2.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 436.1/436.1 kB 24.2 MB/s eta 0:00:00
Downloading dask_awkward-2025.5.0-py3-none-any.whl (90 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.1/90.1 kB 5.1 MB/s eta 0:00:00
Downloading dask-2025.3.0-py3-none-any.whl (1.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 48.9 MB/s eta 0:00:00
Downloading dask_histogram-2025.2.0-py3-none-any.whl (27 kB)
Downloading hist-2.8.1-py3-none-any.whl (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.9/40.9 kB 1.9 MB/s eta 0:00:00
Downloading mplhep-0.4.0-py3-none-any.whl (48 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.4/48.4 kB 2.9 MB/s eta 0:00:00
Downloading uproot-5.6.3-py3-none-any.whl (382 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 382.8/382.8 kB 22.2 MB/s eta 0:00:00
Downloading vector-1.6.3-py3-none-any.whl (179 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 179.6/179.6 kB 10.8 MB/s eta 0:00:00
Downloading lz4-4.4.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 42.4 MB/s eta 0:00:00
Downloading boost_histogram-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 45.9 MB/s eta 0:00:00
Downloading histoprint-2.6.0-py3-none-any.whl (16 kB)
Downloading mplhep_data-0.0.4-py3-none-any.whl (9.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.1/9.1 MB 88.1 MB/s eta 0:00:00
Downloading uhi-0.5.0-py3-none-any.whl (13 kB)
Installing collected packages: vector, uhi, mplhep-data, lz4, boost-histogram, awkward-cpp, histoprint, dask, awkward, uproot, mplhep, hist, dask-awkward, correctionlib, dask-histogram, coffea
Attempting uninstall: dask
Found existing installation: dask 2025.5.0
Uninstalling dask-2025.5.0:
Successfully uninstalled dask-2025.5.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
rapids-dask-dependency 25.6.0 requires dask==2025.5.0, but you have dask 2025.3.0 which is incompatible.
distributed 2025.5.0 requires dask==2025.5.0, but you have dask 2025.3.0 which is incompatible.
Successfully installed awkward-2.8.5 awkward-cpp-47 boost-histogram-1.5.2 coffea-2025.7.3 correctionlib-2.7.0 dask-2025.3.0 dask-awkward-2025.5.0 dask-histogram-2025.2.0 hist-2.8.1 histoprint-2.6.0 lz4-4.4.4 mplhep-0.4.0 mplhep-data-0.0.4 uhi-0.5.0 uproot-5.6.3 vector-1.6.3
[ ]:
!pip install git+https://github.com/maxymnaumchyk/awkward-zipper.git
Collecting git+https://github.com/maxymnaumchyk/awkward-zipper.git
Cloning https://github.com/maxymnaumchyk/awkward-zipper.git to /tmp/pip-req-build-og7utoyf
Running command git clone --filter=blob:none --quiet https://github.com/maxymnaumchyk/awkward-zipper.git /tmp/pip-req-build-og7utoyf
Resolved https://github.com/maxymnaumchyk/awkward-zipper.git to commit 9b0aba48999f387885c0d90844bebf1552d72b31
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting awkward@ git+https://github.com/scikit-hep/awkward@main (from awkward-zipper==0.0.1)
Cloning https://github.com/scikit-hep/awkward (to revision main) to /tmp/pip-install-v5dpnq5m/awkward_bd03197589a54ff1a2644779363ffcc5
Running command git clone --filter=blob:none --quiet https://github.com/scikit-hep/awkward /tmp/pip-install-v5dpnq5m/awkward_bd03197589a54ff1a2644779363ffcc5
Resolved https://github.com/scikit-hep/awkward to commit d94895ecc949ba0d1de40bc4d447e65bdb582c1a
Running command git submodule update --init --recursive -q
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numba in /usr/local/lib/python3.11/dist-packages (from awkward-zipper==0.0.1) (0.60.0)
Requirement already satisfied: vector in /usr/local/lib/python3.11/dist-packages (from awkward-zipper==0.0.1) (1.6.3)
Requirement already satisfied: awkward-cpp==47 in /usr/local/lib/python3.11/dist-packages (from awkward@ git+https://github.com/scikit-hep/awkward@main->awkward-zipper==0.0.1) (47)
Requirement already satisfied: fsspec>=2022.11.0 in /usr/local/lib/python3.11/dist-packages (from awkward@ git+https://github.com/scikit-hep/awkward@main->awkward-zipper==0.0.1) (2025.3.0)
Requirement already satisfied: importlib-metadata>=4.13.0 in /usr/local/lib/python3.11/dist-packages (from awkward@ git+https://github.com/scikit-hep/awkward@main->awkward-zipper==0.0.1) (8.7.0)
Requirement already satisfied: numpy>=1.18.0 in /usr/local/lib/python3.11/dist-packages (from awkward@ git+https://github.com/scikit-hep/awkward@main->awkward-zipper==0.0.1) (2.0.2)
Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from awkward@ git+https://github.com/scikit-hep/awkward@main->awkward-zipper==0.0.1) (25.0)
Requirement already satisfied: llvmlite<0.44,>=0.43.0dev0 in /usr/local/lib/python3.11/dist-packages (from numba->awkward-zipper==0.0.1) (0.43.0)
Requirement already satisfied: zipp>=3.20 in /usr/local/lib/python3.11/dist-packages (from importlib-metadata>=4.13.0->awkward@ git+https://github.com/scikit-hep/awkward@main->awkward-zipper==0.0.1) (3.23.0)
Building wheels for collected packages: awkward-zipper
Building wheel for awkward-zipper (pyproject.toml) ... done
Created wheel for awkward-zipper: filename=awkward_zipper-0.0.1-py3-none-any.whl size=24548 sha256=f46e70a2016aabaff10dea18aadc1731b58bea784877a25f351344a876334852
Stored in directory: /tmp/pip-ephem-wheel-cache-z895kchm/wheels/13/ff/6a/a86ac1ebbfd7f56ba74dec9ccffa35df23b6890fac28284fed
Successfully built awkward-zipper
Installing collected packages: awkward-zipper
Successfully installed awkward-zipper-0.0.1
Use a branch from main to load virtual arrays with uproot
[ ]:
!pip install uproot@git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy
Collecting uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy
Cloning https://github.com/scikit-hep/uproot5 (to revision pfackeldey/uproot_lazy) to /tmp/pip-install-si6us5uj/uproot_00eaa98e35b445e9bc12b36636dca556
Running command git clone --filter=blob:none --quiet https://github.com/scikit-hep/uproot5 /tmp/pip-install-si6us5uj/uproot_00eaa98e35b445e9bc12b36636dca556
Running command git checkout -b pfackeldey/uproot_lazy --track origin/pfackeldey/uproot_lazy
Switched to a new branch 'pfackeldey/uproot_lazy'
Branch 'pfackeldey/uproot_lazy' set up to track remote branch 'pfackeldey/uproot_lazy' from 'origin'.
Resolved https://github.com/scikit-hep/uproot5 to commit f8a3461cdeba7ae5a909898ff14e881aa380d986
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: awkward>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (2.8.5)
Requirement already satisfied: cramjam>=2.5.0 in /usr/local/lib/python3.11/dist-packages (from uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (2.10.0)
Requirement already satisfied: fsspec in /usr/local/lib/python3.11/dist-packages (from uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (2025.3.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.11/dist-packages (from uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (2.0.2)
Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (25.0)
Requirement already satisfied: xxhash in /usr/local/lib/python3.11/dist-packages (from uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (3.5.0)
Requirement already satisfied: awkward-cpp==47 in /usr/local/lib/python3.11/dist-packages (from awkward>=2.8.2->uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (47)
Requirement already satisfied: importlib-metadata>=4.13.0 in /usr/local/lib/python3.11/dist-packages (from awkward>=2.8.2->uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (8.7.0)
Requirement already satisfied: zipp>=3.20 in /usr/local/lib/python3.11/dist-packages (from importlib-metadata>=4.13.0->awkward>=2.8.2->uproot@ git+https://github.com/scikit-hep/uproot5@pfackeldey/uproot_lazy) (3.23.0)
Building wheels for collected packages: uproot
Building wheel for uproot (pyproject.toml) ... done
Created wheel for uproot: filename=uproot-5.6.3.dev29+gf8a3461-py3-none-any.whl size=377233 sha256=04d5b597d5f7b0ff30ce100a94a88b11027b16608b0f4265a9766dd893936f1f
Stored in directory: /tmp/pip-ephem-wheel-cache-avm3geh8/wheels/6d/4a/38/cca594ce698fdd158d6039640034edca9dda20c890c171703a
Successfully built uproot
Installing collected packages: uproot
Attempting uninstall: uproot
Found existing installation: uproot 5.6.3
Uninstalling uproot-5.6.3:
Successfully uninstalled uproot-5.6.3
Successfully installed uproot-5.6.3.dev29+gf8a3461
Virtual mode
[ ]:
import awkward as ak
import numpy as np
from coffea.nanoevents import NanoEventsFactory, NanoAODSchema, BaseSchema
import awkward_zipper
import uproot
#Helper functions for data loading
def make_events_coffea(file, schemaclass=NanoAODSchema):
access_log = []
events = NanoEventsFactory.from_root(
{file: "Events"},
mode="virtual",
schemaclass=schemaclass,
metadata={"dataset": file.removeprefix("data/").removesuffix(".root")},
access_log=access_log
).events()
return events, access_log
def make_events_zipper(file):
access_log = []
# Create a TTree from root
tree = uproot.open(file)["Events"]
# TTree -> awkward.Array[awkward.Record[str, awkward.Array]]
array = tree.virtual_arrays(ak_add_doc=True, access_log=access_log)
# construct an awkward array using awkward-zipper
restructure = awkward_zipper.NanoAOD(version="latest")
zipper_array = restructure(array)
return zipper_array, access_log
run coffea first then zipper
[ ]:
root_file = "DYto2E.root"
[ ]:
%%timeit
events_coffea, access_log_coffea = make_events_coffea(root_file)
2.06 s ± 613 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_zipper, access_log_zipper = make_events_zipper(root_file)
1.56 s ± 271 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
change order
[ ]:
root_file2 = "DYto2E.root"
[ ]:
%%timeit
events_zipper, access_log_zipper = make_events_zipper(root_file2)
1.55 s ± 214 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_coffea, access_log_coffea = make_events_coffea(root_file2)
1.37 s ± 262 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
try another root file
[ ]:
!wget {'https://raw.githubusercontent.com/scikit-hep/coffea/refs/heads/master/tests/samples/nano_dy.root'}
--2025-07-28 11:15:04-- https://raw.githubusercontent.com/scikit-hep/coffea/refs/heads/master/tests/samples/nano_dy.root
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 352599 (344K) [application/octet-stream]
Saving to: ‘nano_dy.root’
nano_dy.root 100%[===================>] 344.33K --.-KB/s in 0.04s
2025-07-28 11:15:04 (7.81 MB/s) - ‘nano_dy.root’ saved [352599/352599]
[ ]:
root_file_n = "nano_dy.root"
[ ]:
%%timeit
events_coffea, access_log_coffea = make_events_coffea(root_file_n)
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for LowPtElectron_electronIdx => Electron
warnings.warn(
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for LowPtElectron_genPartIdx => GenPart
warnings.warn(
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for LowPtElectron_photonIdx => Photon
warnings.warn(
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for FatJet_genJetAK8Idx => GenJetAK8
warnings.warn(
831 ms ± 8.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_zipper, access_log_zipper = make_events_zipper(root_file_n)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_electronIdx => Electron
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_genPartIdx => GenPart
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_photonIdx => Photon
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for FatJet_genJetAK8Idx => GenJetAK8
zipper_array = restructure(array)
1.02 s ± 121 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
change order
[ ]:
root_file_n2 = "nano_dy.root"
[ ]:
%%timeit
events_zipper, access_log_zipper = make_events_zipper(root_file_n2)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_electronIdx => Electron
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_genPartIdx => GenPart
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_photonIdx => Photon
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for FatJet_genJetAK8Idx => GenJetAK8
zipper_array = restructure(array)
966 ms ± 9.07 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_coffea, access_log_coffea = make_events_coffea(root_file_n2)
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for LowPtElectron_electronIdx => Electron
warnings.warn(
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for LowPtElectron_genPartIdx => GenPart
warnings.warn(
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for LowPtElectron_photonIdx => Photon
warnings.warn(
/usr/local/lib/python3.11/dist-packages/coffea/nanoevents/schemas/nanoaod.py:264: RuntimeWarning: Missing cross-reference index for FatJet_genJetAK8Idx => GenJetAK8
warnings.warn(
976 ms ± 227 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
yet another root file
[ ]:
!wget {'https://raw.githubusercontent.com/scikit-hep/coffea/refs/heads/master/tests/samples/pfnano.root'}
--2025-07-28 11:21:24-- https://raw.githubusercontent.com/scikit-hep/coffea/refs/heads/master/tests/samples/pfnano.root
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2958960 (2.8M) [application/octet-stream]
Saving to: ‘pfnano.root.1’
pfnano.root.1 100%[===================>] 2.82M --.-KB/s in 0.08s
2025-07-28 11:21:25 (35.8 MB/s) - ‘pfnano.root.1’ saved [2958960/2958960]
[ ]:
root_file_p = "pfnano.root"
[ ]:
%%timeit
events_coffea, access_log_coffea = make_events_coffea(root_file_p)
1.14 s ± 197 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_zipper, access_log_zipper = make_events_zipper(root_file_p)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_electronIdx => Electron
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_genPartIdx => GenPart
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_photonIdx => Photon
zipper_array = restructure(array)
1.28 s ± 239 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
change order
[ ]:
root_file_p2 = "pfnano.root"
[ ]:
%%timeit
events_zipper, access_log_zipper = make_events_zipper(root_file_p2)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_electronIdx => Electron
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_genPartIdx => GenPart
zipper_array = restructure(array)
/tmp/ipython-input-5-3098901281.py:29: RuntimeWarning: Missing cross-reference index for LowPtElectron_photonIdx => Photon
zipper_array = restructure(array)
1.36 s ± 290 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_coffea, access_log_coffea = make_events_coffea(root_file_p2)
1.12 s ± 232 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
Eager mode
[ ]:
#Helper functions for data loading
def make_events_coffea_eager(file, schemaclass=NanoAODSchema):
events = NanoEventsFactory.from_root(
{file: "Events"},
mode="eager",
schemaclass=schemaclass,
metadata={"dataset": file.removeprefix("data/").removesuffix(".root")},
).events()
return events
def make_events_zipper_eager(file):
# Create a TTree from root
tree = uproot.open(file)["Events"]
# TTree -> awkward.Array[awkward.Record[str, awkward.Array]]
array = tree.arrays(ak_add_doc=True)
# construct an awkward array using awkward-zipper
restructure = awkward_zipper.NanoAOD(version="latest")
zipper_array = restructure(array)
return zipper_array
[ ]:
root_file3 = "DYto2E.root"
[ ]:
%%timeit
events_coffea_eager = make_events_coffea_eager(root_file3)
3.48 s ± 253 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_zipper_eager = make_events_zipper_eager(root_file3)
/usr/local/lib/python3.11/dist-packages/awkward_zipper/kernels.py:144: DeprecationWarning: __array__ implementation doesn't accept a copy keyword, so passing copy=False failed. __array__ must implement 'dtype' and 'copy' keyword arguments.
out[i::n] = idx
2.38 s ± 280 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
change order
[ ]:
root_file4 = "DYto2E.root"
[ ]:
%%timeit
events_zipper_eager = make_events_zipper_eager(root_file4)
2.27 s ± 246 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]:
%%timeit
events_coffea_eager = make_events_coffea_eager(root_file4)
3.54 s ± 205 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
[ ]: