domania
domania does two things, in float64 NumPy. transform translates data arrays between the
time, frequency and WDM (Wilson-Daubechies-Meyer) domains. frequency_covariance and
wdm_covariance evaluate a K × K noise model as its covariance at each frequency bin or WDM
cell. It computes no likelihood: the caller does.
Install
pip install domania
Data
import numpy as np
from domania import transform
Nf, Nt, dt = 6, 12, 0.3
N = Nf * Nt
x = np.random.default_rng(6).standard_normal((2, N)) # any leading axes
w = transform(x, "time", "wdm", N=N, dt=dt, target_wdm=(Nf, Nt)) # (2, 6, 12) float64
X = transform(w, "wdm", "frequency", N=N, dt=dt, source_wdm=(Nf, Nt)) # (2, 37): dt * rfft(x)
v = transform(X, "frequency", "wdm", N=N, dt=dt, target_wdm=(12, 6)) # another WDM grid
assert np.allclose(transform(v, "wdm", "time", N=N, dt=dt, source_wdm=(12, 6)), x)
# A full-FFT slice (~1e-16 imaginary at Nyquist) is taken as it is; a residue above 1e-10
# of the peak is refused.
assert np.allclose(transform(dt * np.fft.fft(x)[:, : N // 2 + 1], "frequency", "time",
N=N, dt=dt), x)
Covariance
import numpy as np
from domania import frequency_covariance, wdm_covariance
dt, N, Nf, Nt = 5.0, 1024, 16, 64
def S(f): # one-sided 2 x 2 cross-spectral density
p = 1e-2 / (1.0 + (f / 0.02) ** 2)
c = 0.8 * np.exp(-2j * np.pi * f * 36.5) # coherence 0.8, a 36.5 s delay: complex
return p * np.array([[np.ones_like(c), c], [np.conj(c), np.ones_like(c)]])
C = frequency_covariance(S, N=N, dt=dt) # (2, 2, 513) complex
D = wdm_covariance(lambda f, t: S(f), Nf=Nf, Nt=Nt, dt=dt) # (2, 2, 16, 64) real
E = wdm_covariance(lambda f, t: S(f) * (1.3 + 0.3 * np.cos(2 * np.pi * t / (N * dt))),
Nf=Nf, Nt=Nt, dt=dt) # evolutionary
assert np.array_equal(C, C.conj().transpose(1, 0, 2))
assert D.shape == E.shape == (2, 2, Nf, Nt) and np.array_equal(D, D.transpose(1, 0, 2, 3))
Conventions
- Trailing-axis layouts: time is real
(N,); frequency is complex(N // 2 + 1,),dt * rfft(x); WDM is real(Nf, Nt)folded,NfandNteven andNf * Nt == N: rowi >= 1is bandi, and row 0 holds band 0 (DC) at timejin even slotsjand bandNf(Nyquist) at timej - 1in odd ones.wilson.grid.cellsgives each slot's band and time,.reshape(..., N)is the flat form, andwilson.grid.foldandunfoldconvert from and to padded(Nf + 1, Nt). The atoms have unit norm (sum(w**2) == dt * sum(x**2)). - A model
S(f)orS(f, t)(tin seconds from the first sample) returns(K, K, ...), or(K, K, 1)if it is constant, withS[b, a] = conj(S[a, b]), oriented so thatE[X_a conj(X_b)] = (N dt / 2) S_ab. - With
H = (S + S^H) / 2,frequency_covarianceis(N dt / 2) H(f_k), real at DC and even-NNyquist, andwdm_covarianceis½ BA_m[Re H(·, n Nf dt)], the band average of WDM Paper II, Eq. 36. Both are linear inS, exactly Hermitian (or symmetric), and fp64. - For an evolutionary model Eq. 36 is a local-stationarity approximation. If the model is not
periodic over the record, take
lead, trail = wilson.evolutionary.wrap_cut_columns(...)and keep only the cells whose timen(wilson.grid.cells(Nf, Nt)[1]) haslead <= n < Nt - trail. A column slice is not that cut, since row 0's odd slotjholds timej - 1. transform,frequency_covarianceandwdm_covarianceraiseTypeErrorfor a wrong kind of argument andValueErrorfor a wrong value (WindowErrorfor an inadmissible window).
Kernels
domania.wilson holds the kernels: forward, inverse, forward_time and inverse_time
(any leading axes), the layout's grid.cells, grid.fold and grid.unfold, the windows that
transform and wdm_covariance take as window= (MEYER, the default, Meyer(d),
RampWindow, SampledWindow), and the dense references.
Development
From a clone of https://github.com/AaronDJohnson/domania:
pip install -e ".[test]"
PYTHONDONTWRITEBYTECODE=1 python -P -m pytest -q
Three oracle tests compare against source trees outside this repository; they skip unless
DOMANIA_ORACLE_ROOT names the directory that holds them (the skip message lists the
subdirectories each one expects).
Metadata
Release files for domania 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| domania-3.0.0.tar.gz | 2.0 MB | With provenance | Details for domania-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| domania-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for domania-3.0.0-py3-none-any.whl |
Total release size: 2.1 MB
Release files / domania-3.0.0.tar.gz
| Download URL | domania-3.0.0.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f10da535f37d1aaa01a6438eb1634a1d2c2c8e68b572fd7d60204a04dbf18aa
|
|
BLAKE2b-256 checksum How to use checksums |
a65ebe475832e4c3a3de3799f0c0bdaca42dfe7baa8ed9b7e453f16ec43091ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / domania-3.0.0-py3-none-any.whl
| Download URL | domania-3.0.0-py3-none-any.whl |
|---|---|
| Size | 62.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20c670108a685bf11755ad16a0e1ebf75e93541b28be1a48127d0fa8598c944f
|
|
BLAKE2b-256 checksum How to use checksums |
7198fad89df1f69afa8b88cda57d5664254920af2b629fbeda3584445e9b2944
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for domania 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for domania-3.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.