Application notes

Measuring Allan Deviation

A guide to Allan Deviation with the Moku Phasemeter

Updated October 9, 2023

The Moku Phasemeter measures the phase, frequency, and amplitude of an input signal, and can calculate the Allan Deviation of any of these quantities in real time. Depending on the model of Moku, it can support up to 6 µradian precision for input signals with a carrier frequency to 300 MHz. Using a digitally implemented phase-locked loop architecture, it provides exceptional dynamic range and precision far exceeding the capabilities of conventional lock-in amplifiers and frequency counters. In this guide, we will cover the math and provide an example Allan Deviation calculation with the overlapped variable τ estimator.

Download user manual

Allan Deviation with overlapped variable τ estimators

Allan Deviation is a measure of stability of some time-varying quantity, typically used to quantify the stability of clocks and other oscillators. It has units of rate of change of the quantity whose deviation is being quantified. For example, Allan Deviation of phase has units of cyc/s, of amplitude is V/s, and of frequency is Hz/s. When used to compute clock stability, it has units of seconds per second, i.e. unitless; and some sources incorrectly generalize the “unitless-ness” of the Allan Deviation to all input series.

By definition, Allan Deviation σy is calculated as a function of observation time τ by the following equation:

where x is the discrete time series whose Allan Deviation is to be calculated. In practice, it’s not possible to calculate the expected value over infinite time. Several estimators are used to calculate Allan deviation. The Moku Phasemeter uses the overlapped variable τ estimator to calculate the Allan Deviation, which is defined as:

where τ0 is the sampling period of the Phasemeter and N is the number of data points acquired for the input time series. n is an integer multiplier of the sampling period that best estimates the desired τ ≅ n τ0 and xi represents the ith element in the time series.

Allan Deviation with the Moku Phasemeter

In this example, we measured the Allan deviation of a 2 MHz signal with the Phasemeter on Moku:Lab. The frequency and phase of the signal were measured at 122 Hz for 10 minutes. To display the Allan Deviation for phase, select the “Phase” tab on the top of the Moku display and “Allan Deviation” in the plot area.

Please note, if “Frequency” or “Amplitude” tabs are selected, Moku:Lab will use frequency or amplitude time series as the input for Equation (2).

Python implementation

The function cal_oadev takes the time series, sampling rate and an array of observation time τ as the input. It calculates the overlapped Allan deviation using equation (2) and returns the nτ0 and σy (0 ) as arrays. Required Libraries: NumPy, math

#Import libraries
import numpy as np
import math

def cal_oadev(data,rate,tauArray):
    tau0 = 1 / rate  # Calculate the sampling period
    dataLength = data.size # Calculate N
    dev = np.array([]) # Create empty array to store the output.
    actualTau = np.array([])

    for i in tauArray:
        n = math.floor(i / tau0) # Calculate n given a tau value.
        if n == 0:
            n = 1 # Use minimal n if tau is less than the sampling period.

    currentSum = 0 # Initialize the sum
    for j in range(0, dataLength - 2*n):
        # Accumulate the sum squared
        currentSum += (data[j+2*n] - 2*data[j+n] + data[j])**2

        # Divide by the normalization coefficient
        devAtThisTau = currentSum / (2*n**2 * tau0**2 * (dataLength - 2*n))
        dev = np.append(dev, np.sqrt(devAtThisTau))
        actualTau = np.append(actualTau, n*tau0)

    return actualTau, dev #Return the actual tau and overlapped Allan deviation


Example calculation

In this example, we imported the time series we acquired previously on the Moku:Lab and calculated the Allan Deviation with Python scripts. You can find all the raw data and scripts below.

Download raw ZIP data scripts

The time series can be found in the “data.xlsx” file. The first column “A” is the measured frequency in Hz, and the second column “B” is the measured phase in cycles. The script “” reads the excel file and calls the cal_oadev function in the “”. The Allan Deviation is plotted as a function of τ in log scales. The Allan Deviation plots matched well between the Moku:Lab and Python scripts. Required Libraries: NumPy, math, pandas, Matplotlib


[1] Land, D. V., A. P. Levick, and J. W. Hand. “The use of the Allan deviation for the measurement of the noise and drift performance of microwave radiometers.” Measurement Science and Technology 18, no. 7 (2007): 1917.

[2] Allan, David W. “Statistics of atomic frequency standards.” Proceedings of the IEEE 54.2 (1966): 221-230.

[3] Howe, D.A., Allan, D.W., and Barnes, J.A. “Properties of signal sources and measurement methods.” Proceedings of the 35th Annual Symposium on Frequency Control (1981): TN-14 – TN-60.

Have questions or comments?

Contact us