### Install Sphinx and ReadTheDocs Theme Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Install the required Python packages for building documentation locally. Ensure you are in your virtual environment. ```bash pip install sphinx sphinx-rtd-theme ``` -------------------------------- ### Writing a PyROOT histogram to a file Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Example of creating a histogram using PyROOT and saving it to a file. Requires 'ROOT' to be installed. ```python import ROOT pyroot_hist = ROOT.TH1F("h", "", 100, -3, 3) pyroot_hist.FillRandom("gaus", 100000) file["from_pyroot"] = pyroot_hist file["from_pyroot"] ``` -------------------------------- ### Install Uproot with Pip Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/index.md Install Uproot and the recommended Awkward Array library using pip. This is the standard method for Python package installation. ```bash pip install uproot awkward ``` -------------------------------- ### Install Uproot in Editable Mode Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Install uproot in editable mode using uv, including development dependencies. ```bash uv pip install -e. --group=dev ``` -------------------------------- ### Install Uproot with pip Source: https://github.com/scikit-hep/uproot5/blob/main/README.md Install the Uproot library from PyPI using pip. This is the standard method for installing Python packages. ```bash pip install uproot ``` -------------------------------- ### Handle Missing Pandas Installation Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Illustrates the error message and installation instructions when the requested library (Pandas in this case) is not installed. ```python >>> events["M"].array(library="pd") Traceback (most recent call last): File "/home/jpivarski/irishep/uproot/uproot/extras.py", line 43, in pandas import pandas ModuleNotFoundError: No module named 'pandas' ... ImportError: install the 'pandas' package with: pip install pandas or conda install pandas ``` -------------------------------- ### Example Tree Configuration Dictionary Source: https://github.com/scikit-hep/uproot5/blob/main/dev/custom-interpretation/README.md An example of a nested dictionary representing a tree configuration for data reading. ```python { "reader": "ObjectReader", "name": "TMyClass", "sub_readers": [ { "reader": "CTypeReader", "name": "m_double", "ctype": "double" }, { "reader": "STLSequenceReader", "name": "m_data", "element_reader": { "reader": "CTypeReader", "name": "element" "ctype": "int", } } ] } ``` -------------------------------- ### Install Uproot Locally for Development Source: https://github.com/scikit-hep/uproot5/blob/main/README.md Install Uproot in editable mode after cloning the repository. This allows you to make changes to the source code and test them immediately without reinstalling. ```bash pip install -e . ``` -------------------------------- ### Writing a 'hist' histogram to a file Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Example of creating a histogram using the 'hist' library and saving it to a file. Requires 'hist' and 'numpy' to be installed. ```python import hist import numpy as np h = hist.Hist.new.Reg(10, -5, 5, name="x").Weight() h.fill(np.random.normal(0, 1, 100000)) file["from_hist"] = h file["from_hist"] ``` -------------------------------- ### TTree Branch Display Example Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.behaviors.TTree.TTree.md An example of the output format when displaying TTree branches, showing columns for name, typename, and interpretation. ```text name | typename | interpretation ---------------------+----------------------+----------------------------------- event_number | int32_t | AsDtype('>i4') trigger_isomu24 | bool | AsDtype('bool') eventweight | float | AsDtype('>f4') MET | TVector2 | AsStridedObjects(Model_TVector2_v3 jetp4 | std::vector | AsJagged(AsDtype('>f4'), header_by jetid | std::vector | AsJagged(AsDtype('bool'), header_b ``` -------------------------------- ### Install 'hist' package Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md If the 'hist' package is not installed, an ImportError will be raised. Install it using pip. ```bash pip install hist ``` -------------------------------- ### Install Uproot with Conda Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/index.md Install Uproot using conda from the conda-forge channel. Awkward Array is automatically included. This method is recommended for managing complex dependencies. ```bash conda install -c conda-forge uproot ``` -------------------------------- ### Get Uproot Version Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Retrieve the installed version of uproot using the command-line interface. ```bash python -m uproot --version ``` -------------------------------- ### Open Local Documentation Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Open the locally built HTML documentation in your web browser. ```bash open _build/html/index.html ``` -------------------------------- ### Build Documentation Locally with Sphinx Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Navigate to the docs directory and use Sphinx to build the HTML documentation. The output will be in the _build/html directory. ```bash cd docs-sphinx sphinx-build -b html . _build/html ``` -------------------------------- ### Set Up Development Environment with Conda Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Create and activate a conda environment, install necessary dependencies like xrootd, root, pandas, and dask, and pip-install additional Python packages. ```bash conda create -n uproot-py313 python=3.13 conda activate uproot-py313 # Add conda-forge channel and prioritize it conda config --add channels conda-forge conda config --set channel_priority strict # Install dependencies conda install xrootd conda install root conda install pandas conda install dask # pip-only dependencies pip install scikit-hep-testdata pip install rangehttpserver pip install boost_histogram pip install hist pip install dask_awkward pip install awkward-pandas pip install pytest-timeout pip install fsspec-xrootd pip install uv # Run local HTTP server (if needed for test data) python -m RangeHTTPServer ``` -------------------------------- ### Get a chunk of data from the source Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.reading.ReadOnlyFile.md Returns a Chunk object that includes bytes from the specified start to stop seek points in the file. May return a previously saved chunk if it satisfies the range. ```python ReadOnlyFile.chunk(start, stop) ``` -------------------------------- ### Open Local, HTTP, and XRootD Files Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot3-to-4.md Demonstrates how to open files using uproot.open with different URL schemes. This function recognizes local files, HTTP, and XRootD by the URL prefix. ```python >>> import uproot >>> local_file = uproot.open("local/file.root") >>> http_file = uproot.open("https://server.net/file.root") >>> xrootd_file = uproot.open("root://server.net/file.root") ``` -------------------------------- ### Open a new ROOT file for writing Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Use `uproot.recreate` to create a new ROOT file. This will overwrite any existing file with the same name. ```python >>> file = uproot.recreate("path/to/new-file.root") ``` -------------------------------- ### is_64bit Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.reading.CommonFileMethods.md Boolean indicating if the ROOT file is 64-bit ready. ```APIDOC ## is_64bit #### CommonFileMethods.is_64bit True if the ROOT file is 64-bit ready; False otherwise. A file that is larger than 4 GiB must be 64-bit ready, though any file might be. This refers to seek points like [fSeekFree](uproot.reading.ReadOnlyFile.md#uproot-reading-readonlyfile-fseekfree) being 64-bit integers, rather than 32-bit. Note that a file being 64-bit is distinct from a `TDirectory` being 64-bit; see [is_64bit](uproot.reading.ReadOnlyDirectory.md#uproot-reading-readonlydirectory-is-64bit). ``` -------------------------------- ### Get class names of file contents Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Use `classnames()` to get the names of classes for objects in the file without reading them. ```python >>> file.classnames() {'one': 'TDirectory', 'one/two': 'TDirectory', 'one/two/tree': 'TTree', 'one/tree': 'TTree', 'three': 'TDirectory', 'three/tree': 'TTree'} ``` -------------------------------- ### XRootDResource Constructor Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.source.xrootd.XRootDResource.md Initializes an XRootDResource with a file path (URL) and an optional timeout. ```APIDOC ## XRootDResource(file_path: str, timeout: float | None) ### Description Initializes an XRootDResource for XRootD connections. ### Parameters * **file_path** (str) - Required - A URL of the file to open. * **timeout** (float | None) - Optional - An optional timeout in seconds. ``` -------------------------------- ### Update Conda Packages Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/index.md Update all installed conda packages to their latest compatible versions. This is a good practice after adding new channels or installing new packages. ```bash conda update --all ``` -------------------------------- ### Creating a subdirectory with mkdir Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.writing.writable.WritableDirectory.md Use `mkdir` to create an empty subdirectory. You can optionally specify the initial number of bytes to allocate for the new directory. ```python my_directory.mkdir("new_subdir") ``` -------------------------------- ### file_path Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.source.cufile_interface.CuFileSource.md Gets the path to the file. ```APIDOC ## file_path #### CuFileSource.file_path A path to the file (or URL). ``` -------------------------------- ### instance_version Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranchElement_v9.md The version of the instance. ```APIDOC ## instance_version Inherited from [uproot.Model](uproot.model.Model.md). #### Model_TBranchElement_v9.instance_version ``` -------------------------------- ### Model_TH3I_v4.kind Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3I_v4.md Gets the kind of the histogram. ```APIDOC ## Model_TH3I_v4.kind ### Description Gets the kind of the histogram. ### Method Model_TH3I_v4.kind ### Response #### Success Response (200) - **any** - The kind of the histogram. ``` -------------------------------- ### Use context manager for writing ROOT files Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Employ a `with` statement when opening files for writing to ensure they are automatically closed after the block is exited. ```python >>> with uproot.recreate("/path/to/new-file.root") as file: ... do_something... ``` -------------------------------- ### Run All Pre-commit Checks Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Execute all pre-commit hooks to ensure code style, linting, and formatting are consistent. ```bash pre-commit run --all ``` -------------------------------- ### Model_TH3I_v4.title Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3I_v4.md Gets the title of the histogram. ```APIDOC ## Model_TH3I_v4.title ### Description Gets the title of the histogram. ### Method Model_TH3I_v4.title ### Response #### Success Response (200) - **string** - The title of the histogram. ``` -------------------------------- ### Model_TH3I_v4.name Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3I_v4.md Gets the name of the histogram. ```APIDOC ## Model_TH3I_v4.name ### Description Gets the name of the histogram. ### Method Model_TH3I_v4.name ### Response #### Success Response (200) - **string** - The name of the histogram. ``` -------------------------------- ### Specify File Handlers and Options in Uproot 4+ Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot3-to-4.md Shows how to specify file handlers and free-standing options when opening files in Uproot 4 and later. This differs from Uproot 3's approach of passing a handler and options as a class instance. ```python >>> file = uproot.open("file.root", ... file_handler=uproot.MultithreadedFileSource, ... num_workers=10) >>> file = uproot.open("https://server.net/file.root", ... http_handler=uproot.MultithreadedHTTPSource, ... timeout=3.0) >>> file = uproot.open("root://server.net/file.root", ... xrootd_handler=uproot.MultithreadedXRootDSource, ... num_workers=5) ``` -------------------------------- ### Model_TBranch_v12.interpretation Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranch_v12.md Gets the interpretation of the TBranch. ```APIDOC ## Model_TBranch_v12.interpretation ### Description Gets the interpretation of the `TBranch` data as an array. ### Method `interpretation` ### Parameters None ### Response #### Success Response (200) Returns the interpretation of the TBranch. ``` -------------------------------- ### Navigating directory structure with keys and paths in Uproot 4 Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot3-to-4.md Illustrates how to list keys in a ReadOnlyDirectory and access nested objects using string paths, similar to Uproot 3 but with Python 3 strings. ```python >>> directory = uproot.open("https://scikit-hep.org/uproot3/examples/nesteddirs.root") >>> directory >>> directory.keys() ['one;1', 'one/two;1', 'one/two/tree;1', 'one/tree;1', 'three;1', 'three/tree;1'] >>> directory["one"] >>> directory["one"]["two"] >>> directory["one"]["two"]["tree"] >>> directory["one/two/tree"] >>> directory["three/tree/evt"] >>> directory["three/tree/evt/I32"] ``` -------------------------------- ### Open ROOT File and List Class Names Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Opens a ROOT file and lists the available object class names within it. This is useful for understanding the structure of the file. ```python >>> file = uproot.open("https://scikit-hep.org/uproot3/examples/hepdata-example.root") >>> file.classnames() {'hpx': 'TH1F', 'hpxpy': 'TH2F', 'hprof': 'TProfile', 'ntuple': 'TNtuple'} ``` -------------------------------- ### Model_TBranch_v12.title Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranch_v12.md Gets the title of the TBranch. ```APIDOC ## Model_TBranch_v12.title ### Description Gets the title of the `TBranch`. ### Method `title` ### Parameters None ### Response #### Success Response (200) Returns the title of the TBranch as a string. ``` -------------------------------- ### Model_TBranch_v12.name Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranch_v12.md Gets the name of the TBranch. ```APIDOC ## Model_TBranch_v12.name ### Description Gets the name of the `TBranch`. Note that `TBranch` names are not guaranteed to be unique; it is sometimes necessary to address a branch by its index. ### Method `name` ### Parameters None ### Response #### Success Response (200) Returns the name of the TBranch as a string. ``` -------------------------------- ### ZLIB Class Initialization Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.compression.ZLIB.md Initializes the ZLIB compression class with a specified compression level. ```APIDOC ## class uproot.compression.ZLIB(level) ### Description Represents the ZLIB compression algorithm. If `ZLIB.library` is `"zlib"` (default), Uproot uses `zlib` from the Python standard library. If `ZLIB.library` is `"isal"`, Uproot uses `isal.isal_zlib`. If `ZLIB.library` is `"deflate"`, Uproot uses `deflate.deflate_zlib`. ### Parameters * **level** (*int*, 0-9) – Compression level: 0 is uncompressed, 1 is minimally compressed, and 9 is maximally compressed. ``` -------------------------------- ### Compression.level Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.compression.Compression.md Gets the compression level. ```APIDOC ## Compression.level ### Description 0 is uncompressed, 1 is minimally compressed, and higher levels increase compression. (See specific algorithms for maximum values.) ### Method property ### Response #### Success Response (200) - **level** (int) - The compression level. ``` -------------------------------- ### Using Context Manager for File Operations Source: https://github.com/scikit-hep/uproot5/wiki/Guide-to-the-codebase Demonstrates how to use the 'uproot.open' function as a context manager to ensure files are properly closed after use. This applies to objects that can read more data from the file. ```python with uproot.open("some_file.root") as file: # do something ``` ```python with uproot.open("some_file.root")["deeply/nested/object"] as obj: # do something ``` -------------------------------- ### Model_TBranch_v12.cache_key Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranch_v12.md Gets the cache key for the TBranch. ```APIDOC ## Model_TBranch_v12.cache_key ### Description Gets a string that uniquely specifies this `TBranch` in its path, to use as part of object and array cache keys. ### Method `cache_key` ### Parameters None ### Response #### Success Response (200) Returns the cache key as a string. ``` -------------------------------- ### Creating Subdirectories and Objects via Path Assignment Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.writing.writable.WritableDirectory.md Demonstrates creating nested subdirectories and objects by assigning values to path names containing slashes. ```python my_directory["subdir1/subdir2/new_object"] = new_object ``` -------------------------------- ### Model_TBranch_v12.object_path Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranch_v12.md Gets the object path of the TBranch. ```APIDOC ## Model_TBranch_v12.object_path ### Description Gets the object path of the `TBranch`. ### Method `object_path` ### Parameters None ### Response #### Success Response (200) Returns the object path of the TBranch as a string. ``` -------------------------------- ### LZ4.level Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.compression.LZ4.md Gets the compression level for LZ4. ```APIDOC ## level ### LZ4.level 0 is uncompressed, 1 is minimally compressed, and 12 is maximally compressed. The compression level. This is inherited from the base Compression class. ``` -------------------------------- ### Create a WritableTree using mktree Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.writing.writable.WritableTree.md Demonstrates creating a WritableTree with different data types like NumPy arrays, Awkward Arrays, and Pandas DataFrames. Use this to initialize a new tree within a WritableDirectory. ```python my_directory.mktree("tree1", {"branch1": np.array(...), "branch2": ak.Array(...)}) my_directory.mktree("tree2", numpy_structured_array) my_directory.mktree("tree3", awkward_record_array) my_directory.mktree("tree4", pandas_dataframe) ``` -------------------------------- ### UnknownClassVersion.empty Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.model.UnknownClassVersion.md Creates a new instance of a subclass of `UnknownClassVersion` with no data. All required attributes are initialized to `None` or empty collections. ```APIDOC ## UnknownClassVersion.empty ### Description Creates a new instance of a subclass of `UnknownClassVersion` with no data. All required attributes are initialized to `None` or empty collections. ### Method classmethod ``` -------------------------------- ### MemmapSource.num_bytes Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.source.file.MemmapSource.md Gets the total number of bytes in the file. ```APIDOC ## num_bytes ### Description Returns the total number of bytes in the file. ### Attribute * **num_bytes** (*int*) – The size of the file in bytes. ``` -------------------------------- ### requested_chunk_sizes Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.source.cufile_interface.CuFileSource.md Gets the sizes of all requested chunks in bytes. ```APIDOC ## requested_chunk_sizes #### CuFileSource.requested_chunk_sizes The size of requests that have been made in number of bytes (performance counter). ``` -------------------------------- ### Open a ROOT file and access events Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Opens a ROOT file and accesses the 'events' TTree. This is a prerequisite for most subsequent operations. ```python >>> events = uproot.open("https://scikit-hep.org/uproot3/examples/Zmumu.root:events") ``` -------------------------------- ### num_requested_chunks Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.source.cufile_interface.CuFileSource.md Gets the number of read requests made. ```APIDOC ## num_requested_chunks #### CuFileSource.num_requested_chunks The number of requests that have been made (performance counter). ``` -------------------------------- ### read Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TAtt.Model_TAtt3D_v1.md Instantiates a model by reading data from a file chunk. It takes a cursor, context, file object, and other parameters to manage the deserialization process. ```APIDOC ## read Inherited from [uproot.Model](uproot.model.Model.md). *classmethod* Model_TAtt3D_v1.read(chunk, cursor, context, file, selffile, parent, concrete=None) ### Description Creates a model instance by reading data from a file. ### Parameters * **cls** (subclass of [uproot.Model](uproot.model.Model.md)) – Class to instantiate. * **chunk** ([uproot.source.chunk.Chunk](uproot.source.chunk.Chunk.md)) – Buffer of contiguous data from the file [uproot.source.chunk.Source](uproot.source.chunk.Source.md). * **cursor** ([uproot.Cursor](uproot.source.cursor.Cursor.md)) – Current position in that `chunk`. * **context** (*dict*) – Auxiliary data used in deserialization. * **file** ([uproot.ReadOnlyFile](uproot.reading.ReadOnlyFile.md)) – An open file object, capable of generating new [uproot.Model](uproot.model.Model.md) classes from its [streamers](uproot.reading.ReadOnlyFile.md#uproot-reading-readonlyfile-streamers). * **selffile** ([uproot.reading.CommonFileMethods](uproot.reading.CommonFileMethods.md)) – A possibly [uproot.reading.DetachedFile](uproot.reading.DetachedFile.md) associated with this object. * **parent** (*None* *or* *calling object*) – The previous `read` in the recursive descent. * **concrete** (None or [uproot.Model](uproot.model.Model.md) instance) – If None, this model corresponds to the concrete (instantiated) class in C++. Otherwise, this model represents a superclass part of the object, and `concrete` points to the concrete instance. ``` -------------------------------- ### Model_TH3F_v4.kind Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3F_v4.md Gets the kind of the TH3F v4 histogram. ```APIDOC ## kind Inherited from [uproot.behaviors.TH1.Histogram](uproot.behaviors.TH1.Histogram.md). #### Model_TH3F_v4.kind ``` -------------------------------- ### Create or Update ROOT File with Uproot Source: https://github.com/scikit-hep/uproot5/wiki/Guide-to-the-codebase Use this pattern to create a new ROOT file or update an existing one. The `with` statement ensures the file is properly managed. Objects can be assigned to paths within the file. ```python with uproot.recreate("some_file.root") as file: file["name/of/object"] = python_object ``` -------------------------------- ### Create an empty directory Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Use the `.mkdir()` method to create an empty directory within the ROOT file structure. ```python >>> file.mkdir("emptydir") ``` -------------------------------- ### Model_TH3F_v4.title Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3F_v4.md Gets the title of the TH3F v4 histogram. ```APIDOC ## title Inherited from [uproot.behaviors.TH1.Histogram](uproot.behaviors.TH1.Histogram.md). #### Model_TH3F_v4.title The title of the histogram. ``` -------------------------------- ### Model_TH3F_v4.name Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3F_v4.md Gets the name of the TH3F v4 histogram. ```APIDOC ## name Inherited from [uproot.behaviors.TH1.Histogram](uproot.behaviors.TH1.Histogram.md). #### Model_TH3F_v4.name The name of the histogram. ``` -------------------------------- ### Open a ROOT file and access an object Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.reading.open.md Use 'with' statement to ensure the file is closed properly after use. This example opens a specific histogram from a ROOT file. ```python with uproot.open("/path/to/file.root:path/to/histogram") as h: h.to_hist().plot() ``` -------------------------------- ### Clone Uproot Repository Source: https://github.com/scikit-hep/uproot5/blob/main/CONTRIBUTING.md Clone your forked repository locally and navigate into the project directory. ```bash git clone git@github.com:YOUR_USERNAME/uproot5.git cd uproot ``` -------------------------------- ### Model_TH3D_v4.kind Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3D_v4.md Gets the kind of the TH3D v4 histogram. ```APIDOC ## Model_TH3D_v4.kind ### Description Gets the kind of the TH3D v4 histogram. ### Property `kind` ``` -------------------------------- ### Basic WritableDirectory Operations Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.writing.writable.WritableDirectory.md Demonstrates reading, writing, and deleting objects from a WritableDirectory using Python's MutableMapping interface. ```python my_directory["histogram"] my_directory["histogram"] = np.histogram(...) del my_directory["histogram"] ``` -------------------------------- ### Model_TH3D_v4.title Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3D_v4.md Gets the title of the TH3D v4 histogram. ```APIDOC ## Model_TH3D_v4.title ### Description The title of the histogram. ### Property `title` ``` -------------------------------- ### Model_TH3D_v4.name Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH3D_v4.md Gets the name of the TH3D v4 histogram. ```APIDOC ## Model_TH3D_v4.name ### Description The name of the histogram. ### Property `name` ``` -------------------------------- ### Model_TH2_v5.parent Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TH.Model_TH2_v5.md Gets the parent object that was deserialized before this one. ```APIDOC ## Model_TH2_v5.parent ### Description Returns the object that was deserialized before this one in recursive descent, typically the containing object or its container. ### Method `parent` ### Inheritance Inherited from [uproot.Model](uproot.model.Model.md). ``` -------------------------------- ### LZ4 Class Constructor Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.compression.LZ4.md Initializes the LZ4 compression algorithm with a specified compression level. ```APIDOC ## LZ4(level) ### Description Represents the LZ4 compression algorithm. The `cramjam` and `xxhash` libraries must be installed. ### Parameters * **level** (*int*, 0-9) – Compression level: 0 is uncompressed, 1 is minimally compressed, and 9 is maximally compressed. ``` -------------------------------- ### Open a ROOT file for reading Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/basic.md Use `uproot.open` to open a ROOT file. The file is automatically closed when exiting the `with` block. ```python >>> import uproot >>> file = uproot.open("path/to/dataset.root") ``` ```python >>> with uproot.open("path/to/dataset.root") as file: ... do_something... ``` -------------------------------- ### class_version Source: https://github.com/scikit-hep/uproot5/blob/main/docs-sphinx/uproot.models.TBranch.Model_TBranchElement_v9.md Gets the version number of the modeled class. ```APIDOC ## class_version ### Description The version number of the modeled class (int) if any; None otherwise. See [uproot.classname_decode](uproot.model.classname_decode.md), [uproot.classname_encode](uproot.model.classname_encode.md), and [uproot.model.classname_version](uproot.model.classname_version.md). ### Method `class_version` ```