Python bindings to oxyroot. Makes reading .root files blazing fast 馃殌
1from typing import Iterator, List, Optional
2import numpy as np
3import polars as pl
4
5class RootFile:
6 path: str
7 def __init__(self, path: str) -> None: ...
8 def keys(self) -> List[str]: ...
9 def __getitem__(self, name: str) -> Tree: ...
10
11class Tree:
12 path: str
13 name: str
14 def branches(self) -> List[str]: ...
15 def __getitem__(self, name: str) -> Branch: ...
16 def __iter__(self) -> Iterator[Branch]: ...
17 def arrays(self, columns:Optional[List[str]] = None, ignore_columns: Optional[List[str]] = None) -> pl.DataFrame ...
18 def to_parquet(self, output_file: str, overwrite: bool = False, compression: str = "snappy", columns: Optional[List[str]] = None) -> None: ...
19
20class Branch:
21 path: str
22 tree_name: str
23 name: str
24 def array(self) -> np.ndarray: ...
25 @property
26 def typename(self) -> str: ...
27
28class BranchIterator:
29 def __iter__(self) -> "BranchIterator": ...
30 def __next__(self) -> Optional[Branch]: ...
31
32def open(
33 path: str,
34) -> RootFile:
35 """
36 Opens a ROOT file.
37
38 Args:
39 path: Path of the ROOT file.
40
41 Returns:
42 A RootFile object.
43 """
44 ...
45
46def concat_trees(
47 paths: List[str],
48 tree_name: str,
49 columns: Optional[List[str]] = None,
50 ignore_columns: Optional[List[str]] = None,
51) -> pl.DataFrame:
52 """
53 Reads multiple ROOT files, concatenates the specified tree, and returns a single Polars DataFrame.
54
55 Args:
56 paths: A list of paths to the ROOT files. Wildcards are supported.
57 tree_name: The name of the tree to read from each file.
58 columns: An optional list of column names to include. If None, all columns are included.
59 ignore_columns: An optional list of column names to exclude.
60
61 Returns:
62 A single Polars DataFrame containing the concatenated data.
63 """
64 ...
65
66def set_num_threads(num_threads: int) -> None:
67 """
68 Sets the number of threads to use for parallel operations.
69
70 Args:
71 num_threads: The number of threads to use.
72 """
73 ...