uproot.AsStridedObjects — Uproot documentation

# uproot.AsStridedObjects

Defined in uproot.interpretation.objects on line 352.

Inheritance order:
uproot.AsDtype uproot.interpretation.numerical.Numerical uproot.interpretation.Interpretation

class uproot.interpretation.objects.AsStridedObjects(model, members, original=None)
  Parameters:

    - model (uproot.Model or uproot.containers.AsContainer) – The full Uproot deserialization model for the data.

    - members (list of (str, uproot.interpretation.Interpretation) tuples) – The name and fixed-width interpretation for each member of the objects.

    - original (None, uproot.Model, or uproot.containers.AsContainer) – If this interpretation is derived from simplify, this is a reminder of the original model.

  Interpretation for an array (possibly uproot.AsJagged) of fixed-size objects. Since the objects have a fixed number of fields with a fixed number of bytes each, the whole array (or content) can be interpreted in one vectorized array-cast. Therefore, this interpretation is faster than uproot.AsObjects when it is possible.

  Unlike uproot.AsDtype with a structured array, the objects in the final array have the methods required by its `model`. If the `library` is uproot.interpretation.library.NumPy, these are instantiated as Python objects (slow); if uproot.interpretation.library.Awkward, they are behaviors passed to the Awkward Array’s local behavior.

## model

AsStridedObjects.model

  The full Uproot deserialization model for the data (uproot.Model or uproot.containers.AsContainer).

## members

AsStridedObjects.members

  The name (str) and fixed-width uproot.interpretation.Interpretation for each member of the objects as a list of 2-tuple pairs.

## original

AsStridedObjects.original

  If not None, this was the original model from an uproot.AsObjects that was simplified into this uproot.AsStridedObjects.

## from_dtype

Inherited from uproot.AsDtype.

AsStridedObjects.from_dtype

  Data type to expect of the raw but uncompressed bytes in the `TBasket` data. Usually big-endian; may include named fields and a shape.

  Named fields (`dtype.names`) can be used to construct a NumPy structured array.

  A shape (`dtype.shape`) can be used to construct a fixed-size array for each entry. (Not applicable to variable-length lists! See uproot.AsJagged.) The finalized array’s `array.shape[1:] == dtype.shape`.

## to_dtype

Inherited from uproot.AsDtype.

AsStridedObjects.to_dtype

  Data type to convert the data into. Usually the native-endian equivalent of from_dtype; may include named fields and a shape.

  Named fields (`dtype.names`) can be used to construct a NumPy structured array.

  A shape (`dtype.shape`) can be used to construct a fixed-size array for each entry. (Not applicable to variable-length lists! See uproot.AsJagged.) The finalized array’s `array.shape[1:] == dtype.shape`.

## itemsize

Inherited from uproot.AsDtype.

AsStridedObjects.itemsize

  Number of bytes per item of from_dtype.

  This number of bytes includes the fields and shape, like `dtype.itemsize` in NumPy.

## inner_shape

Inherited from uproot.AsDtype.

AsStridedObjects.inner_shape

## reshape

Inherited from uproot.AsDtype.

AsStridedObjects.reshape(shape)

## inplace

Inherited from uproot.AsDtype.

AsStridedObjects.inplace(array)

  Returns a AsDtypeInPlace version of self in order to fill the given array in place.

  Example usage : `` var = np.zeros(N, dtype=np.float32) b = uproot.openn('afile.root')['treename']['varname'] b.array(library='np', interpretation=b.interpretation.inplace(var) ) ``

## cache_key

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.cache_key

## typename

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.typename

## numpy_dtype

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.numpy_dtype

## awkward_form

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.awkward_form(file, context=None, index_format='i64', header=False, tobject_header=True, breadcrumbs=())
  Parameters:

    - 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 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.

## basket_array

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.basket_array(data, byte_offsets, basket, branch, context, cursor_offset, library)
  Parameters:

    - data (array of `numpy.uint8`) – Raw but uncompressed data from the `TBasket`. If the `TBasket` has offsets and navigational metadata, it is not included in this array.

    - byte_offsets (array of `numpy.int32`) – Index where each entry of the `TBasket` starts and stops. The header is not included (i.e. the first offset is `0`), and the length of this array is one greater than the number of entries in the `TBasket`.

    - basket (uproot.models.TBasket.Model_TBasket) – The `TBasket` object.

    - context (dict) – Auxiliary data used in deserialization.

    - cursor_offset (int) – Correction to the integer keys used in refs for objects deserialized by reference (uproot.deserialization.read_object_any).

    - library (uproot.interpretation.library.Library) – The requested library for output.

  Performs the first step of interpretation, from uncompressed `TBasket` data to a temporary array.

## final_array

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.final_array(basket_arrays, entry_start, entry_stop, entry_offsets, library, branch)
  Parameters:

    - basket_arrays (dict of int → array) – Mapping from `TBasket` number to the temporary array returned by basket_array.

    - entry_start (int) – First entry to include when trimming any excess entries from the first `TBasket`.

    - entry_stop (int) – FIrst entry to exclude (one greater than the last entry to include) when trimming any excess entries from the last `TBasket`.

    - entry_offsets (list of int) – The entry_offsets for this `TBranch`.

    - library (uproot.interpretation.library.Library) – The requested library for output.

    - branch (uproot.TBranch) – The `TBranch` that is being interpreted.

  Performs the last steps of interpretation, from a collection of temporary arrays, one for each `TBasket`, to a trimmed, finalized, grouped array, produced by the `library`.

## hook_before_basket_array

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.hook_before_basket_array(*args, **kwargs)

  Called in basket_array, before any interpretation.

  This is the first hook called in basket_array.

## hook_after_basket_array

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.hook_after_basket_array(*args, **kwargs)

  Called in basket_array, after all interpretation.

  This is the last hook called in basket_array.

## hook_before_final_array

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.hook_before_final_array(*args, **kwargs)

  Called in final_array, before any trimming, finalization, or grouping.

  This is the first hook called in final_array.

## hook_before_library_finalize

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.hook_before_library_finalize(*args, **kwargs)

  Called in final_array, after trimming but before calling the finalize routine.

## hook_after_final_array

Inherited from uproot.interpretation.Interpretation.

AsStridedObjects.hook_after_final_array(*args, **kwargs)

  Called in final_array, after all trimming, finalization, and grouping.

  This is the last hook called in final_array.