Package Exports
- allan
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (allan) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Javascript Allan variance library
⚠️ 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:
Argument | Type | Default | Description |
---|---|---|---|
data |
Array<Number> | — | Array of data samples |
data_type |
String 'freq' or 'phase' | 'freq' | Type of data samples: 'freq' (frequency data) or 'phase' (phase data) |
rate |
Number | 1 | Data samples rate |
tau_data |
Number or Array<Number> | 100 | Number 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>
}
Argument | Type | Description |
---|---|---|
tau |
Array<Number> | Array of the tau values |
dev |
Array<Number> | Array of the deviation values for the corresponding tau |
References
- D. W. Allan. Statistics of Atomic Frequency Standards // Proceedings of the IEEE, 1966, Vol. 54, No. 2, p. 221–230.
- Allan variance. https://en.wikipedia.org/wiki/Allan_variance
- Python Allan variance library. https://github.com/aewallin/allantools
- Matlab Allan variance library. https://www.mathworks.com/help/fusion/ref/allanvar.html