Skip to main content

Allan deviation and related time/frequency statistics

Project description

AllanTools Documentation Status

A python library for calculating Allan deviation and related time & frequency statistics. LGPL v3+ license.

Developed at and also available on PyPi at Discussion group at

Input data should be evenly spaced observations of either fractional frequency, or phase in seconds. Deviations are calculated for given tau values in seconds.

These statistics are currently included:

  • adev() Allan deviation
  • oadev() overlapping Allan deviation,
  • mdev() modified Allan deviation,
  • tdev() Time deviation
  • hdev() Hadamard deviation
  • ohdev() overlapping Hadamard deviation
  • totdev() total Allan deviation
  • mtie() Maximum time interval error
  • tierms() Time interval error RMS
  • mtotdev() Modified total deviation
  • ttotdev() Time total deviation
  • htotdev() Hadamard total deviation
  • theo1() Thêo1 deviation

Noise generators for creating synthetic datasets are also included:

  • violet noise with f^2 PSD
  • white noise with f^0 PSD
  • pink noise with f^-1 PSD
  • Brownian or random walk noise with f^-2 PSD

see /tests for tests that compare allantools output to other (e.g. Stable32) programs. More test data, benchmarks, ipython notebooks, and comparisons to known-good algorithms are welcome!


See /docs for documentation in sphinx format. On Ubuntu this requires the python-sphinx and python-numpydoc packages. html/pdf documentation using sphinx can be built locally with:

/docs$ make html
/docs$ make latexpdf

this generates html documentation in docs/_build/html and pdf documentation in docs/_build/latex.

The sphinx documentation is also auto-generated online

IPython notebooks with examples

See /examples for some examples in IPython notebook format.

github formats the notebooks into nice web-pages, for example

todo: add here a very short guide on how to get started with ipython



clone from github, then install with:

sudo python install

(see python –help install for install options)

or download from pypi:

sudo pip install allantools


New in 2016.11 : simple top-level API, using dedicated classes for data handling and plotting.

import allantools #
import numpy as np

# Compute a deviation using the Dataset class
a = allantools.Dataset(data=np.random.rand(1000))

# Plot it using the Plot class
b = allantools.Plot()
b.plot(a, errorbars=True, grid=True)
# You can override defaults before "show" if needed"Tau (s)")

Lower-level access to the algorithms is still possible :

import allantools #
rate = 1/float(data_interval_in_s) # data rate in Hz
taus = [1,2,4,8,16] #  tau-values in seconds
# fractional frequency data
(taus_used, adev, adeverror, adev_n) = allantools.adev(fract_freqdata, data_type='freq', rate=rate, taus=taus)
# phase data
(taus_used, adev, adeverror, adev_n) = allantools.adev(phasedata, data_type='phase', rate=rate, taus=taus)

# notes:
#  - taus_used may differ from taus, if taus has a non-integer multiples
#  of data_interval - adeverror assumes 1/sqrt(adev_n) errors


The tests compare the output of allantools to other programs such as Stable32. Tests may be run using py.test ( Slow tests are marked ‘slow’ and tests failing because of a known reason are marked ‘fails’. To run all tests:

$ py.test

To exclude known failing tests:

$ py.test -m "not fails" --durations=10

To exclude tests that run slowly:

$ py.test -m "not slow" --durations=10

To exclude both (note option change) and also check docstrings is ReST files

$ py.test -k "not (slow or fails)" --durations=10 --doctest-glob='*.rst'

To run the above command without installing the package:

$ python test --addopts "-k 'not (fails or slow)'"

Test coverage may be obtained with the ( module:

coverage run --source allantools test --addopts "-k 'not (fails or slow)'"
coverage report # Reports on standard output
coverage html # Writes annotated source code as html in ./htmlcov/

On Ubuntu this requires packages python-pytest and python-coverage.

Testing on multiple python versions can be done with tox (

$ tox

Tests run continuously on Travis-CI at

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for AllanTools, version 2018.3
Filename, size File type Python version Upload date Hashes
Filename, size AllanTools-2018.3.tar.gz (29.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page