icwt

Function icwt 

pub fn icwt<T>(
    cwt_result: &CWTResult<T>,
    wavelet: &dyn ContinuousWavelet,
) -> Result<Signal<T>>
Expand description

Inverse Continuous Wavelet Transform (reconstruction)

Implements the discrete approximation of the Calderón reconstruction formula:

  f(t) ≈ (1/C_ψ) · Re[ Σ_a Σ_b W(a, b) · ψ_{a,b}(t) · Δa · Δb / a² ]

where ψ_{a,b}(t) = (1/√a) · ψ((t − b)/a) is the L2-normalized wavelet, W(a, b) are the CWT coefficients, Δa is the per-scale spacing, and C_ψ is the wavelet admissibility constant. The real part is taken because the input signal is treated as real-valued.

§Reconstruction quality

The structural formula is exact (up to the discretization of the scale integral); reconstruction quality is governed by:

  1. Scale coverage. The discrete sum approximates the continuous integral; scales must cover the signal’s effective bandwidth. For a tone at frequency f, the dominant scale is wavelet.center_frequency() · fs / f — make sure your scale grid spans this value with adequate resolution.
  2. Admissibility constant C_ψ. Each ContinuousWavelet impl provides its own via ContinuousWavelet::admissibility_constant; built-in admissible wavelets (Morlet, MexicanHat, ComplexMorlet, ComplexPaul) override with analytical formulas calibrated to recover input amplitude within ~2% on a single-tone cosine. The default for custom impls is , which produces shape-correct but amplitude-biased reconstructions.
  3. Discrete-vs-continuous integration error. The sum Σ_a (1/a²) · Δa approximates ∫ da/a²; for log-spaced scales, consider Δa/a = const weighting (this implementation uses central-difference Δa and is exact for uniform scales).

§Amplitude-correctness

icwt(cwt(x), wavelet) returns x (within ~5%) for every built-in wavelet (see tests/transforms/cwt_reference.rs::test_icwt_amplitude_matches_input_for_admissible_wavelets):

  • MorletC_ψ = π/ω₀
  • MexicanHatC_ψ = (4√π/3)·σ
  • ComplexMorletC_ψ = 2π·bandwidth/ω₀
  • ComplexPaulC_ψ = π/m
  • ComplexMexicanHatC_ψ = 3π / (ω₀ + √2)^{3/2} (empirical fit; valid for ω₀ ≥ 3). Requires the 2.0.0 admissibility correction added to its wavelet_function (subtracts ω₀²·exp(−ω₀²/2)·exp(−η²/2) so Ψ̂(0) = 0).

Properties pinned by tests in this release (see tests/transforms/cwt_reference.rs::test_icwt_* and the icwt_kernel_* series in transform/cwt.rs::tests):

  • Re(W · conj(ψ)) handling: complex coefficients and complex wavelets are correctly combined via Re(W)·Re(ψ) + Im(W)·Im(ψ), not just Re(W)·Re(ψ). ferro-wave’s forward cwt(...) does not conjugate ψ, so the inverse conjugates to recover the inner- product structure.
  • 1/a² measure: contributions are scaled by 1/a², not 1/a, so each scale’s contribution is correctly weighted.
  • Per-scale Δa: each scale slab is weighted by a central- difference Δa on the scale grid; uniform grids give exact Δa, non-uniform grids get the local spacing.
  • Linearity: icwt(α·W₁ + β·W₂) = α·icwt(W₁) + β·icwt(W₂).
  • L2-norm consistency: wavelets that do not include the 1/√a factor internally (wavelet_function_includes_l2_norm() == false) have it applied by this function.
  • Amplitude correctness for the 4 admissible built-ins listed above.