Skip to main content

Crate allan

Crate allan 

Source
Expand description

Allan provides variance and deviation tools for stability analysis

§Goals

  • provide streaming variance and deviations from series data
  • pre-allocated datastructures
  • support for gaps in data using NaN markers

§Usage

Create a new instance, add records, retrieve statistic

§Gap Handling

This implementation supports gaps in time-series data by using NaN as a gap marker. When a gap is encountered (marked by recording f64::NAN), calculations that would span the gap are automatically excluded from the variance computation, ensuring accurate results even with incomplete data.

By default samples are treated as phase (time-error) data. To analyze frequency data, set .data_type(DataType::Frequency) on the builder — samples are integrated to phase internally, yielding the frequency-domain Allan deviation in the input’s units (white noise → slope -1/2). Note: in Frequency mode the internal phase accumulator is the running sum of all inputs (a NaN gap omits one increment but keeps the integral continuous — it is not reset, which would inflate σ at τ≥2). This matches the phase-domain path and is fine for normal inputs.

§Example

Create a new instance, add a few records, retrieve allan deviation


use allan::*;

// Allan variance/deviation
let mut allan = Allan::new();
for _ in 0..100 {
    allan.record(1.0);
}
assert_eq!(allan.get(1).unwrap().deviation().unwrap(), 0.0);

// Hadamard variance/deviation (separate calculation)
let mut hadamard = Hadamard::new();
for _ in 0..100 {
    hadamard.record(1.0);
}
assert_eq!(hadamard.get(1).unwrap().deviation().unwrap(), 0.0);

// Modified Allan variance/deviation (separate calculation)
let mut modified = ModifiedAllan::new();
for _ in 0..100 {
    modified.record(1.0);
}
assert_eq!(modified.get(1).unwrap().deviation().unwrap(), 0.0);

Structs§

Allan
Allan variance calculation
Config
used to configure an Allan or Hadamard
Hadamard
Hadamard variance calculation
ModifiedAllan
Modified Allan variance calculation
Tau
Result of a tau calculation with computed variance and deviation

Enums§

DataType
Whether recorded samples are phase (time-error) data or frequency data. Frequency data is integrated to phase on input so the phase-domain estimator yields the frequency-domain result.
Mode
Calculation mode - cumulative or sliding window
Style
describes the gaps between Tau and impacts space and computational costs