Open gipert opened 3 years ago
I cannot read histograms from this ROOT file. I think it's a floating point arithmetic issue.
julia> using UpROOT julia> UpROOT.TFile("histos.root")["h_comp_roi"] ERROR: Histogram edge vectors must be 1 longer than corresponding weight dimensions Stacktrace: [1] error(s::String) @ Base ./error.jl:33 [2] Histogram @ ~/.julia/packages/StatsBase/DU1bT/src/hist.jl:193 [inlined] [3] Histogram (repeats 2 times) @ ~/.julia/packages/StatsBase/DU1bT/src/hist.jl:199 [inlined] [4] roothist2jl(x::PyCall.PyObject) @ UpROOT ~/.julia/packages/UpROOT/YRyC3/src/pyjlconv.jl:58 [5] py2jl(x::PyCall.PyObject) @ UpROOT ~/.julia/packages/UpROOT/YRyC3/src/pyjlconv.jl:78 [6] getindex(tdir::TDirectory, objname::String) @ UpROOT ~/.julia/packages/UpROOT/YRyC3/src/tdirectory.jl:33 [7] top-level scope @ REPL[8]:1
The right edges in the original histograms are 0:0.2:100, but the reconstructed range is 0.0:0.20000000000000004:99.80000000000003, which explains the error.
0:0.2:100
0.0:0.20000000000000004:99.80000000000003
If I remove this if ... else here:
if ... else
https://github.com/JuliaHEP/UpROOT.jl/blob/master/src/pyjlconv.jl#L45-L47
and just return edge, everything works as expected. Why trying to convert the histogram edges to a range object? Is there a performance gain?
edge
I cannot read histograms from this ROOT file. I think it's a floating point arithmetic issue.
The right edges in the original histograms are
0:0.2:100
, but the reconstructed range is0.0:0.20000000000000004:99.80000000000003
, which explains the error.If I remove this
if ... else
here:https://github.com/JuliaHEP/UpROOT.jl/blob/master/src/pyjlconv.jl#L45-L47
and just return
edge
, everything works as expected. Why trying to convert the histogram edges to a range object? Is there a performance gain?