allan-tools
Allantools (python lib) portage to Rust
This library allows easy computations of Allan deviation & similar statistics.
These statistical methods are mostly used in system stability studies.
Variances / Deviations
Compute Allan Deviation over raw data:
use *;
let taus = generator;
let = deviation.unwrap;
Improve statiscal confidence by using overlapped formulas
let taus = generator;
let = deviation.unwrap;
Compute Allan Deviation over a serie of fractionnal error
let taus = generator;
let = deviation.unwrap;
let = deviation.unwrap;
Tau offset and errors management
This library computes the requested deviation for all requested τ values, as long as it's feasible.
If τ(n) is not feasible (would require more input data), computations stops
and the previous valid deviations are returned (previous offsets).
If not a single τ value is feasible, the lib returns Error::NotEnoughSamplesError
let data = ;
assert_eq!;
If the user is passing a non valid τ axis, the lib returns an error raised by basic sanity checks
let my_x = ;
assert_eq!;
τ < 0 does not make sense
let my_x = ;
assert_eq!;
neither does τ = 0
let my_x = ;
assert_eq!;
the lib does not check for repeated τ offsets at the moment
Tau axis generation
A Tau axis generator is embedded, for ease of use. Several axis are built in:
- TauAxis::Octave is the most efficient
- TauAxis::Decade is the standard and is efficient
- TauAxis::All requires more computation but is accurate
let taus = generator; //log10
use TauAxis::All to compute the deviation for every single tau value.
let taus = generator;
Data & Noise generators
Some data generators were integrated or develpped for testing purposes:
- White noise generator produces scaled normal distribution
let psd = -140; // [dBcHz]
let fs = 10.0E6; // [Hz]
let x = white_noise; // 10k samples
- Pink noise generator produces a -10dB/dec shape when raw data is considered, or a -5dB/dec shape if we're considering fractionnal data
let psd = -140; // [dBcHz]
let fs = 10.0E6; // [Hz]
let a0_1hz = -10; // [dB] = level @ 1Hz
let x = pink_noise; // 1k samples
Tools & utilities
NIST Power Law identification method[[46]]
This is a useful macro to identify noise processes contained in a data serie.
In other words, this tells you how the data serie behaves.
let x = produce_some_data;
let exponents = nist_power_law_identifier;
One can use the optionnal "min_dist" attribute to customize the study
let x = produce_some_data; // 1k symbols
// default min_dist=10 -> 1k/10 exponents to be identified
let exponents = nist_power_law_identifier;
// 1k/100 exponents to be identified
let exponents = nist_power_law_identifier;
Cummulative sum (python::numpy like)
let data: = some_data;
cumsum;
cumsum; // opt. normalization
Derivative (python::numpy like)
let data: = some_data;
diff;
diff; // opt. normalization
Random generator: generates a pseudo random sequence 0 < x <= 1.0
let data = random; // 1k symbols
println!;
normalize : normalizes a sequence to 1/norm :
let data: = somedata;
let normalized = normalize; // 1/(2pi)
to_fractionnal_frequency : tool to convert a data serie
to a serie of fractionnal data.
Typical use is converting raw frequency measurements (Hz)
into fractionnal frequency (n.a):
let data: = somedata; // sampled @ 10kHz
let fract = to_fractionnal_frequency; // :)
fractionnal_integral : tool to integrate a serie of fractionnal data.
Typical use is converting fractionnal frequency measurements (n.a), to phase
time (s).
let data: = somedata; // (n.a)
let fract = fractionnal_integral; // sampled @ 1Hz :)
fractional_freq_to_phase_time : macro wrapper of previous function
phase_to_radians : macro to convert phase time (s) to phase radians (rad)
let data: = somedata; // (s)
let data_rad = phase_to_radians;