Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
fixed #24: index methods should simply be dropped from TH1 and TH2
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Jan 4, 2019
1 parent 3d26831 commit 2558298
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
10 changes: 0 additions & 10 deletions uproot_methods/classes/TH1.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,6 @@ def interval(self, index):
norm = (high - low) / self._fXaxis._fNbins
return (index - 1)*norm + low, index*norm + low

def index(self, data):
low = self._fXaxis._fXmin
high = self._fXaxis._fXmax
if data < low:
return 0
elif data >= high:
return len(self) - 1
elif not math.isnan(data):
return int(math.floor(self._fXaxis._fNbins * (data - low) / (high - low))) + 1

@property
def xlabels(self):
if getattr(self._fXaxis, "_fLabels", None) is None:
Expand Down
26 changes: 0 additions & 26 deletions uproot_methods/classes/TH2.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,32 +216,6 @@ def xinterval(self, index):
def yinterval(self, index):
return self.interval(index, "y")

def index(self, data, axis):
if axis == "x":
ind = 0
nbins = self.xnumbins
elif axis == "y":
ind = 1
nbins = self.ynumbins
else:
raise TypeError("Axis must be either 'x' or 'y' to obtain an index.")

low = self.low[ind]
high = self.high[ind]

if data < low:
return 0
elif data >= high:
return nbins+1
elif not math.isnan(data):
return int(math.floor(nbins*(data-low) / (high-low))) + 1

def xindex(self, data):
return self.index(data, "x")

def yindex(self, data):
return self.index(data, "y")

@property
def ylabels(self):
if self._fYaxis._fLabels is None:
Expand Down

0 comments on commit 2558298

Please sign in to comment.