histogram

Function histogram 

Source
pub fn histogram<T: AsRef<[f64]>>(
    values: T,
    bins: usize,
    range: (f64, f64),
    weights: Option<T>,
) -> Histogram
Expand description

A method which creates a histogram from some data by binning it with evenly spaced bins within the given range

ยงExamples

use laddu_core::utils::histogram;

let values = vec![0.1, 0.4, 0.8];
let weights: Option<&[f64]> = None;
let hist = histogram(values.as_slice(), 2, (0.0, 1.0), weights);
assert_eq!(hist.counts, vec![2.0, 1.0]);
assert_eq!(hist.bin_edges, vec![0.0, 0.5, 1.0]);