Hi! I encountered an issue when running the BumpHunter with multiple channels:
When calling the plot_bump method of the BumpHunter1D class, in line 1680, the index of the channel is missing from the self.bins attribute, which is used to build the histogram :
H = np.histogram(data[chan], bins=self.bins, range=self.rang)
This results in ValueError's. I leave the error message for reference:
File "/afs/cern.ch/user/f/fsili/.local/lib/python3.10/site-packages/pyBumpHunter/bumphunter_1dim.py", line 1680, in plot_bump
H = np.histogram(data[chan], bins=self.bins, range=self.rang)
File "<__array_function__ internals>", line 180, in histogram
File "/cvmfs/atlas.cern.ch/repo/sw/software/0.4/StatAnalysis/0.4.0/InstallArea/x86_64-el9-gcc13-opt/lib/python3.10/site-packages/numpy-1.23.5-py3.10-linux-x86_64.egg/numpy/lib/histograms.py", line 793, in histogram
bin_edges, uniform_bins = _get_bin_edges(a, bins, range, weights)
File "/cvmfs/atlas.cern.ch/repo/sw/software/0.4/StatAnalysis/0.4.0/InstallArea/x86_64-el9-gcc13-opt/lib/python3.10/site-packages/numpy-1.23.5-py3.10-linux-x86_64.egg/numpy/lib/histograms.py", line 430, in _get_bin_edges
if np.any(bin_edges[:-1] > bin_edges[1:]):
ValueError: operands could not be broadcast together with shapes (85,) (119,)
I believe this could be fixed by changing:
H = np.histogram(data[chan], bins=self.bins, range=self.rang)
to
H = np.histogram(data[chan], bins=self.bins[chan], range=self.rang)
Hi! I encountered an issue when running the BumpHunter with multiple channels:
When calling the
plot_bump
method of theBumpHunter1D
class, in line 1680, the index of the channel is missing from theself.bins
attribute, which is used to build the histogram :H = np.histogram(data[chan], bins=self.bins, range=self.rang)
This results inValueError
's. I leave the error message for reference:I believe this could be fixed by changing:
to
Thanks a lot! Cheers!