Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
arrays = wait()
for i in range(len(compiledintermediates)):
arrays.append(numpy.empty(numentries, dtype=self.NEW_ARRAY_DTYPE))
if len(entryvars) > 0:
arrays.append(numpy.arange(start, stop))
return start, stop, numentries, tuple(arrays)
def wrap_for_python_scope(start, stop, wait):
return lambda: calculate(start, stop, wait)
return [wrap_for_python_scope(start, stop, wait) for start, stop, wait in waits]
class TTreeFunctionalMethods(uproot.tree.TTreeMethods):
# makes __doc__ attribute mutable before Python 3.3
__metaclass__ = type.__new__(type, "type", (uproot.tree.TTreeMethods.__metaclass__,), {})
def define(self, **exprs):
return ChainOrigin(self).define(**exprs)
def intermediate(self, cache=None, **exprs):
return ChainOrigin(self).intermediate(cache=cache, **exprs)
def filter(self, expr):
return ChainOrigin(self).filter(expr)
def iterate_newarrays(self, exprs, entrysteps=None, entrystart=None, entrystop=None, aliases={}, interpretations={}, entryvar=None, outputtype=dict, reportentries=False, cache=None, basketcache=None, keycache=None, readexecutor=None, calcexecutor=None, numba=ifinstalled):
return ChainOrigin(self).iterate_newarrays(exprs, entrysteps=entrysteps, entrystart=entrystart, entrystop=entrystop, aliases=aliases, interpretations=interpretations, entryvar=entryvar, outputtype=outputtype, reportentries=reportentries, cache=cache, basketcache=basketcache, keycache=keycache, readexecutor=readexecutor, calcexecutor=calcexecutor, numba=numba)
def newarrays(self, exprs, entrystart=None, entrystop=None, aliases={}, interpretations={}, entryvar=None, outputtype=dict, cache=None, basketcache=None, keycache=None, readexecutor=None, calcexecutor=None, numba=ifinstalled):
{xrootdsource}
{httpsource}
{options}
Returns
-------
iterator over (str, :py:class:`ROOTDirectory `, pandas.Dataframe) (if *reportpath* and *reportfile*) or just pandas.DataFrame (otherwise)
aligned array segments from the files.
""".format(**dict(list(open_fragments.items()) + list(tree_fragments.items())))
################################################################ uproot.tree.TTreeMethods
uproot.tree.TTreeMethods.__doc__ = \
u"""Adds array reading methods to TTree objects that have been streamed from a ROOT file.
- square brackets (``__getitem__``) returns a branch by name (see :py:meth:`get `).
- the ``len`` function (``__len__``) returns the number of entries (same as ``numentries``).
- iteration (``__iter__``) has no implementation. This is to avoid confusion between iterating over all branches (probably not what you want, but fitting the pattern set by :py:class:`ROOTDirectory ` and ``dict``) and iterating over the data.
**Attributes, properties, and methods:**
- **name** (*bytes*) name of the TTree.
- **title** (*bytes*) title of the TTree.
- **numentries** (*int*) number of entries in the TTree (same as ``len``).
- **pandas** connector to `Pandas `_ functions
- :py:meth:`get ` return a branch by name (at any level of depth).
- :py:meth:`iterkeys ` iterate over branch names.
- :py:meth:`itervalues ` iterate over branches.
_method(uproot.tree.TTreeMethods.allvalues).__doc__ = \
u"""Return branches at all levels of depth (shortcut for passing ``recursive=True`` to :py:meth:`values `).
Parameters
----------
{filtername}
{filtertitle}
Returns
-------
list of :py:class:`TBranch `
branches.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.allitems).__doc__ = \
u"""Return *(branch name, branch)* pairs at all levels of depth (shortcut for passing ``recursive=True`` to :py:meth:`items `).
Parameters
----------
{filtername}
{filtertitle}
Returns
-------
list of (bytes, :py:class:`TBranch `
name-branch pairs.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.clusters).__doc__ = \
u"""Return entry starts and stops as *(int, int)* pairs representing clusters for a given set of branches this TTree.
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
iterator over :py:class:`TBranch `
branches.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.iteritems).__doc__ = \
u"""Iterate over *(branch name, branch)* pairs.
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
iterator over (bytes, :py:class:`TBranch `)
name-branch pairs.
""".format(**tree_fragments)
for i in range(len(compiledintermediates)):
arrays.append(numpy.empty(numentries, dtype=self.NEW_ARRAY_DTYPE))
if len(entryvars) > 0:
arrays.append(numpy.arange(start, stop))
return start, stop, numentries, tuple(arrays)
def wrap_for_python_scope(start, stop, wait):
return lambda: calculate(start, stop, wait)
return [wrap_for_python_scope(start, stop, wait) for start, stop, wait in waits]
class TTreeFunctionalMethods(uproot.tree.TTreeMethods):
# makes __doc__ attribute mutable before Python 3.3
__metaclass__ = type.__new__(type, "type", (uproot.tree.TTreeMethods.__metaclass__,), {})
def define(self, **exprs):
return ChainOrigin(self).define(**exprs)
def intermediate(self, cache=None, **exprs):
return ChainOrigin(self).intermediate(cache=cache, **exprs)
def filter(self, expr):
return ChainOrigin(self).filter(expr)
def iterate_newarrays(self, exprs, entrysteps=None, entrystart=None, entrystop=None, aliases={}, interpretations={}, entryvar=None, outputtype=dict, reportentries=False, cache=None, basketcache=None, keycache=None, readexecutor=None, calcexecutor=None, numba=ifinstalled):
return ChainOrigin(self).iterate_newarrays(exprs, entrysteps=entrysteps, entrystart=entrystart, entrystop=entrystop, aliases=aliases, interpretations=interpretations, entryvar=entryvar, outputtype=outputtype, reportentries=reportentries, cache=cache, basketcache=basketcache, keycache=keycache, readexecutor=readexecutor, calcexecutor=calcexecutor, numba=numba)
def newarrays(self, exprs, entrystart=None, entrystop=None, aliases={}, interpretations={}, entryvar=None, outputtype=dict, cache=None, basketcache=None, keycache=None, readexecutor=None, calcexecutor=None, numba=ifinstalled):
return ChainOrigin(self).newarrays(exprs, entrystart=entrystart, entrystop=entrystop, aliases=aliases, interpretations=interpretations, entryvar=entryvar, outputtype=outputtype, cache=cache, basketcache=basketcache, keycache=keycache, readexecutor=readexecutor, calcexecutor=calcexecutor, numba=numba)
{keycache}
{executor}
{persistvirtual}
{chunked}
Returns
-------
ChunkedArray of Table of VirtualArrays or Table of VirtualArrays
lazy branch data.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.iterate).__doc__ = \
u"""Iterate over many arrays at once, yielding the same number of entries from all selected branches in each step.
Depending on the "entrysteps" parameter, the number of entries in one step may differ from the number of entries in the next step, but in every step, the same number of entries is retrieved from all *baskets.*
Parameters
----------
{branches}
{entrysteps_tree}
{outputtype}
{namedecode}
{reportentries}
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
iterator over bytes
names of branches.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.itervalues).__doc__ = \
u"""Iterate over branches.
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
iterator over :py:class:`TBranch `
branches.
""".format(**tree_fragments)
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
list of :py:class:`TBranch `
branches.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.items).__doc__ = \
u"""Return *(branch name, branch)* pairs.
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
list of (bytes, :py:class:`TBranch `)
name-branch pairs.
""".format(**tree_fragments)
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
iterator over (bytes, :py:class:`TBranch `)
name-branch pairs.
""".format(**tree_fragments)
_method(uproot.tree.TTreeMethods.keys).__doc__ = \
u"""Return branch names.
Parameters
----------
{recursive}
{filtername}
{filtertitle}
Returns
-------
list of bytes
names of branches.
""".format(**tree_fragments)
- :py:meth:`allkeys ` return branch names at all levels of depth (shortcut for passing ``recursive=True`` to :py:meth:`keys `).
- :py:meth:`allvalues ` return branches at all levels of depth (shortcut for passing ``recursive=True`` to :py:meth:`values `).
- :py:meth:`allitems ` return *(branch name, branch)* pairs at all levels of depth (shortcut for passing ``recursive=True`` to :py:meth:`items `).
- :py:meth:`clusters ` iterate over *(int, int)* pairs representing cluster entry starts and stops in this TTree.
- :py:meth:`mempartitions ` iterate over *(int, int)* pairs representing entry starts and stops that attempt to maintain a constant memory footprint.
**Methods for reading array data:**
- :py:meth:`array ` read one branch into an array (or other object if provided an alternate *interpretation*).
- :py:meth:`arrays ` read many branches into arrays (or other objects if provided alternate *interpretations*).
- :py:meth:`lazyarray ` create a lazy array that would read the branch as needed.
- :py:meth:`lazyarrays ` create many lazy arrays.
- :py:meth:`iterate ` iterate over many arrays at once, yielding the same number of entries from all selected branches in each step.
"""
_method(uproot.tree.TTreeMethods.get).__doc__ = \
u"""Return a branch by name (at any level of depth).
Parameters
----------
name : str
name of the branch to return.
Returns
-------
:py:class:`TBranch `
selected branch.
Notes
-----
This method can be accessed more directly through square brackets (``__getitem__``) on the :py:class:`TTree ` object.