scikit-hep / aghast

Aghast: aggregated, histogram-like statistics, sharable as Flatbuffers.
BSD 3-Clause "New" or "Revised" License
17 stars 8 forks source link

implement getbincontents for TArrays #24

Closed jpivarski closed 5 years ago

jpivarski commented 5 years ago

For issue #23.

@kreczko Let me know if this works! (I haven't tested your case, just a generic TArrayD.)

kreczko commented 5 years ago

Looks good (once #22 is applied, of course ;) )! Thank you!

a = aghast.from_root(proX) # works now
a.dump()
Histogram(
  axis=[
    Axis(
      binning=
        EdgesBinning(
          edges=[0 10 15 20 30 999],
          overflow=RealOverflow(loc_underflow=BinLocation.below1, loc_overflow=BinLocation.above1)),
      statistics=[
        Statistics(
          moments=[
            Moments(sumwxn=InterpretedInlineInt64Buffer(buffer=[10]), n=0),
            Moments(sumwxn=InterpretedInlineFloat64Buffer(buffer=[10]), n=0, weightpower=1),
            Moments(sumwxn=InterpretedInlineFloat64Buffer(buffer=[10]), n=0, weightpower=2),
            Moments(sumwxn=InterpretedInlineFloat64Buffer(buffer=[272]), n=1, weightpower=1),
            Moments(sumwxn=InterpretedInlineFloat64Buffer(buffer=[7544]), n=2, weightpower=1)
          ])
      ])
  ],
  counts=
    WeightedCounts(
      sumw=InterpretedInlineFloat64Buffer(buffer=[0 0 0 0 5 5 0]),
      sumw2=InterpretedInlineFloat64Buffer(buffer=[0 0 0 0 5 5 0])))