Skip to main content

AllanVarianceEstimator

Struct AllanVarianceEstimator 

Source
pub struct AllanVarianceEstimator<const N: usize> { /* private fields */ }
Expand description

Rolling Allan variance estimator.

Maintains a circular buffer of N phase/norm samples and computes σ_y(τ) for each of the ALLAN_TAUS averaging intervals using the overlapping Allan variance formula:

σ²_y(τ) = 1 / (2τ²(N-2τ)) · Σ_{k=1}^{N-2τ} [x(k+2τ) - 2x(k+τ) + x(k)]²

§Type Parameters

  • N: Buffer capacity (≥ 256 recommended for τ=128 support; 512 is ideal).

Implementations§

Source§

impl<const N: usize> AllanVarianceEstimator<N>

Source

pub const fn new() -> Self

Create a new estimator with empty buffer.

Source

pub fn push(&mut self, sample: f32)

Absorb one sample (residual norm or phase increment).

Source

pub fn len(&self) -> usize

Number of valid samples.

Source

pub fn is_ready(&self) -> bool

Whether enough samples are available for fingerprint computation. Requires count ≥ 2 * max_tau + 1 = 257 for τ_max = 128.

Source

pub fn allan_deviation(&self, tau: u32) -> f32

Compute Allan deviation σ_y(τ) for averaging time τ (in samples).

Uses overlapping samples for N_eff = count − 2τ averages. Returns 0.0 if count < 2τ + 1.

Source

pub fn fingerprint(&self) -> Option<[f32; 8]>

Compute the 8-element Allan deviation fingerprint.

Returns None if is_ready() is false.

Source

pub fn reset(&mut self)

Reset the buffer.

Trait Implementations§

Source§

impl<const N: usize> Default for AllanVarianceEstimator<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.