npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

allan

v0.1.0-beta.8

Published

Javascript Allan Variance library

Downloads

6

Readme

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:

| 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

  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