Function get_bin_index
Source pub fn get_bin_index(
value: f64,
bins: usize,
range: (f64, f64),
) -> Option<usize>
Expand description
A helper method to obtain the index of a bin where a value should go in a histogram with evenly
spaced bins over a given range
§See Also
Histogram
get_bin_edges
§Examples
use laddu_core::utils::get_bin_index;
assert_eq!(get_bin_index(0.25, 4, (0.0, 1.0)), Some(1));
assert_eq!(get_bin_index(1.5, 4, (0.0, 1.0)), None);