Replies: 1 comment 1 reply
-
I see that you want to make a ROOT TH1F from a NumPy array, but don't want to have to write it to a file to do so. (It's not just about simplicity; it's about the fact that disk is orders of magnitude slower than RAM.) The function that is called to create an Uproot TH1F object is uproot.writing.identify.to_TH1x. It has a lot of arguments, so that the TH1F can be fully specified (ROOT histograms have a lot of metadata). Note that you can use the uproot.writing.identify.to_TAxis function to make the That function has a lot of arguments, though. The function that is called to turn anything that you're assigning into a file is uproot.writing.identify.to_writable. Since h1f11 = uproot.to_pyroot(uproot.writing.identify.to_writable(hist11)) While I'm at it, though, I should point out that hist histograms have plotting capabilities in the Matplotlib world, in case you're open to either Matplotlib or ROOT Canvases. It's hard to mix those two worlds, but if you didn't know about hist plotting and the rest of your analysis plotting is in Matplotlib, you should know that this is an option. Since this isn't really a request for a new feature—the functions you specifically asked about exist—I'm going to turn this into a Discussion, so that it serves as a "how to" document. |
Beta Was this translation helpful? Give feedback.
-
Here's my code.
I want to make the code from
# start
to# end
simpler, is there any functional interface for this? I didn't find it.Beta Was this translation helpful? Give feedback.
All reactions