uproot.graphed

Defined in uproot._graphed on line 639.

uproot._graphed.graphed(files, *, filter_name=<function no_filter>, filter_typename=<function no_filter>, filter_branch=<function no_filter>, recursive=True, full_paths=False, library='ak', ak_add_doc=False, custom_classes=None, allow_missing=False, behavior=None, form_mapping=None, known_base_form=None, backend=None, session=None, name=None, decompression_executor=None, interpretation_executor=None, align_baskets=False, open_files=False, **options)
Parameters:
  • files – The TTree``(s) to read, in any form accepted by :doc:`uproot._dask.dask` (a path with ``"file.root:tree", a list, a dict, an open TTree, a dict entry with explicit "steps"; a single-TTree file needs no object path).

  • filter_name – TBranch selection, as in uproot.dask.

  • filter_typename – TBranch selection, as in uproot.dask.

  • filter_branch – TBranch selection, as in uproot.dask.

  • recursive – TBranch selection, as in uproot.dask.

  • full_paths – TBranch selection, as in uproot.dask.

  • library (str) – Only "ak" is supported (a single deferred graphed array). "np" and "pd" raise NotImplementedError.

  • ak_add_doc (bool | dict) – As in uproot.dask, for a TTree or an RNTuple: a value of "title" (the TBranch attribute) reads the RField description.

  • custom_classes – As in uproot.dask.

  • allow_missing – As in uproot.dask.

  • behavior (dict or None) – An awkward behavior dict (e.g. vector’s) registered on the recording backend, for the default backend and the unmapped form: with gak.with_name, behavior PROPERTIES (.pt, .mass) work through plain attribute access — typetracer forms at record time, projectable down to exactly the branches a property reads.

  • form_mapping (ImplementsFormMapping or None) – The mapping uproot.dask takes — it restructures the flat TTree form into the one the user sees (coffea’s NanoEventsFactory is the archetype) and fills that form’s buffers from the file. The recorded array then has the MAPPED form and the mapping info’s behavior is registered on the backend. Without one, TrivialFormMapping reads the file’s form.

  • known_base_form (awkward.forms.Form | None) – If not none use this form instead of opening one file to determine the dataset’s form, as in uproot.dask. No file is opened at all; the TTree’s name then comes from the object path in files.

  • backend (graphed Backend or None) – The graphed backend instance the session records on, in place of the default graphed.awkward.AwkwardBackend — the route for a caller’s own Array subclass. Its behavior (and, with form_mapping, the mapping info’s) is then the caller’s business, so behavior= is refused beside it.

  • session (graphed Session or None) – Record into this existing Session (and on its backend), so the result can be combined with arrays already recorded there, e.g. graphed.join(events, uproot.graphed(friends, session=events.session, name="friends"), on=[...]). Exclusive with backend= and behavior=; its backend must be an AwkwardBackend and, with form_mapping=, carry the mapping’s behavior. Without it, the read records into graphed.current_session(): the innermost open with session: scope, else the default Session, which this read creates on its own backend when there is none; so with events.session: uproot.graphed(friends, name="friends") joins too. That Session must be an instance of the read’s backend class and, when behavior=, backend= or form_mapping= names a behavior, carry an equal one; any other is refused at the read. With a graphed that has no current_session, each such read gets a new Session.

  • name (str or None) – The graphed source’s name, its slot in the recorded graph; default the TTree’s name, or when another read already holds that, the TTree’s name with a hash of what this read reads, numbered (#1, …) when the hash cannot tell it from another read. Repeating a read, name= included, returns that source again; any other read under a name given here is refused. With a graphed that has no current_session, every read under a taken name is refused, before any file is opened when the name is known from name= or the files’ object paths.

  • decompression_executor – As in uproot.dask; every partition read uses them.

  • interpretation_executor – As in uproot.dask; every partition read uses them.

  • align_baskets (bool) – If True, each blind partition’s entry range moves, when it is read, to the nearest TBasket boundaries shared by the TBranches it reads, so no TBasket is decompressed by two partitions. The partition count is unchanged; a partition can come out empty. Incompatible with explicit "steps"; TTrees only.

  • open_files (bool) – If False (default), only the first file that has the TTree is opened, for the form and the TBranch names; the files after it are listed by path and opened only when read, so a missing TBranch in one of them fails the read and, with allow_missing, a missing TTree reads as empty. A file listed more than once is opened to resolve each entry’s TTree, so the same TTree listed twice in two spellings is one input (uproot.graphed_write refuses the duplicate), and with allow_missing its missing TTree is dropped rather than read as empty. A file whose object path has a / and differs from the first file’s is opened too: the path could end in a TTree or in a TBranch. An unopened file is validated only when it is read: without allow_missing, a missing TTree (or, with align_baskets, an RNTuple) fails that partition’s read, after other partitions may have written their parts. If True, every file is opened up front, as uproot.dask does by default: the TBranches are those every file has, a file without the TTree is dropped (or refused without allow_missing), and an RNTuple is refused with align_baskets.

  • options – Passed through to file opening. A key uproot.open does not take is an fsspec storage option, refused when every file is local.

Returns a deferred graphed Array for the selected TTree``(s). Construction reads only metadata; running the recorded analysis (``graphed.aggregate_plan, graphed.awkward.to_parquet, uproot.graphed_write) triggers the read, partition by partition, fetching only the TBranches the recorded graph touches.

Partitioning is decided where a plan is built (steps_per_file= there), not here, so step_size and steps_per_file are refused by name, as are entry_start and entry_stop, whose route is 'steps' in files; align_baskets= decides that the boundaries follow TBaskets. For one task per TBasket-sparse file, pass partitions=uproot.graphed_partitions(..., align_baskets=True) where the plan is built.

Experimental: tracks a pre-1.0 graphed; the API may change without a deprecation cycle.

This is the graphed analogue of uproot.dask.