Skip to content

Commit bde4f87

Browse files
committed
Fix divide by zero RuntimeWarning in binning
This only happened with a single bin at position 0, as done by the unit tests for PR #268 ("Correction to M-test with resampling, and addition of new MLL test"), which revealed this RuntimeWarning.
1 parent f5ff69d commit bde4f87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

csep/utils/calc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def bin1d_vec(p, bins, tol=None, right_continuous=False):
9898
if bins.size == 1:
9999
# for a single bin, set `right_continuous` to true; h is now arbitrary
100100
right_continuous = True
101-
h = bins[0] # (just take over dtype)
101+
h = 1.
102102
else:
103103
h = bins[1] - bins[0]
104104

0 commit comments

Comments
 (0)