uproot.models.TLeaf.Model_TLeafElement
Defined in uproot.models.TLeaf on line 727.
Inheritance order: |
---|
- class uproot.models.TLeaf.Model_TLeafElement
A uproot.model.DispatchByVersion for
TLeafElement
(arbitrary objects, associated withTBranchElement
).
awkward_form
Inherited from uproot.model.DispatchByVersion.
- classmethod Model_TLeafElement.awkward_form(file, context)
- Parameters:
cls (subclass of uproot.model.DispatchByVersion) – 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
{"index_format": "i64", "header": False, "tobject_header": True, "breadcrumbs": ()}
. See below for context argument descriptions.index_format (str) – Format to use for indexes of the
awkward.forms.Form
; may be"i32"
,"u32"
, or"i64"
.header (bool) – If True, include headers in the Form’s
"uproot"
parameters.tobject_header (bool) – If True, include headers for
TObject
classes in the Form’s"uproot"
parameters.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.DispatchByVersion.
- classmethod Model_TLeafElement.strided_interpretation(file, header=False, tobject_header=True, breadcrumbs=(), original=None)
- Parameters:
cls (subclass of uproot.model.DispatchByVersion) – 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.
class_of_version
Inherited from uproot.model.DispatchByVersion.
- classmethod Model_TLeafElement.class_of_version(version)
Returns the class corresponding to a specified
version
if it exists.If not, this classmethod returns None. No attempt is made to create a missing class.
has_version
Inherited from uproot.model.DispatchByVersion.
- classmethod Model_TLeafElement.has_version(version)
Returns True if a class corresponding to a specified
version
currently exists; False otherwise.
new_class
Inherited from uproot.model.DispatchByVersion.
- classmethod Model_TLeafElement.new_class(file, version)
Uses
file
to create a new class for a specifiedversion
.As a side-effect, this new class is added to
cls.known_versions
(for class_of_version and has_version).If the
file
lacks aTStreamerInfo
for the class, this function returns a uproot.model.UnknownClassVersion (adding it touproo4.unknown_classes
if it’s not already there).
read
Inherited from uproot.model.DispatchByVersion.
- classmethod Model_TLeafElement.read(chunk, cursor, context, file, selffile, parent, concrete=None)
- Parameters:
cls (subclass of uproot.model.DispatchByVersion) – This class.
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.
Reads the instance version number from the byte stream, backs up the uproot.Cursor to the starting position, and invokes the appropriate uproot.model.VersionedModel’s
read
classmethod.If a uproot.model.VersionedModel does not exist for the specified version, the
file
’sTStreamerInfo
is queried to attempt to create one, and failing that, an uproot.model.UnknownClassVersion is created instead.
postprocess
Inherited from uproot.model.DispatchByVersion.
- classmethod Model_TLeafElement.postprocess(self, chunk, cursor, context, file)
- Parameters:
cls (subclass of uproot.model.DispatchByVersion) – This class.
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.