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.1.tar.gz (12.5 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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: avar-1.0.1.tar.gz
  • Upload date:
  • Size: 12.5 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.1.tar.gz
Algorithm Hash digest
SHA256 807f83551ecf0f6d79871c6a810e75444f2b6dcc4550ad44b1b0ec690d0a11fe
MD5 6626d92b1aab4dba92f5c3bb4b4d1e28
BLAKE2b-256 da6220ede0f70d2445cd4abfc7b8497cfd75d9255fbb95649b7f32d0bff42aff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: avar-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7eed05c718c8f269db90f9b93aabba66863ce976a91b04e766cd92962cea7fd4
MD5 fb1862f857325fe21ef2f61fd6367a4f
BLAKE2b-256 2908374c59bd91b169b39e38dd44114d1c1af81e7cd818688917199a9859c868

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