pub struct XAxis(/* private fields */);Expand description
The x axis of RealData and
ComplexData: time steps, frequency bins, or any
other strictly increasing positions.
A uniform axis stores only start, step and the length, and computes
values on demand. An explicit axis stores every value. Both kinds are
strictly increasing, which the constructors check.
Implementations§
Source§impl XAxis
impl XAxis
Sourcepub fn uniform(start: f64, step: f64, len: usize) -> Result<Self, DataError>
pub fn uniform(start: f64, step: f64, len: usize) -> Result<Self, DataError>
A uniform axis x[i] = start + i * step with len points.
start must be finite and step must be finite and positive.
Sourcepub fn explicit(values: Array1<f64>) -> Result<Self, DataError>
pub fn explicit(values: Array1<f64>) -> Result<Self, DataError>
An axis with the given values, which must be strictly increasing.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn as_uniform(&self) -> Option<(f64, f64)>
pub fn as_uniform(&self) -> Option<(f64, f64)>
Some((start, step)) if the axis is uniform.
pub fn iter(&self) -> impl ExactSizeIterator<Item = f64> + '_
Sourcepub fn to_cow_array(&self) -> CowArray<'_, f64, Ix1>
pub fn to_cow_array(&self) -> CowArray<'_, f64, Ix1>
The values as an array. Borrowed for an explicit axis, computed for a uniform one.
Sourcepub fn nearest_index(&self, x: f64) -> usize
pub fn nearest_index(&self, x: f64) -> usize
Index of the value closest to x. On a tie the lower index wins.
Returns 0 for an empty axis or a NaN x.
Trait Implementations§
Source§impl AbsDiffEq for XAxis
impl AbsDiffEq for XAxis
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.Source§impl<'de> Deserialize<'de> for XAxis
Available on crate feature serde only.Deserialized values go through the same checks as the constructors, so an
edited or corrupted file cannot produce an unordered axis.
impl<'de> Deserialize<'de> for XAxis
serde only.Deserialized values go through the same checks as the constructors, so an edited or corrupted file cannot produce an unordered axis.
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Auto Trait Implementations§
impl Freeze for XAxis
impl RefUnwindSafe for XAxis
impl Send for XAxis
impl Sync for XAxis
impl Unpin for XAxis
impl UnsafeUnpin for XAxis
impl UnwindSafe for XAxis
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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