Function icwt
pub fn icwt<T>(
cwt_result: &CWTResult<T>,
wavelet: &dyn ContinuousWavelet,
) -> Result<Signal<T>>where
T: Float + FromPrimitive + ToPrimitive + SignalType + AddAssign + SubAssign + MulAssign + DivAssign + RemAssign,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:
- 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 iswavelet.center_frequency() · fs / f— make sure your scale grid spans this value with adequate resolution. - Admissibility constant
C_ψ. EachContinuousWaveletimpl provides its own viaContinuousWavelet::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 is2π, which produces shape-correct but amplitude-biased reconstructions. - Discrete-vs-continuous integration error. The sum
Σ_a (1/a²) · Δaapproximates∫ da/a²; for log-spaced scales, considerΔa/a = constweighting (this implementation uses central-differenceΔaand 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):
Morlet—C_ψ = π/ω₀MexicanHat—C_ψ = (4√π/3)·σComplexMorlet—C_ψ = 2π·bandwidth/ω₀ComplexPaul—C_ψ = π/mComplexMexicanHat—C_ψ = 3π / (ω₀ + √2)^{3/2}(empirical fit; valid for ω₀ ≥ 3). Requires the 2.0.0 admissibility correction added to itswavelet_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 justRe(W)·Re(ψ). ferro-wave’s forwardcwt(...)does not conjugate ψ, so the inverse conjugates to recover the inner- product structure. - 1/a² measure: contributions are scaled by
1/a², not1/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/√afactor internally (wavelet_function_includes_l2_norm() == false) have it applied by this function. - Amplitude correctness for the 4 admissible built-ins listed above.