[][src]Struct pineappl::bin::BinLimits

pub struct BinLimits(_);

Structure representing bin limits.

Implementations

impl BinLimits[src]

#[must_use]pub fn new(limits: Vec<f64>) -> Self[src]

Constructor for BinLimits.

#[must_use]pub fn bins(&self) -> usize[src]

Returns the number of bins.

#[must_use]pub fn index(&self, value: f64) -> Option<usize>[src]

Returns the bin index for observable value. If the value over- or underflows, the return value is None.

#[must_use]pub fn left(&self) -> f64[src]

Returns the left-most bin limit

#[must_use]pub fn limits(&self) -> Vec<f64>[src]

Returns the limits in a Vec.

Examples

use pineappl::bin::BinLimits;

// example with equally sized bins
let equal_bins = BinLimits::new(vec![0.25, 0.5, 0.75, 1.0]);
assert_eq!(equal_bins.limits(), vec![0.25, 0.5, 0.75, 1.0]);

// example with unequally sized bins
let unequal_bins = BinLimits::new(vec![0.125, 0.25, 1.0, 1.5]);
assert_eq!(unequal_bins.limits(), vec![0.125, 0.25, 1.0, 1.5]);

#[must_use]pub fn bin_sizes(&self) -> Vec<f64>[src]

Returns the size for each bin.

Examples

use pineappl::bin::BinLimits;

// example with equally sized bins
let equal_bins = BinLimits::new(vec![0.25, 0.5, 0.75, 1.0]);
assert_eq!(equal_bins.bin_sizes(), vec![0.25, 0.25, 0.25]);

// example with unequally sized bins
let unequal_bins = BinLimits::new(vec![0.125, 0.25, 1.0, 1.5]);
assert_eq!(unequal_bins.bin_sizes(), vec![0.125, 0.75, 0.5]);

pub fn merge(&mut self, other: &Self) -> Result<(), MergeBinError>[src]

Merge the limits of other into self on the right-hand-side. If both limits are non-consecutive, an error is returned.

Errors

If the right-most limit of self is different from the left-most limit of other, the bins are non-consecutive and an error is returned.

#[must_use]pub fn right(&self) -> f64[src]

Returns the right-most bin limit

Trait Implementations

impl<'de> Deserialize<'de> for BinLimits[src]

impl PartialEq<BinLimits> for BinLimits[src]

impl Serialize for BinLimits[src]

impl StructuralPartialEq for BinLimits[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.