ROOT I/O in pure Python and NumPy.
Project description
Uproot is a library for reading and writing ROOT files in pure Python and NumPy.
Unlike the standard C++ ROOT implementation, Uproot is only an I/O library, primarily intended to stream data into machine learning libraries in Python. Unlike PyROOT and root_numpy, Uproot does not depend on C++ ROOT. Instead, it uses Numpy to cast blocks of data from the ROOT file as Numpy arrays.
Installation
Uproot can be installed from PyPI using pip.
pip install uproot
Uproot is also available using conda.
conda install -c conda-forge uproot
If you have already added conda-forge
as a channel, the -c conda-forge
is unnecessary. Adding the channel is recommended because it ensures that all of your packages use compatible versions (see conda-forge docs):
conda config --add channels conda-forge
conda update --all
Getting help
Start with the tutorials and reference documentation.
- Report bugs, request features, and ask for additional documentation on GitHub Issues.
- If you have a "How do I...?" question, start a GitHub Discussion with category "Q&A".
- Alternatively, ask about it on StackOverflow with the [uproot] tag. Be sure to include tags for any other libraries that you use, such as Pandas or PyTorch.
- To ask questions in real time, try the Gitter Scikit-HEP/uproot chat room.
Installation for developers
Uproot is an ordinary Python library; you can get a copy of the code with
git clone https://github.com/scikit-hep/uproot5.git
and install it locally by calling pip install -e .
in the repository directory.
If you need to develop Awkward Array as well, see its installation for developers.
Dependencies
Uproot's only strict dependencies are NumPy and packaging. Strict dependencies are automatically installed by pip (or conda).
Awkward Array is highly recommended and is automatically installed by pip (or conda), though it is possible to use Uproot without it. If you need a minimal installation, pass --no-deps
to pip and pass library="np"
to every array-fetching function, or globally set uproot.default_library
to get NumPy arrays instead of Awkward Arrays.
awkward
: Uproot 5.x requires Awkward 2.x.
The following libraries are also useful in conjunction with Uproot, but are not necessary. If you call a function that needs one, you'll be prompted to install it. (Conda installs most of these automatically.)
For ROOT files, compressed different ways:
lz4
andxxhash
: if reading ROOT files that have been LZ4-compressed.zstandard
: if reading ROOT files that have been ZSTD-compressed.- ZLIB and LZMA are built in (Python standard library).
For accessing remote files:
minio
: if reading files withs3://
URIs.xrootd
: if reading files withroot://
URIs.- HTTP/S access is built in (Python standard library).
For distributed computing with Dask:
dask
: see uproot.dask.dask-awkward
: for data with irregular structure ("jagged" arrays), see dask-awkward.
For exporting TTrees to Pandas:
pandas
: iflibrary="pd"
.awkward-pandas
: iflibrary="pd"
and the data have irregular structure ("jagged" arrays), see awkward-pandas.
For exporting histograms:
boost-histogram
: if converting histograms to boost-histogram withhistogram.to_boost()
.hist
: if converting histograms to hist withhistogram.to_hist()
.
Acknowledgements
Support for this work was provided by NSF cooperative agreements OAC-1836650 and PHY-2323298 (IRIS-HEP), grant OAC-1450377 (DIANA/HEP), and PHY-2121686 (US-CMS LHC Ops).
Thanks especially to the gracious help of Uproot contributors (including the original repository).
💻: code, 📖: documentation, 🚇: infrastructure, 🚧: maintainance, ⚠: tests/feedback, 🤔: foundational ideas.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file uproot-5.5.1.tar.gz
.
File metadata
- Download URL: uproot-5.5.1.tar.gz
- Upload date:
- Size: 941.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4c7092d1e00677cd97f4850085ae8bc17e6a78e11ea7ee794fa4312e8e4a96d |
|
MD5 | e2e7fde8182d8922ef9259a7c0aa5fcf |
|
BLAKE2b-256 | 5aa3f61ebb4ce5c733b17a2c2df71cbef2f3ee54b96d36ad9412fdec081b13f1 |
File details
Details for the file uproot-5.5.1-py3-none-any.whl
.
File metadata
- Download URL: uproot-5.5.1-py3-none-any.whl
- Upload date:
- Size: 362.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a04d0cbf99b223c1391a24412547e9cfac79f5a6d0d4bc781359b8016a89373 |
|
MD5 | 656e0a1aacd45768da0d28f2aa475f6d |
|
BLAKE2b-256 | 163d97ddf3019fd8852d9955fd500492a7a06c4f3656263dfb9c205609b4a3bc |