Skip to content

Commit fb817bf

Browse files
committed
backport latest kind fix (rebasing)
1 parent 6619eba commit fb817bf

File tree

1 file changed

+5
-2
lines changed
  • bindings/pyroot/pythonizations/python/ROOT/_pythonization/_uhi

1 file changed

+5
-2
lines changed

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_uhi/plotting.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ def _hasWeights(hist: Any) -> bool:
112112
def _axes(self) -> Tuple[Union[PlottableAxisContinuous, PlottableAxisDiscrete], ...]:
113113
return tuple(PlottableAxisFactory.create(_get_axis(self, i)) for i in range(self.GetDimension()))
114114

115-
# TODO this is not correct?
116115
def _kind(self) -> Kind:
117-
return Kind.COUNT if not _hasWeights(self) else Kind.MEAN
116+
# TProfile -> MEAN, everything else -> COUNT
117+
if self.__class__.__name__.startswith("TProfile"):
118+
return Kind.MEAN
119+
return Kind.COUNT
118120

119121

120122
def _shape(hist: Any, include_flow_bins: bool = True) -> Tuple[int, ...]:
@@ -129,6 +131,7 @@ def _values_default(self) -> np.typing.NDArray[Any]: # noqa: F821
129131
return ret.reshape(_shape(self), order="F")[tuple([slice(1, -1)] * len(_shape(self)))]
130132

131133

134+
# Special case for TH*C and TProfile*
132135
def _values_by_copy(self, include_flow_bins=False) -> np.typing.NDArray[Any]: # noqa: F821
133136
from itertools import product
134137

0 commit comments

Comments
 (0)