0.1.0-beta.8 • Published 4 years ago

allan v0.1.0-beta.8

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Javascript Allan variance library

:warning: This is a beta vesion. Some changes in naming and structure still possible.

1. Theory & formulas

Allan variance is a beautiful instrument for the stability analysis of the signal measurements. This instrument is widely used in various fields, like: time-keeping, oscillators, gyroscopes, accelerometers and others.

The Allan variance equation 1, 2:

where is the observation period, is the nth fractional frequency average over the observation time .

The estimator value for non-overlapped Allan function 2:

The estimator value for overlapped Allan function 2:

The estimator values for modified Allan function 2:

Calculation simplified in code to single-loop.

There are libraries for other languages: python 3, matlab 4.

2. Installation

You can install it through npm

npm install allan

or through yarn

yarn add allan

2. Library Use

For now the library has the following functions:

  • allanDev - calculates Standard Allan deviation;
  • overAllanDev - calculates Overlapped Allan deviation;
  • modAllanDev - calculates Modified Allan deviation.

All these functions have the same structure of the arguments and the same structure of the output object.

Example of the Allan deviation function

function allanDev(data, data_type?, rate?, tau_data?)

The description of the function arguments:

ArgumentTypeDefaultDescription
dataArray\Array of data samples
data_typeString 'freq' or 'phase''freq'Type of data samples: 'freq' (frequency data) or 'phase' (phase data)
rateNumber1Data samples rate
tau_dataNumber or Array\100Number of taus for which you want to count Allan deviation (will be logarithmically spaced) or the array of integers (number of values sampled) for which you want to count Allan deviation, for example 1, 2, 4, 8, 16, 32, ...

Structure of the output object:

{ 
  tau: Array<Number>, 
  dev: Array<Number> 
}
ArgumentTypeDescription
tauArray\Array of the tau values
devArray\Array of the deviation values for the corresponding tau

References

  1. D. W. Allan. Statistics of Atomic Frequency Standards // Proceedings of the IEEE, 1966, Vol. 54, No. 2, p. 221–230.
  2. Allan variance. https://en.wikipedia.org/wiki/Allan_variance
  3. Python Allan variance library. https://github.com/aewallin/allantools
  4. Matlab Allan variance library. https://www.mathworks.com/help/fusion/ref/allanvar.html