The hepconvert library is a bridge between columnar file formats, currently ROOT, and Parquet and soon will include HDF5. It aims to simplify file conversions in Python, replacing what is usually a multi-step process with one line of code, with builtin features for managing large datasets and choosing compression levels.
hepconvert can be installed from PyPI using pip:
pip install hepconvert
To install with Conda through conda-forge:
conda install -c conda-forge hepconvert
import hepconvert
# To merge two or more root files with TTrees,
# and add together any histograms:
hepconvert.merge_root("destination.root",
["ttree_file1.root", "ttree_file2.root"])
# To add root files with only histograms:
hepconvert.add_histograms("destination.root",
["hist_file1.root", "hist_file2.root"])
To run merge_root
from the command line:
hepconvert merge-root [options] [OUT_FILE] [IN_FILES]
To run add_histograms
:
hepconvert add [options] [OUT_FILE] [IN_FILES]
Find details on each function's CLI options on the readthedocs.