Skip to content

Commit

Permalink
Catch up to the latest histogram protocol. (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski authored Dec 5, 2020
1 parent 2aef482 commit 63c4cb5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
12 changes: 4 additions & 8 deletions uproot/behaviors/TH1.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ def weighted(self):
raise NotImplementedError(repr(self))

@property
def interpretation(self):
def kind(self):
"""
How to interpret ``values``: ``"count"`` for histograms and ``"mean"``
for profiles.
The meaning of this object: ``"COUNT"`` for true histograms (TH*) and
``"MEAN"`` for profile plots (TProfile*).
"""
raise NotImplementedError(repr(self))
raise "COUNT"

def values(self, flow=False):
"""
Expand Down Expand Up @@ -216,10 +216,6 @@ def weighted(self):
sumw2 = self.member("fSumw2", none_if_missing=True)
return sumw2 is not None and len(sumw2) == self.member("fNcells")

@property
def interpretation(self):
return "count"

def values(self, flow=False):
if hasattr(self, "_values"):
values = self._values
Expand Down
4 changes: 0 additions & 4 deletions uproot/behaviors/TH2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def weighted(self):
sumw2 = self.member("fSumw2", none_if_missing=True)
return sumw2 is not None and len(sumw2) == self.member("fNcells")

@property
def interpretation(self):
return "count"

def values(self, flow=False):
if hasattr(self, "_values"):
values = self._values
Expand Down
4 changes: 0 additions & 4 deletions uproot/behaviors/TH3.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ def weighted(self):
sumw2 = self.member("fSumw2", none_if_missing=True)
return sumw2 is not None and len(sumw2) == self.member("fNcells")

@property
def interpretation(self):
return "count"

def values(self, flow=False):
if hasattr(self, "_values"):
values = self._values
Expand Down
8 changes: 4 additions & 4 deletions uproot/behaviors/TProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ class Profile(uproot.behaviors.TH1.Histogram):
Abstract class for profile plots.
"""

@property
def kind(self):
return "MEAN"

def counts(self, flow=False):
"""
Args:
Expand Down Expand Up @@ -236,10 +240,6 @@ def weighted(self):
fBinSumw2 = self.member("fBinSumw2", none_if_missing=True)
return fBinSumw2 is None or len(fBinSumw2) != len(self.member("fNcells"))

@property
def interpretation(self):
return "mean"

def counts(self, flow=True):
out = _effective_counts_1d(
self.member("fBinEntries"),
Expand Down
4 changes: 0 additions & 4 deletions uproot/behaviors/TProfile2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ def weighted(self):
fBinSumw2 = self.member("fBinSumw2", none_if_missing=True)
return fBinSumw2 is None or len(fBinSumw2) != len(self.member("fNcells"))

@property
def interpretation(self):
return "mean"

def counts(self, flow=False):
fBinEntries = numpy.asarray(self.member("fBinEntries"))
out = uproot.behaviors.TProfile._effective_counts_1d(
Expand Down
4 changes: 0 additions & 4 deletions uproot/behaviors/TProfile3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def weighted(self):
fBinSumw2 = self.member("fBinSumw2", none_if_missing=True)
return fBinSumw2 is None or len(fBinSumw2) != len(self.member("fNcells"))

@property
def interpretation(self):
return "mean"

def counts(self, flow=False):
fBinEntries = numpy.asarray(self.member("fBinEntries"))
out = uproot.behaviors.TProfile._effective_counts_1d(
Expand Down

0 comments on commit 63c4cb5

Please sign in to comment.