Skip to main content

Tools to inspect ROOT files with uproot

Project description

uproot-browser

uproot-browser

Actions Status PyPI version PyPI platforms GitHub Discussion Gitter Scikit-HEP Conda-Forge

uproot-browser is a plotext based command line library in which the command line interface is provided by Click. It is powered by Hist and it's TUI is put together by Textual. Its aim is to enable a user to browse and look inside a ROOT file, completely via the terminal. It takes its inspiration from the ROOT object browser.

Installation

You can install this library from PyPI with pip:

python3 -m pip install uproot-browser

You can also use pipx to run the library without installing it:

pipx run uproot-browser

Features

uproot-browser currently provides the following features (get help with -h or --help):

  • browse can be used to display a TUI (terminal user interface).
  • plot can be used to display a plot.
  • tree can be used to display a tree.

Examples

This example uses data from the scikit-hep-testdata package. It is placed in the same directory as the uproot-browser repository.

browse command:

uproot-browser browse ../scikit-hep-testdata/src/skhep_testdata/data/uproot-Event.root

GIF of the TUI functionality

plot command:

uproot-browser plot ../scikit-hep-testdata/src/skhep_testdata/data/uproot-Event.root:hstat
                        hstat -- Entries: 1000
    ┌───────────────────────────────────────────────────────────────┐
18.0┤▐▌                                                                 │▐▌                                                 ▗▖         ▄│
15.6┤▐▌▗▖                                               ▐▌         █│
    │███▌                                             ▐▌        ▐█│
13.1┤████▟▌    ▗▖  ▗▖   █▌▗▖ ▐▌          █▌     ▟▌█ ▗▄▐▙▗▖    ▐▌▐█│
10.6┤█████▌    ▐▌  ▐▙▖  █▌▐▌ ▐▙       █▄  █▙     █▌█ ▐█▟█▐▌  ▗▄▟▌▐█│
    │█████▌ █▌▐█▌  ████▌█▌▐█ ▐█▐▌ ▐▌  ███▐██  ▐█ ▐████▐███▐▌ ▐███▌▐█│
 8.2┤█████▌▐█▌▐█▌ █████▌██▐█ ██▐█ ▐▌▐████▐███▌▐█ █████▐███▐██▐████▐█│
    │████████▙██▌█████████▟█▖████▖▟██████▟██████▖████████████▟██████│
 5.8┤███████████▙███████████▙████▌██████████████▌███████████████████│
    │████████████████████████████▌██████████████████████████████████│
 3.3┤███████████████████████████████████████████████████████████████│
    └┬───────────────┬──────────────┬───────────────┬──────────────┬┘
     0.00          0.25           0.50            0.75          1.00
                               [x] xaxis
If you're on macOS and using iTerm2, click here:

You can get an iterm plot, the required dependencies can be installed via:

python3 -m pip install uproot-browser[iterm]

Or can be run via pipx without installing:

pipx run uproot-browser[iterm]

Adding the argument --iterm gives us the plot:

uproot-browser plot ../scikit-hep-testdata/src/skhep_testdata/data/uproot-Event.root:hstat --iterm
iterm example

tree command:

uproot-browser tree ../scikit-hep-testdata/src/skhep_testdata/data/uproot-Event.root
📁 uproot-Event.root
┣━━  <unnamed> TProcessID
┣━━ 🌴 T (1000)   ┣━━ 🍁 event Event
┃   ┣━━ 🍁 TObject (group of fUniqueID:uint32_t, fBits:uint8_t)   ┣━━ 🍁 fBits uint8_t
┃   ┣━━ 🍁 fUniqueID uint32_t
┃   ┣━━ 🍁 fClosestDistance unknown[]   ┣━━ 🍁 fEventName char*
┃   ┣━━ 🍁 fEvtHdr EventHeader
┃   ┣━━ 🍁 fEvtHdr.fDate int32_t
┃   ┣━━ 🍁 fEvtHdr.fEvtNum int32_t
┃   ┣━━ 🍁 fEvtHdr.fRun int32_t
┃   ┣━━ 🍁 fFlag uint32_t
┃   ┣━━ 🍁 fH TH1F
┃   ┣━━ 🍁 fHighPt TRefArray*
┃   ┣━━ 🍁 fIsValid bool
┃   ┣━━ 🍁 fLastTrack TRef
┃   ┣━━ 🍁 fMatrix[4][4] float[4][4]   ┣━━ 🍁 fMeasures[10] int32_t[10]   ┣━━ 🍁 fMuons TRefArray*
┃   ┣━━ 🍁 fNseg int32_t
┃   ┣━━ 🍁 fNtrack int32_t
┃   ┣━━ 🍁 fNvertex uint32_t
┃   ┣━━ 🍁 fTemperature float
┃   ┣━━ 🍁 fTracks TClonesArray*
┃   ┣━━ 🍃 fTracks.fBits uint8_t[]   ┣━━ 🍃 fTracks.fBx Float16_t[]   ┣━━ 🍃 fTracks.fBy Float16_t[]   ┣━━ 🍃 fTracks.fCharge Double32_t[]   ┣━━ 🍃 fTracks.fMass2 Float16_t[]   ┣━━ 🍃 fTracks.fMeanCharge float[]   ┣━━ 🍃 fTracks.fNpoint int32_t[]   ┣━━ 🍃 fTracks.fNsp uint32_t[]   ┣━━ 🍁 fTracks.fPointValue unknown[][]   ┣━━ 🍃 fTracks.fPx float[]   ┣━━ 🍃 fTracks.fPy float[]   ┣━━ 🍃 fTracks.fPz float[]   ┣━━ 🍃 fTracks.fRandom float[]   ┣━━ 🍃 fTracks.fTArray[3] float[][3]   ┣━━ 🍁 fTracks.fTriggerBits.fAllBits uint8_t[][]   ┣━━ 🍃 fTracks.fTriggerBits.fBits uint8_t[]   ┣━━ 🍃 fTracks.fTriggerBits.fNbits uint32_t[]   ┣━━ 🍃 fTracks.fTriggerBits.fNbytes uint32_t[]   ┣━━ 🍃 fTracks.fTriggerBits.fUniqueID uint32_t[]   ┣━━ 🍃 fTracks.fUniqueID uint32_t[]   ┣━━ 🍃 fTracks.fValid int16_t[]   ┣━━ 🍃 fTracks.fVertex[3] Double32_t[][3]   ┣━━ 🍃 fTracks.fXfirst Float16_t[]   ┣━━ 🍃 fTracks.fXlast Float16_t[]   ┣━━ 🍃 fTracks.fYfirst Float16_t[]   ┣━━ 🍃 fTracks.fYlast Float16_t[]   ┣━━ 🍃 fTracks.fZfirst Float16_t[]   ┣━━ 🍃 fTracks.fZlast Float16_t[]   ┣━━ 🍁 fTriggerBits TBits
┃   ┣━━ 🍁 fTriggerBits.TObject (group of fTriggerBits.fUniqueID:uint32_t, fTriggerBits.fBits:uint8_t)   ┣━━ 🍁 fTriggerBits.fBits uint8_t
┃   ┣━━ 🍁 fTriggerBits.fUniqueID uint32_t
┃   ┣━━ 🍃 fTriggerBits.fAllBits uint8_t[]   ┣━━ 🍁 fTriggerBits.fNbits uint32_t
┃   ┣━━ 🍁 fTriggerBits.fNbytes uint32_t
┃   ┣━━ 🍁 fType[20] int8_t[20]   ┗━━ 🍁 fWebHistogram TRef
┣━━ 📊 hstat TH1F (100)
┗━━ 📊 htime TH1F (10)

Development

pre-commit.ci status Code style: black

See CONTRIBUTING.md for details on how to set up a development environment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uproot_browser-0.4.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

uproot_browser-0.4.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file uproot_browser-0.4.0.tar.gz.

File metadata

  • Download URL: uproot_browser-0.4.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for uproot_browser-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c1fdeeec79c74751a1520a333f2e0df83eec0715cc371ac70ddc9910e96f3441
MD5 9467f8398b71f0f80cbe935c48ed1cdf
BLAKE2b-256 bf0060e3be305f8066fbe0aa976fca9ec8b9185464a4d850b286b7e0ea0dc9ec

See more details on using hashes here.

File details

Details for the file uproot_browser-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: uproot_browser-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for uproot_browser-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e48459957fa6c5dfc2f3afcf43cf02e8ff3aa38a13a2545cd2c1c7f9755efcb
MD5 623f4942762fe536554071a593b6ddda
BLAKE2b-256 75b7b50df8d2d47996d6bd740d6b2febdc71a084dac5b81df8663c7014e66192

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page