Skip to content

scikit-hep/uproot5

Repository files navigation

PyPI version Conda-Forge Python 3.8β€’3.12 BSD-3 Clause License Continuous integration tests

Scikit-HEP NSF-1836650 DOI 10.5281/zenodo.4340632 Documentation Gitter

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.

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 and xxhash: 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 with s3:// URIs.
  • xrootd: if reading files with root:// URIs.
  • HTTP/S access is built in (Python standard library).

For distributed computing with Dask:

For exporting TTrees to Pandas:

  • pandas: if library="pd".
  • awkward-pandas: if library="pd" and the data have irregular structure ("jagged" arrays), see awkward-pandas.

For exporting histograms:

  • boost-histogram: if converting histograms to boost-histogram with histogram.to_boost().
  • hist: if converting histograms to hist with histogram.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).

Jim Pivarski
Jim Pivarski

πŸ’» πŸ“– πŸš‡ 🚧
Pratyush Das
Pratyush Das

πŸ’» πŸš‡
Chris Burr
Chris Burr

πŸ’» πŸš‡
Dmitri Smirnov
Dmitri Smirnov

πŸ’»
Matthew Feickert
Matthew Feickert

πŸš‡
Tamas Gal
Tamas Gal

πŸ’»
Luke Kreczko
Luke Kreczko

πŸ’» ⚠️
Nicholas Smith
Nicholas Smith

πŸ’»
Noah Biederbeck
Noah Biederbeck

πŸ’»
Oksana Shadura
Oksana Shadura

πŸ’» πŸš‡
Henry Schreiner
Henry Schreiner

πŸ’» πŸš‡ ⚠️
Mason Proffitt
Mason Proffitt

πŸ’» ⚠️
Jonas Rembser
Jonas Rembser

πŸ’»
benkrikler
benkrikler

πŸ’»
Hans Dembinski
Hans Dembinski

πŸ“–
Marcel R.
Marcel R.

πŸ’»
Ruggero Turra
Ruggero Turra

πŸ’»
Jonas RΓΌbenach
Jonas RΓΌbenach

πŸ’»
bfis
bfis

πŸ’»
Raymond Ehlers
Raymond Ehlers

πŸ’»
Andrzej Novak
Andrzej Novak

πŸ’»
Josh Bendavid
Josh Bendavid

πŸ’»
Doug Davis
Doug Davis

πŸ’»
Chao Gu
Chao Gu

πŸ’»
Lukas Koch
Lukas Koch

πŸ’»
Michele Peresano
Michele Peresano

πŸ’»
Edoardo
Edoardo

πŸ’»
JMSchoeffmann
JMSchoeffmann

πŸ’»
alexander-held
alexander-held

πŸ’»
Giordon Stark
Giordon Stark

πŸ’»
Ryunosuke O'Neil
Ryunosuke O'Neil

πŸ’»
ChristopheRappold
ChristopheRappold

πŸ“–
Cosmin Deaconu
Cosmin Deaconu

⚠️ πŸ’»
Carlos Pegueros
Carlos Pegueros

πŸ“– πŸ’‘ ⚠️ βœ…
Benjamin Tovar
Benjamin Tovar

πŸ’»
Duncan Macleod
Duncan Macleod

πŸš‡
mpad
mpad

πŸ’»
Peter Fackeldey
Peter Fackeldey

πŸ’»
Kush Kothari
Kush Kothari

πŸ’»
Aryan Roy
Aryan Roy

πŸ’»
Jerry Ling
Jerry Ling

πŸ’»
kakwok
kakwok

πŸ’»
Dmitry Kalinkin
Dmitry Kalinkin

πŸ’» πŸš‡
Nikolai Hartmann
Nikolai Hartmann

πŸ’»
Kilian Lieret
Kilian Lieret

πŸ“–
Daniel Cervenkov
Daniel Cervenkov

πŸ’»
Beojan Stanislaus
Beojan Stanislaus

πŸ’»
Angus Hollands
Angus Hollands

πŸ’» 🚧
Luis Antonio Obis Aparicio
Luis Antonio Obis Aparicio

πŸ’»
renyhp
renyhp

πŸ’»
Lindsey Gray
Lindsey Gray

πŸ’»
ioanaif
ioanaif

πŸ’»
OTABI Tomoya
OTABI Tomoya

⚠️
Jost Migenda
Jost Migenda

πŸ“–
GaΓ©tan Lepage
GaΓ©tan Lepage

⚠️
HaarigerHarald
HaarigerHarald

πŸ’»
Ben Greiner
Ben Greiner

⚠️
Robin Sonnabend
Robin Sonnabend

πŸ’»
Bo Johnson
Bo Johnson

πŸ’»
Miles
Miles

πŸ’»
djw9497
djw9497

πŸ’»
Piotr SobczyΕ„ski
Piotr SobczyΕ„ski

πŸ’»
Giedrius Juőkevičius
Giedrius Juőkevičius

πŸ’»
MatousVozak
MatousVozak

πŸ’»
Andrea Serafini
Andrea Serafini

πŸ’»

πŸ’»: code, πŸ“–: documentation, πŸš‡: infrastructure, 🚧: maintainance, ⚠: tests/feedback, πŸ€”: foundational ideas.