uproot.interpretation.library.NumPy
Defined in uproot.interpretation.library on line 171.
Inheritance order: |
---|
- class uproot.interpretation.library.NumPy
A uproot.interpretation.library.Library that presents
TBranch
data as NumPy arrays. The standard name for this library is"np"
.The single-
TBranch
form for this library is anumpy.ndarray
. If the data are non-numerical, they will be converted into Python objects and stored in an array withdtype="O"
. This is inefficient, but it is the minimal-dependency option for Python.The “group” behavior for this library is:
how=dict
orhow=None
: a dict of str → array, mapping the names to arrays.how=tuple
: a tuple of arrays, in the order requested. (Names are lost.)how=list
: a list of arrays, in the order requested. (Names are lost.)
Since NumPy arrays are not indexed,
global_index
has no effect.
imported
Inherited from uproot.interpretation.library.Library.
- NumPy.imported
empty
Inherited from uproot.interpretation.library.Library.
- NumPy.empty(shape, dtype)
- Parameters:
shape (tuple of int) – NumPy array
shape
. (The first item must be zero.)dtype (
numpy.dtype
or its constructor argument) – NumPy arraydtype
.
Returns an empty NumPy-like array.
zeros
Inherited from uproot.interpretation.library.Library.
- NumPy.zeros(shape, dtype)
- Parameters:
shape (tuple of int) – NumPy array
shape
. (The first item must be zero.)dtype (
numpy.dtype
or its constructor argument) – NumPy arraydtype
.
Returns a NumPy-like array of zeros.
finalize
Inherited from uproot.interpretation.library.Library.
- NumPy.finalize(array, branch, interpretation, entry_start, entry_stop, options)
- Parameters:
array (array) – Internal, temporary, trimmed array. If this is a NumPy array, it may be identical to the output array.
branch (uproot.TBranch) – The
TBranch
that is represented by this array.interpretation (uproot.interpretation.Interpretation) – The interpretation that produced the
array
.entry_start (int) – First entry that is included in the output.
entry_stop (int) – FIrst entry that is excluded (one greater than the last entry that is included) in the output.
interp_options (dict) – Flags and other options passed through the interpretation process.
Create a library-appropriate output array for this temporary
array
.This array would represent one
TBranch
(i.e. not a “group”).
group
Inherited from uproot.interpretation.library.Library.
- NumPy.group(arrays, expression_context, how)
- Parameters:
arrays (dict of str → array) – Mapping from names to finalized array objets to combine into a group.
expression_context (list of (str, dict) tuples) – Expression strings and a dict of metadata about each.
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=()
).
Combine the finalized
arrays
into a library-appropriate group type.
global_index
Inherited from uproot.interpretation.library.Library.
- NumPy.global_index(array, global_offset)
- Parameters:
array (array) – The library-appropriate array whose global index needs adjustment.
global_offset (int) – A number to add to the global index of
array
to correct it.
Apply in-place corrections to the global index of
array
by addingglobal_offset
.Even though the operation is performed in-place, this method returns the
array
.
concatenate
Inherited from uproot.interpretation.library.Library.
- NumPy.concatenate(all_arrays)
- Parameters:
all_arrays (list of arrays) – A list of library-appropriate arrays that need to be concatenated.
Returns a concatenated version of
all_arrays
.