pub struct Histogram { /* private fields */ }
Expand description
Histogram used as the basis for statistics counting in many quality control facets. For more in depth information, please see the module-level documentation.
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn zero_based_with_capacity(capacity: usize) -> Self
pub fn zero_based_with_capacity(capacity: usize) -> Self
Creates a zero-based histogram with a given capacity.
Sourcepub fn increment(&mut self, bin: usize) -> Result<(), BinOutOfBoundsError>
pub fn increment(&mut self, bin: usize) -> Result<(), BinOutOfBoundsError>
Increments a particular bin in the histogram by one.
Sourcepub fn increment_by(
&mut self,
bin: usize,
value: usize,
) -> Result<(), BinOutOfBoundsError>
pub fn increment_by( &mut self, bin: usize, value: usize, ) -> Result<(), BinOutOfBoundsError>
Increments a particular bin in the histogram by the specified value.
Sourcepub fn values_normalized(&self) -> Vec<f64>
pub fn values_normalized(&self) -> Vec<f64>
Normalizes the values so that they sum to one and returns them as a Vec.
Sourcepub fn range_start(&self) -> usize
pub fn range_start(&self) -> usize
Gives the starting position for the open range of the histogram.
Sourcepub fn range_stop(&self) -> usize
pub fn range_stop(&self) -> usize
Gives the stopping position for the open range of the histogram.
Sourcepub fn in_range(&self, value: usize) -> bool
pub fn in_range(&self, value: usize) -> bool
Indicates whether a particular value falls within the range of the histogram.
use ngs::utils::histogram::Histogram;
let mut hist = Histogram::zero_based_with_capacity(100);
assert!(hist.in_range(0));
assert!(hist.in_range(100));
assert!(!hist.in_range(101));
Sourcepub fn percentile(&self, percentile: f64) -> Result<Option<f64>>
pub fn percentile(&self, percentile: f64) -> Result<Option<f64>>
Computes the value of the nth percentile based on an exhaustive search.
Sourcepub fn first_quartile(&self) -> Option<f64>
pub fn first_quartile(&self) -> Option<f64>
Computes the first quartile of the distribution.
Sourcepub fn third_quartile(&self) -> Option<f64>
pub fn third_quartile(&self) -> Option<f64>
Computes the third quartile of the distribution.
Sourcepub fn interquartile_range(&self) -> Option<f64>
pub fn interquartile_range(&self) -> Option<f64>
Computes the interquartile range for this distribution.
Sourcepub fn count_from_bottom_until(&self, bin: usize) -> usize
pub fn count_from_bottom_until(&self, bin: usize) -> usize
Counts from the bottom of the histogram up until a certain bin.
Sourcepub fn count_from_top_until(&self, bin: usize) -> usize
pub fn count_from_top_until(&self, bin: usize) -> usize
Counts from the top of the histogram down until a certain bin.
More accurately, we technically walk from the specified bin up to the top of the histogram, but this provides the same results.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Histogram
impl<'de> Deserialize<'de> for Histogram
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more