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.4.tar.gz (12.8 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.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for avar-1.0.4.tar.gz
Algorithm Hash digest
SHA256 ce1a86974eac128eb94074d61c426d196ee4d6518e513b1de7dc4e6862562134
MD5 1c07301739dfb2fb5ffc307b827ac021
BLAKE2b-256 7965d3c54ffcb9660401bdb9a099e55b0ea1a133de2bcedd1ab59e8d11917c1c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for avar-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bb9b5e52c0524eee3abeb84bf8657ac5d126a5b2d45eba166080bef01d4e5d35
MD5 b57f5cc2dd14a10428dd21c593304e81
BLAKE2b-256 988de500484199bca91ca78e3c73ae2a9aa3b07d40fa6f8a923cedd2d5655001

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