18from dask.distributed
import LocalCluster, Client
22LiveVisualize = ROOT.RDF.Experimental.Distributed.LiveVisualize
25RDataFrame = ROOT.RDF.Experimental.Distributed.Dask.RDataFrame
28def create_connection():
29 cluster = LocalCluster(n_workers=4, threads_per_worker=1, processes=
True, memory_limit=
"2GiB")
30 client = Client(cluster)
37if __name__ ==
"__main__":
39 connection = create_connection()
42 num_entries = 100000000
43 d = RDataFrame(num_entries, daskclient=connection, npartitions=30)
46 dd = d.Define(
"x", f
"gRandom->Gaus(10*rdfentry_/{num_entries}, 2)")\
47 .Define(
"y", f
"gRandom->Gaus(10*rdfentry_/{num_entries}, 3)")\
50 h_normal_1d = dd.Histo1D((
"normal_1d",
"1D Histogram of a Normal Distribution",
54 h_normal_2d = dd.Histo2D((
"normal_2d",
"2D Histogram of a Normal Distribution",
63 LiveVisualize({h_normal_1d: fit_gaus, h_normal_2d:
None})
66 c = ROOT.TCanvas(
"distrdf003",
"distrdf003", 1600, 400)