Module ewt

Module ewt 

Expand description

Empirical Wavelet Transform (EWT).

EWT (Gilles, IEEE Trans. Signal Processing, 2013) builds a wavelet filter bank whose pass-bands are adaptively chosen to match the Fourier-spectral structure of the input signal. It is the bridge between wavelet theory and EMD-style data adaptivity: unlike a fixed dyadic DWT/MODWT it places its sub-bands where the signal actually lives in the spectrum, and unlike EMD it offers both exact reconstruction and per-band Parseval simultaneously.

The pipeline is

  1. compute the half-spectrum magnitude of x (optionally ln(1 + |·|));
  2. preprocess the spectrum (Gaussian, Median, or None);
  3. detect N boundary frequencies ω_n ∈ (0, π) (BoundaryDetection::LocalMaxMinima, BoundaryDetection::Adaptive, or BoundaryDetection::Manual);
  4. resolve the transition-width parameter γ (GammaStrategy::Auto uses Gilles 2013 Eq. 8 with virtual end-points ω_0 = 0, ω_{N+1} = π); and
  5. build a Meyer scaling function φ̂_1 plus N Meyer wavelets ψ̂_1, …, ψ̂_N whose squared magnitudes form a partition of unity on [0, π].

Each output band is then exposed in two complementary forms because no single set of smooth-filter outputs can satisfy both Σ_k c_k = x and Σ_k ‖c_k‖² = ‖x‖² (the two together force every Ĥ_k(ω) ∈ {0, 1}, i.e. boxcar filters with their attendant Gibbs ringing — see the “Convention note” below):

  • EWTResult::components = IFFT(|Ĥ_k|² · X̂) — bandpass modes that reconstruct via Σ components[k] ≡ x to FFT round-off (because Σ |Ĥ_k|² ≡ 1 by Meyer construction).
  • EWTResult::coefficients = IFFT(Ĥ_k · X̂) — canonical Gilles 2013 analysis coefficients (W_f(k, t)) that satisfy strict Parseval Σ_k ‖coefficients_k‖² = ‖x‖² (because the same Σ |Ĥ_k|² ≡ 1 identity, applied band-energy-wise per Parseval, telescopes to ‖x‖²).

iewt is a trivial pointwise sum over components; it stays in the API for symmetry with other transforms’ synthesis functions and so a future biorthogonal variant can swap in non-trivial synthesis without breaking callers.

Convention note. The two-array shape is a divergence from issue #34’s API sketch (which lists only a components field) but is forced by the math: Σ Ĥ_k(ω) ≡ 1 and Σ |Ĥ_k(ω)|² ≡ 1 jointly imply Ĥ_k(ω)² = Ĥ_k(ω) for every k, ω, i.e. each filter response is in {0, 1}. Either we accept boxcar filters (sharp-cut, Gibbs-prone, no time-localization) or we expose both projections. We chose the latter; the extra storage is one N × signal_len array and one extra IFFT per band.

The filter-bank partition of unity Σ |Ĥ_k|² ≡ 1 is exercised by meyer_partition_of_unity (internal) and filter_bank_partition_of_unity_holds_via_public_responses (integration).

§References

  • Gilles, J. (2013). Empirical wavelet transform. IEEE Trans. Signal Processing, 61(16), 3999–4010. https://doi.org/10.1109/TSP.2013.2265222 — Eq. 8 (γ bound), §III.A (LocalMaxMinima), §III.B (Meyer filter construction), and the §IV synthetic AM-FM/chirp signals used by the integration boundary regression. Issue #34 names “Fig. 5” as the boundary reference, but the paper’s Fig. 5 is the Meyer periodicity diagram; the reproducible signal regression uses the published §IV third test signal instead.
  • Gilles, J., & Heal, K. (2014). A parameterless scale-space approach to find meaningful modes in histograms. Int. J. Wavelets, Multiresolution and Information Processing, 12(6). https://doi.org/10.1142/S0219691314500441Adaptive boundary detection.
  • Daubechies, I. (1992). Ten Lectures on Wavelets, SIAM, §4.2.B — the β(x) = x⁴(35 − 84x + 70x² − 20x³) polynomial used to shape the Meyer transitions.
  • Reference MATLAB toolbox: https://www.mathworks.com/matlabcentral/fileexchange/42141-empirical-wavelet-transforms.

Structs§

EWTConfig
Configuration for ewt.
EWTResult
Result of an ewt decomposition.

Enums§

BoundaryDetection
How to locate the N Fourier-domain boundaries ω_n ∈ (0, π) that partition the signal’s spectrum into adaptive bands.
GammaStrategy
How to choose the Meyer transition-width parameter γ.
SpectrumPreproc
Optional smoothing applied to the magnitude spectrum prior to peak detection. Has no effect on the filter bank itself — only on which peaks the BoundaryDetection sees.

Functions§

ewt
Decompose signal into adaptive Meyer sub-bands via EWT.
iewt
Reconstruct x from an EWTResult by summing its components.