Search code examples
uproot

Model_TH3D_v3 on uproot4


I am trying to import a TH3 v3 file from .root, but I get the following error message:

----> 3 a=fileRCL[filename].to_numpy()

~/anaconda3/lib/python3.8/site-packages/uproot/behaviors/TH3.py in to_numpy(self, flow, dd)
    100         """
    101         values = self.values(flow=flow)
--> 102         xedges = self.edges(0)
    103         yedges = self.edges(1)
    104         zedges = self.edges(2)

AttributeError: 'Model_TH3D_v3' object has no attribute 'edges'

As you can see, the object is accessible from root browser and has the edges.

original file

Any idea? uproot4 Ubuntu 20.04 vscode insider 1.52 conda 4.9.2 python 3.9


Solution

  • This is a bug, caused by interface changes needed to adopt to Scikit-HEP's unified histogram protocol while not explicitly testing TH3 (3-dimensional histograms) because I didn't have any examples in scikit-hep-testdata.

    Can you confirm that scikit-hep/uproot4#239 fixes your issue? Thanks!