uproot.models.TTree.Model_TTree_v17
Defined in uproot.models.TTree on line 193.
Inheritance order: |
---|
|
- class uproot.models.TTree.Model_TTree_v17
A uproot.model.VersionedModel for
TTree
version 17.
member_names
- Model_TTree_v17.member_names
name
Inherited from uproot.TTree.
- Model_TTree_v17.name
Name of the
TTree
.
title
Inherited from uproot.TTree.
- Model_TTree_v17.title
Title of the
TTree
.
object_path
Inherited from uproot.TTree.
- Model_TTree_v17.object_path
Object path of the
TTree
.
cache_key
Inherited from uproot.TTree.
- Model_TTree_v17.cache_key
String that uniquely specifies this
TTree
in its path, to use as part of object and array cache keys.
num_entries
Inherited from uproot.TTree.
- Model_TTree_v17.num_entries
The number of entries in the
TTree
, as reported byfEntries
.In principle, this could disagree with the num_entries, which is from the
TBranch
’sfEntries
. See that method’s documentation for yet more ways the number of entries could, in principle, be inconsistent.
tree
Inherited from uproot.TTree.
- Model_TTree_v17.tree
Returns
self
because this is aTTree
.
compressed_bytes
Inherited from uproot.TTree.
- Model_TTree_v17.compressed_bytes
The number of compressed bytes in all
TBaskets
of allTBranches
of thisTTree
, including all the TKey headers (which are always uncompressed).This information is specified in the
TTree
metadata (fZipBytes
) and can be determined without reading any additional data.
uncompressed_bytes
Inherited from uproot.TTree.
- Model_TTree_v17.uncompressed_bytes
The number of uncompressed bytes in all
TBaskets
of allTBranches
of thisTTree
, including all the TKey headers.This information is specified in the
TTree
metadata (fTotBytes
) and can be determined without reading any additional data.
compression_ratio
Inherited from uproot.TTree.
- Model_TTree_v17.compression_ratio
The number of uncompressed bytes divided by the number of compressed bytes for this
TTree
.See compressed_bytes and uncompressed_bytes.
aliases
Inherited from uproot.TTree.
- Model_TTree_v17.aliases
The
TTree
’sfAliases
, which are used as thealiases
argument to arrays, iterate, uproot.iterate, and uproot.concatenate if one is not given.The return type is always a dict of str → str, even if there are no aliases (an empty dict).
chunk
Inherited from uproot.TTree.
- Model_TTree_v17.chunk
The uproot.source.chunk.Chunk from which this
TTree
was read (as a strong, not weak, reference).The reason the chunk is retained is to read embedded_baskets only if necessary (if the file was opened with
options["minimal_ttree_metadata"]=True
, the reading of theseTBaskets
is deferred until they are accessed).Holding a strong reference to a chunk holds a strong reference to its uproot.source.chunk.Source, preventing open file handles from going out of scope, but so does the uproot.ReadOnlyFile that
TTree
needs to read data on demand.
branches
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.branches
The list of uproot.TBranch directly under this uproot.TTree or uproot.TBranch (i.e. not recursive).
show
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.show(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True, name_width=20, typename_width=24, interpretation_width=30, stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, recursively descend into the branches’ branches.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
); otherwise, use the descendant’s name as the display name.name_width (int) – Number of characters to reserve for the
TBranch
names.typename_width (int) – Number of characters to reserve for the C++ typenames.
interpretation_width (int) – Number of characters to reserve for the uproot.interpretation.Interpretation displays.
stream (object with a
write(str)
method) – Stream to write the output to.
Interactively display the
TBranches
.For example,
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<TLorentz | AsJagged(AsStridedObjects(Model_TL jetbtag | std::vector<float> | AsJagged(AsDtype('>f4'), header_by jetid | std::vector<bool> | AsJagged(AsDtype('bool'), header_b
arrays
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.arrays(expressions=None, cut=None, *, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, aliases=None, language=uproot.language.python.PythonLanguage(), entry_start=None, entry_stop=None, decompression_executor=None, interpretation_executor=None, array_cache='inherit', library='ak', ak_add_doc=False, how=None)
- Parameters:
expressions (None, str, or list of str) – Names of
TBranches
or aliases to convert to arrays or mathematical expressions of them. Uses thelanguage
to evaluate. If None, allTBranches
selected by the filters are included.cut (None or str) – If not None, this expression filters all of the
expressions
.filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. If the function returns False or None, theTBranch
is excluded; if the function returns True, it is included with its standard interpretation; if an uproot.interpretation.Interpretation, this interpretation overrules the standard one.aliases (None or dict of str → str) – Mathematical expressions that can be used in
expressions
or other aliases (without cycles). Uses thelanguage
engine to evaluate. If None, only the aliases are available.language (uproot.language.Language) – Language used to interpret the
expressions
andaliases
.entry_start (None or int) – The first entry to include. If None, start at zero. If negative, count from the end, like a Python slice.
entry_stop (None or int) – The first entry to exclude (i.e. one greater than the last entry to include). If None, stop at num_entries. If negative, count from the end, like a Python slice.
decompression_executor (None or Executor with a
submit
method) – The executor that is used to decompressTBaskets
; if None, the file’s decompression_executor is used.interpretation_executor (None or Executor with a
submit
method) – The executor that is used to interpret uncompressedTBasket
data as arrays; if None, the file’s interpretation_executor is used.array_cache ("inherit", None, MutableMapping, or memory size) – Cache of arrays; if “inherit”, use the file’s cache; if None, do not use a cache; if a memory size, create a new cache of this size.
library (str or uproot.interpretation.library.Library) – The library that is used to represent arrays. Options are
"np"
for NumPy,"ak"
for Awkward Array, and"pd"
for Pandas.ak_add_doc (bool) – If True and
library="ak"
, add the TBranchtitle
to the Awkward__doc__
parameter of the array.how (None, str, or container type) – Library-dependent instructions for grouping. The only recognized container types are
tuple
,list
, anddict
. Note that the container type itself must be passed ashow
, not an instance of that type (i.e.how=tuple
, nothow=()
).
Returns a group of arrays from the
TTree
.For example:
>>> my_tree["x"].array() <Array [-41.2, 35.1, 35.1, ... 32.4, 32.5] type='2304 * float64'> >>> my_tree["y"].array() <Array [17.4, -16.6, -16.6, ... 1.2, 1.2, 1.2] type='2304 * float64'>
See also array to read a single
TBranch
as an array.See also iterate to iterate over the array in contiguous ranges of entries.
iterate
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.iterate(expressions=None, cut=None, *, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, aliases=None, language=uproot.language.python.PythonLanguage(), entry_start=None, entry_stop=None, step_size='100 MB', decompression_executor=None, interpretation_executor=None, library='ak', ak_add_doc=False, how=None, report=False)
- Parameters:
expressions (None, str, or list of str) – Names of
TBranches
or aliases to convert to arrays or mathematical expressions of them. Uses thelanguage
to evaluate. If None, allTBranches
selected by the filters are included.cut (None or str) – If not None, this expression filters all of the
expressions
.filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. If the function returns False or None, theTBranch
is excluded; if the function returns True, it is included with its standard interpretation; if an uproot.interpretation.Interpretation, this interpretation overrules the standard one.aliases (None or dict of str → str) – Mathematical expressions that can be used in
expressions
or other aliases (without cycles). Uses thelanguage
engine to evaluate. If None, only the aliases are available.language (uproot.language.Language) – Language used to interpret the
expressions
andaliases
.entry_start (None or int) – The first entry to include. If None, start at zero. If negative, count from the end, like a Python slice.
entry_stop (None or int) – The first entry to exclude (i.e. one greater than the last entry to include). If None, stop at num_entries. If negative, count from the end, like a Python slice.
step_size (int or str) – If an integer, the maximum number of entries to include in each iteration step; if a string, the maximum memory size to include. The string must be a number followed by a memory unit, such as “100 MB”.
decompression_executor (None or Executor with a
submit
method) – The executor that is used to decompressTBaskets
; if None, the file’s decompression_executor is used.interpretation_executor (None or Executor with a
submit
method) – The executor that is used to interpret uncompressedTBasket
data as arrays; if None, the file’s interpretation_executor is used.library (str or uproot.interpretation.library.Library) – The library that is used to represent arrays. Options are
"np"
for NumPy,"ak"
for Awkward Array, and"pd"
for Pandas.ak_add_doc (bool) – If True and
library="ak"
, add the TBranchtitle
to the Awkward__doc__
parameter of the array.how (None, str, or container type) – Library-dependent instructions for grouping. The only recognized container types are
tuple
,list
, anddict
. Note that the container type itself must be passed ashow
, not an instance of that type (i.e.how=tuple
, nothow=()
).report (bool) – If True, this generator yields (arrays, uproot.behaviors.TBranch.Report) pairs; if False, it only yields arrays. The report has data about the
TFile
,TTree
, and global and local entry ranges.
Iterates through contiguous chunks of entries from the
TTree
.For example:
>>> for array in tree.iterate(["x", "y"], step_size=100): ... # each of the following have 100 entries ... array["x"], array["y"]
See also arrays to read everything in a single step, without iteration.
See also uproot.iterate to iterate over many files.
keys
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.keys(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True, ignore_duplicates=False)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return the names of branches directly accessible under this object.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
); otherwise, use the descendant’s name as the output name.ignore_duplicates (bool) – If True, return a set of the keys; otherwise, return the full list of keys.
Returns the names of the subbranches as a list of strings.
values
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.values(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return branches that are directly accessible under this object.
Returns the subbranches as a list of uproot.TBranch.
(Note: with
recursive=False
, this is the same as branches.)
items
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.items(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return (name, branch) pairs for branches directly accessible under this object.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
) in the name; otherwise, use the descendant’s name as the name without modification.
Returns (name, branch) pairs of the subbranches as a list of 2-tuples of (str, uproot.TBranch).
typenames
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.typenames(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return (name, typename) pairs for branches directly accessible under this object.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
) in the name; otherwise, use the descendant’s name as the name without modification.
Returns (name, typename) pairs of the subbranches as a dict of str → str.
iterkeys
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.iterkeys(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True, ignore_duplicates=False)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return the names of branches directly accessible under this object.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
); otherwise, use the descendant’s name as the output name.ignore_duplicates (bool) – If True, return a set of the keys; otherwise, return the full list of keys.
Returns the names of the subbranches as an iterator over strings.
itervalues
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.itervalues(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return branches that are directly accessible under this object.
Returns the subbranches as an iterator over uproot.TBranch.
(Note: with
recursive=False
, this is the same as branches.)
iteritems
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.iteritems(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True, ignore_duplicates=False)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return (name, branch) pairs for branches directly accessible under this object.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
) in the name; otherwise, use the descendant’s name as the name without modification.ignore_duplicates (bool) – If True, return a set of the keys; otherwise, return the full list of keys.
Returns (name, branch) pairs of the subbranches as an iterator over 2-tuples of (str, uproot.TBranch).
itertypenames
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.itertypenames(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=True)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only return (name, typename) pairs for branches directly accessible under this object.
full_paths (bool) – If True, include the full path to each subbranch with slashes (
/
) in the name; otherwise, use the descendant’s name as the name without modification.
Returns (name, typename) pairs of the subbranches as an iterator over 2-tuples of (str, str).
num_entries_for
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.num_entries_for(memory_size, expressions=None, cut=None, *, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, aliases=None, language=uproot.language.python.PythonLanguage(), entry_start=None, entry_stop=None)
- Parameters:
memory_size (int or str) – An integer is interpreted as a number of bytes and a string must be a number followed by a unit, such as “100 MB”.
expressions (None, str, or list of str) – Names of
TBranches
or aliases to convert to arrays or mathematical expressions of them. Uses thelanguage
to evaluate. If None, allTBranches
selected by the filters are included.cut (None or str) – If not None, this expression filters all of the
expressions
.filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.aliases (None or dict of str → str) – Mathematical expressions that can be used in
expressions
or other aliases (without cycles). Uses thelanguage
engine to evaluate. If None, only the aliases are available.language (uproot.language.Language) – Language used to interpret the
expressions
andaliases
.entry_start (None or int) – The first entry to include. If None, start at zero. If negative, count from the end, like a Python slice.
entry_stop (None or int) – The first entry to exclude (i.e. one greater than the last entry to include). If None, stop at num_entries. If negative, count from the end, like a Python slice.
Returns an approximate step size as a number of entries to read a given
memory_size
in each step.This method does not actually read the
TBranch
data or compute any expressions to arrive at its estimate. It only uses metadata from the already-loadedTTree
; it only needslanguage
to parse the expressions, not to evaluate them.In addition, the estimate is based on compressed
TBasket
sizes (the amount of data that would have to be read), not uncompressedTBasket
sizes (the amount of data that the final arrays would use in memory, without consideringcuts
).This is the algorithm that iterate uses to convert a
step_size
expressed in memory units into a number of entries.
common_entry_offsets
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.common_entry_offsets(*, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True)
- Parameters:
filter_name (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by name.filter_typename (None, glob string, regex string in
"/pattern/i"
syntax, function of str → bool, or iterable of the above) – A filter to selectTBranches
by type.filter_branch (None or function of uproot.TBranch → bool, uproot.interpretation.Interpretation, or None) – A filter to select
TBranches
using the full uproot.TBranch object. TheTBranch
is included if the function returns True, excluded if it returns False.recursive (bool) – If True, descend into any nested subbranches. If False, only consider branches directly accessible under this object. (Only applies when
branches=None
.)
Returns entry offsets in which
TBasket
boundaries align in the specified set of branches.If this uproot.TBranch has no subbranches, the output is identical to entry_offsets.
source
Inherited from uproot.behaviors.TBranch.HasBranches.
- Model_TTree_v17.source
Returns the associated source of data for this container, if it exists
Returns: uproot.source.chunk.Source or None
classname
Inherited from uproot.Model.
- Model_TTree_v17.classname
The C++ (decoded) classname of the modeled class.
See uproot.classname_decode, uproot.classname_encode, and uproot.model.classname_version.
encoded_classname
Inherited from uproot.Model.
- Model_TTree_v17.encoded_classname
The Python (encoded) classname of the modeled class. May or may not include version.
See uproot.classname_decode, uproot.classname_encode, and uproot.model.classname_version.
class_version
Inherited from uproot.Model.
- Model_TTree_v17.class_version
The version number of the modeled class (int) if any; None otherwise.
See uproot.classname_decode, uproot.classname_encode, and uproot.model.classname_version.
cursor
Inherited from uproot.Model.
- Model_TTree_v17.cursor
A cursor pointing to the start of this instance in the byte stream (before read_numbytes_version).
file
Inherited from uproot.Model.
- Model_TTree_v17.file
A uproot.ReadOnlyFile, which may be open and readable, or a uproot.reading.DetachedFile, which only contains information about the original file (not an open file handle).
close
Inherited from uproot.Model.
- Model_TTree_v17.close()
Closes the file from which this object is derived, if such a file is still attached (i.e. not uproot.reading.DetachedFile).
closed
Inherited from uproot.Model.
- Model_TTree_v17.closed
True if the associated file is known to be closed; False if it is known to be open. If the associated file is detached (uproot.reading.DetachedFile), then the value is None.
parent
Inherited from uproot.Model.
- Model_TTree_v17.parent
The object that was deserialized before this one in recursive descent, usually the containing object (or the container’s container).
concrete
Inherited from uproot.Model.
members
Inherited from uproot.Model.
- Model_TTree_v17.members
A dict of C++ member data directly associated with this class (i.e. not its superclasses). For all members, see all_members.
all_members
Inherited from uproot.Model.
has_member
Inherited from uproot.Model.
member
Inherited from uproot.Model.
- Model_TTree_v17.member(name, all=True, none_if_missing=False)
- Parameters:
name (str) – The name of the member datum to retrieve.
all (bool) – If True, recursively search all superclasses in bases. Otherwise, search the direct class only.
none_if_missing (bool) – If a member datum doesn’t exist in the search path,
none_if_missing=True
has this function return None, butnone_if_missing=False
would have it raise an exception. Note that None is a possible value for some member data.
Returns a C++ member datum by name.
bases
Inherited from uproot.Model.
- Model_TTree_v17.bases
List of uproot.Model objects representing superclass data for this object in the order given in C++ (opposite method resolution order).
If this object has no superclasses,
bases
is empty.If it has one superclass, which itself might have superclasses,
bases
has length 1.Only if this object multiply inherits from more than one superclass at the same level does
bases
have length greater than 1.
Since multiple inheritance is usually avoided,
bases
rarely has length greater than 1. A linear chain of superclasses deriving from super-superclasses is represented bybases
containing an object whosebases
contains objects.
base
Inherited from uproot.Model.
is_instance
Inherited from uproot.Model.
- Model_TTree_v17.is_instance(*cls)
Returns True if this object matches a given type in the C++ class hierarchy.
The
cls
arguments may be Python classes or C++ classname strings to match.
num_bytes
Inherited from uproot.Model.
- Model_TTree_v17.num_bytes
Number of bytes expected in the (uncompressed) serialization of this instance.
This value may be None (unknown before reading) or an integer.
If the value is an integer and the object exists (no exceptions in read), then the expected number of bytes agreed with the actual number of bytes, and this numer is reliable.
If this object is re-serialized, it won’t necessarily occupy the same number of bytes.
instance_version
Inherited from uproot.Model.
- Model_TTree_v17.instance_version
Version of this instance as read from the byte stream.
If this model is versioned (uproot.model.VersionedModel), the
instance_version
ought to be equal to the class_version.If this model is versionless, the
instance_version
contains new information about the actual version deserialized.
is_memberwise
Inherited from uproot.Model.
- Model_TTree_v17.is_memberwise
True if the object was serialized in ROOT’s memberwise format; False otherwise.
awkward_form
Inherited from uproot.Model.
- classmethod Model_TTree_v17.awkward_form(file, context)
- Parameters:
cls (subclass of uproot.Model) – This class.
file (uproot.ReadOnlyFile) – File to use to generate uproot.Model classes from its streamers and
file_path
for error messages.context (dict) – Context for the Form-generation; defaults are the remaining arguments below.
index_format (str) – Format to use for indexes of the
awkward.forms.Form
; may be"i32"
,"u32"
, or"i64"
.header (bool) – If True, include header fields of each C++ class.
tobject_header (bool) – If True, include header fields of each
TObject
base class.breadcrumbs (tuple of class objects) – Used to check for recursion. Types that contain themselves cannot be Awkward Arrays because the depth of instances is unknown.
The
awkward.forms.Form
to use to put objects of type type in an Awkward Array.
strided_interpretation
Inherited from uproot.Model.
- classmethod Model_TTree_v17.strided_interpretation(file, header=False, tobject_header=True, breadcrumbs=(), original=None)
- Parameters:
cls (subclass of uproot.Model) – This class.
file (uproot.ReadOnlyFile) – File to use to generate uproot.Model classes from its streamers and
file_path
for error messages.header (bool) – If True, assume the outermost object has a header.
tobject_header (bool) – If True, assume that
TObjects
have headers.original (None, uproot.Model, or uproot.containers.Container) – The original, non-strided model or container.
breadcrumbs (tuple of class objects) – Used to check for recursion. Types that contain themselves cannot be strided because the depth of instances is unknown.
Returns a list of (str,
numpy.dtype
) pairs to build a uproot.AsStridedObjects interpretation.
tojson
Inherited from uproot.Model.
- Model_TTree_v17.tojson()
Serializes this object in its ROOT JSON form (as Python lists and dicts, which can be passed to
json.dump
orjson.dumps
).
empty
Inherited from uproot.Model.
- classmethod Model_TTree_v17.empty()
Creates a model instance (of subclass
cls
) with no data; all required attributes are None or empty.
read
Inherited from uproot.Model.
- classmethod Model_TTree_v17.read(chunk, cursor, context, file, selffile, parent, concrete=None)
- Parameters:
cls (subclass of uproot.Model) – Class to instantiate.
chunk (uproot.source.chunk.Chunk) – Buffer of contiguous data from the file uproot.source.chunk.Source.
cursor (uproot.Cursor) – Current position in that
chunk
.context (dict) – Auxiliary data used in deserialization.
file (uproot.ReadOnlyFile) – An open file object, capable of generating new uproot.Model classes from its streamers.
selffile (uproot.reading.CommonFileMethods) – A possibly uproot.reading.DetachedFile associated with this object.
parent (None or calling object) – The previous
read
in the recursive descent.concrete (None or uproot.Model 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.
Creates a model instance by reading data from a file.
read_numbytes_version
Inherited from uproot.Model.
- Model_TTree_v17.read_numbytes_version(chunk, cursor, context)
- Parameters:
chunk (uproot.source.chunk.Chunk) – Buffer of contiguous data from the file uproot.source.chunk.Source.
cursor (uproot.Cursor) – Current position in that
chunk
.context (dict) – Auxiliary data used in deserialization.
Reads the number of bytes and instance version from the byte stream, which is usually 6 bytes (4 + 2). Bits with special meanings are appropriately masked out.
Some types don’t have a 6-byte header or handle it differently; in those cases, this method should be overridden.
read_members
Inherited from uproot.Model.
- Model_TTree_v17.read_members(chunk, cursor, context, file)
- Parameters:
chunk (uproot.source.chunk.Chunk) – Buffer of contiguous data from the file uproot.source.chunk.Source.
cursor (uproot.Cursor) – Current position in that
chunk
.context (dict) – Auxiliary data used in deserialization.
file (uproot.ReadOnlyFile) – An open file object, capable of generating new uproot.Model classes from its streamers.
Reads the member data for this class. The abstract class uproot.Model has an empty
read_members
method; this must be overridden by subclasses.
check_numbytes
Inherited from uproot.Model.
- Model_TTree_v17.check_numbytes(chunk, cursor, context)
- Parameters:
chunk (uproot.source.chunk.Chunk) – Buffer of contiguous data from the file uproot.source.chunk.Source.
cursor (uproot.Cursor) – Current position in that
chunk
.context (dict) – Auxiliary data used in deserialization.
Reads nothing; checks the expected number of bytes against the actual movement of the
cursor
at the end of the object, possibly raising a uproot.DeserializationError exception.If num_bytes is None, this method does nothing.
It is possible that a subclass would override this method, but not likely.
postprocess
Inherited from uproot.Model.
- Model_TTree_v17.postprocess(chunk, cursor, context, file)
- Parameters:
chunk (uproot.source.chunk.Chunk) – Buffer of contiguous data from the file uproot.source.chunk.Source.
cursor (uproot.Cursor) – Current position in that
chunk
.context (dict) – Auxiliary data used in deserialization.
file (uproot.ReadOnlyFile) – An open file object, capable of generating new uproot.Model classes from its streamers.
Called for any additional processing after the object has been fully read.
The return value from this method is the object that actually represents the ROOT data, which might be a different instance or even a different type from this class. The default in uproot.Model is to return
self
.Note that for versioned models, postprocess is called first, then postprocess is called on its output, allowing a uproot.model.DispatchByVersion to refine all data of its type, regardless of version.
hook_before_read
Inherited from uproot.Model.
hook_before_read_members
Inherited from uproot.Model.
- Model_TTree_v17.hook_before_read_members(**kwargs)
Called in read, after read_numbytes_version and before read_members.
hook_after_read_members
Inherited from uproot.Model.
- Model_TTree_v17.hook_after_read_members(**kwargs)
Called in read, after read_members and before check_numbytes.
hook_before_postprocess
Inherited from uproot.Model.
- Model_TTree_v17.hook_before_postprocess(**kwargs)
Called in read, after check_numbytes and before postprocess.
to_writable
Inherited from uproot.Model.
- Model_TTree_v17.to_writable()
- Parameters:
obj (uproot.Model instance of the same C++ class) – The object to convert to this class version.
Returns a writable version of this object or raises a NotImplementedError if no writable version exists.
serialize
Inherited from uproot.Model.
- Model_TTree_v17.serialize(name=None)
Serialize a object (from num_bytes and version onward) for writing into an output ROOT file.
If a
name
is given, override the object’s current name.This method has not been implemented on all classes (raises NotImplementedError).
to_pyroot
Inherited from uproot.Model.
- Model_TTree_v17.to_pyroot(name=None)
- Parameters:
name (str or None) – A name for the new PyROOT object.
Converts this uproot.Model into a PyROOT object if it is writable. A minority of Uproot models are writable, mostly just histograms. Writability is necessary for conversion to PyROOT because it is serialized through a ROOT TMessage.