RDataFrame Snapshot PyRoot Options

Dear ROOT Developers,

I am using RDataFrame Snapshot with PyRoot. I would like to execute the snapshot lazily. I know that one can do this in C++ using the RSnapshotOption fLazy. Can I do this with PyRoot, too? I would like to export all available columns.

Cheers,
Ben


_ROOT Version: 6.14.08


Yes, you should be able to. Please try it and let us know if you have a problem with it. Cheers,

Hi amadio,

thank you for your answer. So how could I do this?

df.Snapshot(tree,file,"all",fLazy)

Hello again,

I guess this should work?

from ROOT import RDataFrame
import ROOT

rdf = RDataFrame("myTree", "myFile")

#define snapshot options
snapshotOptions = ROOT.RDF.RSnapshotOptions()
snapshotOptions.fLazy = True #only setting fLazy here, for other options see https://root.cern/doc/master/structROOT_1_1RDF_1_1RSnapshotOptions.html
rdf.Snapshot("outputTree", "newFile", "", snapshotOptions) #the "" in the output columns means, output all

Yes, the second version should work.

Thank you amadio! I tested it and it seems to work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.