pub struct Histogram { /* private fields */ }Expand description
The histogram will take incoming data, place it into discrete bins, and count the hits in each bin The bin_labels are labeled by the minimum boundary of the bin e.g. bin_value = 1, with a bin width of 1, corresponds to hits in the interval [1,2).
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn new(bin_min: f64, bin_max: f64, n_bins: usize) -> Self
pub fn new(bin_min: f64, bin_max: f64, n_bins: usize) -> Self
Creates a new histogram that spans [bin_min, bin_max] with n_bins equal bins.
The bin labels are the lower edges, bin_min + i · width; bin_max itself is counted in the
last bin.
Sourcepub fn count(&mut self, value: f64) -> Result<(), ErrorsJSL>
pub fn count(&mut self, value: f64) -> Result<(), ErrorsJSL>
Find the bin of the value and increment the count Will fail if the sample exceeds the bin_min and bin_max
Sourcepub fn get_bin_labels(&self) -> &Vec<f64>
pub fn get_bin_labels(&self) -> &Vec<f64>
Getters
Sourcepub fn get_counts_raw(&self) -> &Vec<usize>
pub fn get_counts_raw(&self) -> &Vec<usize>
Get counts without dividing by total
Sourcepub fn get_counts_normalized(&self) -> Result<Vec<f64>, ErrorsJSL>
pub fn get_counts_normalized(&self) -> Result<Vec<f64>, ErrorsJSL>
Get counts after dividing by total. Will fail if total = 0;
Sourcepub fn get_bin_width(&self) -> f64
pub fn get_bin_width(&self) -> f64
Get the bin width
Sourcepub fn get_counts_raw_paired(&self) -> Vec<(f64, usize)>
pub fn get_counts_raw_paired(&self) -> Vec<(f64, usize)>
These functions return vectors of tuples (bin_label,count) In either raw or normalized format
pub fn get_counts_normalized_paired(&self) -> Result<Vec<(f64, f64)>, ErrorsJSL>
Auto Trait Implementations§
impl Freeze for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnsafeUnpin for Histogram
impl UnwindSafe for Histogram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more