pub struct UniformNoFlow<T = f64> { /* private fields */ }
Expand description
An axis with equal sized bins and no under/overflow bins.
An axis with N equally spaced, equal sized, bins between [low, high). Similar to Uniform but this axis has no over/underflow bins. Hence it has N bins.
For floating point types, infinities and NaN do not map to any bin.
§Example
Create a 1D histogram with 10 uniformly spaced bins between -5.0 and 5.0.
use ndhistogram::{ndhistogram, Histogram};
use ndhistogram::axis::{Axis, UniformNoFlow, BinInterval};
let hist = ndhistogram!(UniformNoFlow::new(10, -5.0, 5.0)?);
let axis = &hist.axes().as_tuple().0;
assert_eq!(axis.bin(0), Some(BinInterval::new(-5.0, -4.0)));
assert_eq!(axis.bin(10), None);
Implementations§
Source§impl<T> UniformNoFlow<T>
impl<T> UniformNoFlow<T>
Sourcepub fn new(num: usize, low: T, high: T) -> Result<Self, AxisError>where
T: Float,
pub fn new(num: usize, low: T, high: T) -> Result<Self, AxisError>where
T: Float,
Factory method to create an axis with num uniformly spaced bins in the range [low, high) with no under/overflow bins.
The parameters have the same constraints as Uniform::new, otherwise an error is returned.
Sourcepub fn with_step_size(num: usize, low: T, step: T) -> Result<Self, AxisError>where
T: Num,
pub fn with_step_size(num: usize, low: T, step: T) -> Result<Self, AxisError>where
T: Num,
Factory method to create an axis with num uniformly spaced bins in the range [low, low+num*step) with no under/overflow bins.
The parameters have the same constraints as Uniform::with_step_size, otherwise an error is returned.
Trait Implementations§
Source§impl<T> Axis for UniformNoFlow<T>
impl<T> Axis for UniformNoFlow<T>
Source§type Coordinate = T
type Coordinate = T
Source§type BinInterval = BinInterval<T>
type BinInterval = BinInterval<T>
Source§fn index(&self, coordinate: &Self::Coordinate) -> Option<usize>
fn index(&self, coordinate: &Self::Coordinate) -> Option<usize>
Source§fn num_bins(&self) -> usize
fn num_bins(&self) -> usize
Source§fn bin(&self, index: usize) -> Option<Self::BinInterval>
fn bin(&self, index: usize) -> Option<Self::BinInterval>
Source§fn iter(&self) -> Box<dyn Iterator<Item = (usize, Self::BinInterval)> + '_>
fn iter(&self) -> Box<dyn Iterator<Item = (usize, Self::BinInterval)> + '_>
Source§impl<T: Clone> Clone for UniformNoFlow<T>
impl<T: Clone> Clone for UniformNoFlow<T>
Source§fn clone(&self) -> UniformNoFlow<T>
fn clone(&self) -> UniformNoFlow<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more