Skip to content

wdm-transform

PyPI Python Tests Docs arXiv License: MIT Open In Colab

A NumPy / JAX implementation of the Wilson–Daubechies–Meyer (WDM) wavelet-packet time-frequency transform, with exact closed-form forward and inverse, GPU-accelerated execution, and a Whittle-style likelihood for locally stationary inference.

wdm-transform demo


Install

pip install wdm-transform           # core (NumPy)
pip install wdm-transform[jax]      # CPU/GPU JAX backend

Quickstart

import numpy as np
from wdm_transform import TimeSeries

# Any 1D real signal with N = nt * nf samples (nt, nf both even)
N, dt = 2**14, 1.0 / 4096
t = np.arange(N) * dt
x = np.sin(2 * np.pi * 200 * t) + 0.1 * np.random.randn(N)

series = TimeSeries(x, dt=dt)
wdm    = series.to_wdm(nt=128)           # wdm.coeffs has shape (1, 128, 129)
recon  = wdm.to_time_series()            # round-trips to machine precision

assert np.allclose(recon.data, x, atol=1e-10)

The coefficient array wdm.coeffs has shape \((\text{batch},\, N_t,\, N_f + 1)\) — a real time-frequency map that you can plot, slice, or feed straight into a WDM-Whittle likelihood.

What Makes WDM Useful

  • Exactly orthonormal interior atoms — coefficients can be read independently, with no leakage from neighbours.
  • Closed-form inverse to floating-point precision across NumPy and JAX backends.
  • JAX/GPU backend — ~35× faster than NumPy at \(N = 10^6\), suitable for differentiable inference pipelines.
  • WDM-Whittle likelihood — a pixel-wise Gaussian likelihood that naturally accommodates locally stationary noise without off-diagonal covariance terms.

Where To Go Next

Citation

If you use wdm-transform in academic work, please cite the companion paper (Baghi et al., in preparation) and the package itself. A machine-readable citation file is provided in the repository.