Skip to content

Commit

Permalink
Update doc, add asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
dhellfeld committed Jul 21, 2021
1 parent 34bdf4a commit 02a1eec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion becquerel/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ def sqrt_bins(bin_edge_min, bin_edge_max, nbins):
Square root binning
Args:
bin_edge_min (float): Minimum bin edge (must be greater than 0)
bin_edge_min (float): Minimum bin edge (must be >= 0)
bin_edge_max (float): Maximum bin edge (must be greater than bin_min)
nbins (int): Number of bins
Returns:
np.array of bin edges (length = nbins + 1)
"""
assert bin_edge_min >= 0
assert bin_edge_max > bin_edge_min
return np.linspace(np.sqrt(bin_edge_min), np.sqrt(bin_edge_max), nbins + 1) ** 2

0 comments on commit 02a1eec

Please sign in to comment.