Skip to main content

Allan variance tools

Project description

PyPI Downloads

Allan Variance Tools

The avar library provides tools for Allan variance analysis, a statistical method used to quantify the stability of time series data, particularly in the context of noise characterization for signals. The library includes functions to compute Allan variances, generate various types of noise, and interactively fit Allan variance curves. It is built using Python with dependencies on NumPy, Matplotlib, and SciPy.

Window Generation

M = avar.windows(K, min_size=1, density=64)

Generates an array of integer averaging window sizes for Allan variance analysis. It creates logarithmically spaced window sizes between min_size and K/2, with approximately density sizes per decade. It ensures unique integer values.

Allan Variance Calculation

va = avar.variance(y, M)

Computes Allan variance for a time series y over specified window sizes M. Supports both 1D arrays (single time series) and 2D arrays (multiple time series). Uses cumulative sums to calculate variance efficiently, handling overlapping windows.

Ideal Allan Variance

va = avar.ideal_variance(tau, ks, T=None)

Calculates theoretical Allan variance curves for various noise types. Supports quantization, white, first-order Gauss-Markov (FOGM), Brownian, and ramp noises. Parameter ks defines noise slopes and variances, and T specifies the sampling period (required for FOGM).

Noise Generation

The library provides functions to generate different types of noise, each with specific statistical properties:

y = avar.noise_quantization(var, T, K)
y = avar.noise_white(var, T, K)
y = avar.noise_fogm(var, tau, T, K, y0=None)
y = avar.noise_brownian(var, T, K)
y = avar.noise_ramp(var, T, K)

Interactive Allan Variance Fitting

avar.fit(
    tau: np.ndarray,
    va: np.ndarray,
    T: float = 1.0,
    ks: tuple | list | None = None,
    ax: axes = None,
    truecolor: str = "tab:blue",
    fitcolor: str = "tab:orange")

Provides an interactive Matplotlib-based interface for fitting Allan variance curves. Displays true Allan variance (va) and fitted curves based on noise components (ks).

Supports interactive manipulation via mouse and keyboard:

  • Left-click and drag: Move noise components.
  • Shift and left-click or middle-click: Pan the view.
  • Scroll: Zoom (faster with shift).
  • Keys 'q', 'w', 'f', 'b', 'r': Add quantization, white, FOGM, Brownian, or ramp noise components.
  • 'Delete', 'backspace', or key 'x': Remove components.
  • Key 'o': Optimize component variances using least-squares fitting.
  • Key 'h': Reset view to the data limits.
  • Key '?': toggle the help menu.

Features log-log scaling, customizable colors, and optimization bounds for fitting. Handles multiple noise types with specific slopes (-2 to +2) and parameters (e.g., time constant for FOGM).

Project details


Download files

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

Source Distribution

avar-1.0.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avar-1.0.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file avar-1.0.3.tar.gz.

File metadata

  • Download URL: avar-1.0.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for avar-1.0.3.tar.gz
Algorithm Hash digest
SHA256 be44b354b84886854c8927ff090539f8ec3b802d17e6df3a984953b924d07f33
MD5 6d35abf7e40436513ce266dce78a475a
BLAKE2b-256 0c6049396856d6d2128baa3317ee52949aeddb877718ad6571b4df5b9927a239

See more details on using hashes here.

File details

Details for the file avar-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: avar-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for avar-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1df50623320da4e897dfca170d7ce2af78db42576039261b42c9fa7eac4a9948
MD5 fee82d405c47cfce2184535a1bb709b5
BLAKE2b-256 ae2b50086f8b788a28f657b698d5c2d38e8ac6a542a41c679844c34f7e04a5ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page