uproot.graphed_write

Defined in uproot.writing._graphed_write on line 103.

uproot.writing._graphed_write.graphed_write(array, destination, *, steps_per_file=1, prefix=None, tree_name='tree', title='', field_name=<function _default_field_name>, initial_basket_capacity=10, counter_name=<function _default_counter_name>, resize_factor=10.0, compression='zlib', compression_level=1, storage_options=None, compute=True, executor='process', max_workers=None, backend=None)
Parameters:
  • array (graphed.Array) – A record recorded over a uproot.graphed source — its fields become the TBranches. A fieldless expression (g.x * 2) has no branch name and is refused: wrap it, gak.zip({"x2": g.x * 2}).

  • destination (path-like) – Output directory, local or remote (storage_options reach its filesystem, as in dask_write); the part files are written inside it.

  • steps_per_file (int) – Split each input TTree into this many contiguous output partitions (blind — resolved by each worker; the driver opens no files). Files given with explicit steps are not writable this way: a worker derives its part index from the partition alone, which explicit ranges do not allow.

  • prefix (str or None) – Part files are named f"{prefix or 'part'}-{N:05d}.root".

  • tree_name – compression, compression_level: As in uproot.dask_write (one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

  • title – compression, compression_level: As in uproot.dask_write (one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

  • field_name – compression, compression_level: As in uproot.dask_write (one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

  • initial_basket_capacity – compression, compression_level: As in uproot.dask_write (one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

  • counter_name – compression, compression_level: As in uproot.dask_write (one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

  • resize_factor – compression, compression_level: As in uproot.dask_write (one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

:paramcompression, compression_level: As in uproot.dask_write

(one TTree per part, through mktree). field_name and counter_name must be picklable for the process executor (the defaults are).

Parameters:
  • compute (bool) – If True (default), execute the write task graph now and return the written paths (reported by the workers, in deterministic key order). If False, return the graphed.core.Plan without writing — run it later with an executor.

  • executor (str, executor instance or class) – "process" (default, ProcessPoolExecutor) or "thread" (ThreadExecutor); an executor instance is used as-is, a class is called as executor(max_workers=max_workers).

  • max_workers (int or None) – Worker count for an executor built here.

  • backend (callable, str or None) – The workers’ evaluation backend, as in graphed.aggregate_plan: a zero-arg factory/class or an importable "module:attr" reference, resolved in the worker; default the session backend’s type. A backend whose behavior holds lambdas (vector’s) does not pickle — pass it by reference.

Produces one ROOT file per partition, mirroring uproot.dask_write, as a specialization of the graphed.write partitioned-write base. A reduction on the partitioned axis (an axis-0 slice, gak.sum) is refused: each part would hold its own chunk’s partial.

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