_ROOT Version:6.18/00
Platform: x86_64-centos7-gcc8-opt
Compiler: gcc8
Dear all,
Here is a minimal non working example of the issue:
In [3]: h1 = np.array([1,2,3])
In [4]: h2 = np.array([4,5,6])
In [5]: from array import array
In [6]: h = r.TH2D(“h”, “h”, len(h1) -1, array(‘d’, h1), len(h2) -1, array(‘d’, h2))
In [7]: h.Draw()
In [8]: h.GetBinContent(10)
Out[8]: 0.0
As you can see, the TH2 is empty.
This little test was done using Python 2.7.16
This used to work in previous ROOT versions. It was even possible to build the TH2 using numpy arrays (without transforming them to C-like arrays).
If I try to use plain numpy arrays:
In [5]: h1 = np.array([1,2,3,4])
In [6]: h2 = np.array([10,20,30,40])
In [7]: h = r.TH2D(“h”, “h”, len(h1) -1, h1, len(h2) -1, h2)
In [8]: h.Draw()
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
In [9]: Error in TCanvas::Range: illegal world coordinates range: x1=0.000000, y1=0.000000, x2=0.000000, y2=0.000000
Error in TCanvas::RangeAxis: illegal axis coordinates range: xmin=0.000000, ymin=0.000000, xmax=0.000000, ymax=0.000000`
Thx,
Fabrice