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 openTTree, a dict entry with explicit"steps"; a single-TTreefile needs no object path).filter_name –
TBranchselection, as in uproot.dask.filter_typename –
TBranchselection, as in uproot.dask.filter_branch –
TBranchselection, as in uproot.dask.recursive –
TBranchselection, as in uproot.dask.full_paths –
TBranchselection, as in uproot.dask.library (str) – Only
"ak"is supported (a single deferredgraphedarray)."np"and"pd"raiseNotImplementedError.ak_add_doc (bool | dict) – As in uproot.dask, for a TTree or an RNTuple: a
valueof"title"(the TBranch attribute) reads the RFielddescription.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: withgak.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
TTreeform into the one the user sees (coffea’sNanoEventsFactoryis the archetype) and fills that form’s buffers from the file. The recorded array then has the MAPPED form and the mapping info’sbehavioris registered on the backend. Without one,TrivialFormMappingreads 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 infiles.backend (graphed Backend or None) – The
graphedbackend instance the session records on, in place of the defaultgraphed.awkward.AwkwardBackend— the route for a caller’s ownArraysubclass. Its behavior (and, withform_mapping, the mapping info’s) is then the caller’s business, sobehavior=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 withbackend=andbehavior=; its backend must be anAwkwardBackendand, withform_mapping=, carry the mapping’s behavior. Without it, the read records intographed.current_session(): the innermost openwith session:scope, else the default Session, which this read creates on its own backend when there is none; sowith events.session: uproot.graphed(friends, name="friends")joins too. That Session must be an instance of the read’s backend class and, whenbehavior=,backend=orform_mapping=names a behavior, carry an equal one; any other is refused at the read. With agraphedthat has nocurrent_session, each such read gets a newSession.name (str or None) – The
graphedsource’s name, its slot in the recorded graph; default theTTree’s name, or when another read already holds that, theTTree’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 agraphedthat has nocurrent_session, every read under a taken name is refused, before any file is opened when the name is known fromname=or thefiles’ 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
TBasketboundaries shared by theTBranchesit reads, so noTBasketis decompressed by two partitions. The partition count is unchanged; a partition can come out empty. Incompatible with explicit"steps";TTreesonly.open_files (bool) – If False (default), only the first file that has the
TTreeis opened, for the form and theTBranchnames; the files after it are listed by path and opened only when read, so a missingTBranchin one of them fails the read and, withallow_missing, a missingTTreereads as empty. A file listed more than once is opened to resolve each entry’sTTree, so the sameTTreelisted twice in two spellings is one input (uproot.graphed_writerefuses the duplicate), and withallow_missingits missingTTreeis 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 aTTreeor in aTBranch. An unopened file is validated only when it is read: withoutallow_missing, a missingTTree(or, withalign_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: theTBranchesare those every file has, a file without theTTreeis dropped (or refused withoutallow_missing), and an RNTuple is refused withalign_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
graphedArrayfor the selectedTTree``(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 theTBranchesthe recorded graph touches.Partitioning is decided where a plan is built (
steps_per_file=there), not here, sostep_sizeandsteps_per_fileare refused by name, as areentry_startandentry_stop, whose route is'steps'infiles;align_baskets=decides that the boundaries followTBaskets. For one task perTBasket-sparse file, passpartitions=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
graphedanalogue of uproot.dask.