[−][src]Struct ndhistogram::axis::Variable
An axis with variable sized bins.
An axis with variable sized bins. Constructed with a list of bin edges. Beyond the lowest (highest) bin edges is an underflow (overflow) bin. Hence this axis has num edges + 1 bins.
Example
Create a 1D histogram with 3 variable width bin 0.0 and 7.0, plus overflow and underflow bins.
use ndhistogram::{ndhistogram, Histogram}; use ndhistogram::axis::{Axis, Variable, BinInterval}; let mut hist = ndhistogram!(Variable::new(vec![0.0, 1.0, 3.0, 7.0]); i32); hist.fill(&0.0); hist.fill(&1.0); hist.fill(&2.0); assert_eq!( hist.values().copied().collect::<Vec<_>>(), vec![0, 1, 2, 0, 0], );
Implementations
impl<T> Variable<T> where
T: PartialOrd + Copy,
[src]
T: PartialOrd + Copy,
pub fn new<I: IntoIterator<Item = T>>(bin_edges: I) -> Self
[src]
Factory method to create an axis with Variable binning given a set of bin edges.
Panics
Panics if errors less than 2 edges are provided or if it fails to sort the bin edges (for example if a NAN value is given).
pub fn low(&self) -> &T
[src]
Low edge of axis (excluding underflow bin).
pub fn high(&self) -> &T
[src]
High edge of axis (excluding overflow bin).
Trait Implementations
impl<T> Axis for Variable<T> where
T: PartialOrd + Copy,
[src]
T: PartialOrd + Copy,
type Coordinate = T
The type representing a location on this axis.
type BinInterval = BinInterval<T>
The type of an interval representing the set of Coordinates that correspond to a histogram bin
pub fn index(&self, coordinate: &Self::Coordinate) -> Option<usize>
[src]
pub fn numbins(&self) -> usize
[src]
pub fn bin(&self, index: usize) -> Option<Self::BinInterval>
[src]
pub fn indices(&self) -> Box<dyn Iterator<Item = usize>>
[src]
pub fn iter(&self) -> Box<dyn Iterator<Item = (usize, Self::BinInterval)> + '_>
[src]
pub fn bins(&self) -> Box<dyn Iterator<Item = Self::BinInterval> + '_>
[src]
impl<T: Clone> Clone for Variable<T>
[src]
impl<T: Debug> Debug for Variable<T>
[src]
impl<T: Display + PartialOrd + Copy> Display for Variable<T>
[src]
impl<T: Eq> Eq for Variable<T>
[src]
impl<'a, T> IntoIterator for &'a Variable<T> where
Variable<T>: Axis,
[src]
Variable<T>: Axis,
type Item = (usize, <Variable<T> as Axis>::BinInterval)
The type of the elements being iterated over.
type IntoIter = Box<dyn Iterator<Item = Self::Item> + 'a>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<T: PartialEq> PartialEq<Variable<T>> for Variable<T>
[src]
pub fn eq(&self, other: &Variable<T>) -> bool
[src]
pub fn ne(&self, other: &Variable<T>) -> bool
[src]
impl<T> StructuralEq for Variable<T>
[src]
impl<T> StructuralPartialEq for Variable<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Variable<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Variable<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Variable<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Variable<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Variable<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,