19from dask.distributed
import Client, LocalCluster
22LiveVisualize = ROOT.RDF.Distributed.LiveVisualize
25RDataFrame = ROOT.RDF.Distributed.Dask.RDataFrame
29def create_connection():
30 cluster = LocalCluster(n_workers=4, threads_per_worker=1, processes=
True, memory_limit=
"2GiB")
31 client = Client(cluster)
40if __name__ ==
"__main__":
42 connection = create_connection()
45 num_entries = 100000000
46 d = RDataFrame(num_entries, executor=connection, npartitions=30)
49 dd = d.Define(
"x", f
"gRandom->Gaus(10*rdfentry_/{num_entries}, 2)").Define(
50 "y", f
"gRandom->Gaus(10*rdfentry_/{num_entries}, 3)"
53 h_normal_1d = dd.Histo1D((
"normal_1d",
"1D Histogram of a Normal Distribution", 100, -10, 20),
"x")
55 h_normal_2d = dd.Histo2D(
56 (
"normal_2d",
"2D Histogram of a Normal Distribution", 100, -15, 25, 100, -15, 25),
"x",
"y"
63 LiveVisualize({h_normal_1d: fit_gaus, h_normal_2d:
None})
66 c = ROOT.TCanvas(
"distrdf003",
"distrdf003", 1600, 400)