spectralbrain.spectral.wavelets#
Spectral Graph Wavelets (SGW) for multi-resolution shape analysis.
Implements the wavelet framework of Hammond, Vandergheynst & Gribonval (ACHA 2011): define a band-pass filter g on the spectral domain and apply it via Chebyshev polynomial approximation of g(t·L), without explicit eigendecomposition.
Also supports wavelet computation from precomputed eigenpairs (faster for the same decomposition used by HKS/WKS).
Kernels#
Mexican hat — g(x) = x · exp(-x) — the canonical SGW kernel.
Heat — g(x) = exp(-x) — low-pass (same filter as HKS).
Meyer — compactly supported in spectral domain.
Custom — user-defined callable g(x).
Functions
|
Heat kernel: g(x) = exp(-x). |
Mexican-hat (Ricker) wavelet kernel: g(x) = x · exp(-x). |
|
|
Simplified Meyer-type wavelet kernel. |
|
Spectral Graph Wavelet descriptor from precomputed eigenpairs. |
|
Spectral Graph Wavelet Transform via Chebyshev approximation. |
- spectralbrain.spectral.wavelets.heat_kernel(x)[source]#
Heat kernel: g(x) = exp(-x).
Low-pass filter — equivalent to the HKS filter but used here in the wavelet framework for completeness.
- spectralbrain.spectral.wavelets.mexican_hat_kernel(x)[source]#
Mexican-hat (Ricker) wavelet kernel: g(x) = x · exp(-x).
- Parameters:
x (ndarray) – Scaled spectral variable t·λ.
- Returns:
ndarray
- Return type:
- spectralbrain.spectral.wavelets.meyer_kernel(x)[source]#
Simplified Meyer-type wavelet kernel.
Compactly supported band-pass: peaks at x ≈ 1, decays to zero at x = 0 and x → ∞.
- spectralbrain.spectral.wavelets.sgw_descriptor(decomp, scales=None, *, n_scales=5, kernel=<function mexican_hat_kernel>, aggregate='energy')[source]#
Spectral Graph Wavelet descriptor from precomputed eigenpairs.
Faster than Chebyshev-based SGW when the eigenpairs are already available (from HKS/WKS computation).
\[\psi_{t}(x) = \sum_{i=0}^{k} g(t \cdot \lambda_i)\, \varphi_i(x)\]The per-vertex wavelet energy at scale t is:
\[W(x, t) = \psi_t^2(x) = \left( \sum_i g(t \lambda_i) \varphi_i(x) \right)^2\]- Parameters:
decomp (SpectralDecomposition)
scales (ndarray, shape (S,), optional) – Wavelet scales.
None= auto log-spaced.n_scales (int) – Number of auto scales.
kernel (callable) – Wavelet kernel g(x).
aggregate (str) –
"energy"— ψ²(x, t), wavelet energy per vertex per scale."raw"— ψ(x, t), raw wavelet coefficients (signed)."abs_mean"— |ψ(x, t)|, absolute coefficients.
- Returns:
ndarray, shape (N, S) – Multi-scale wavelet descriptor.
- Return type:
- spectralbrain.spectral.wavelets.sgw_transform(L, scales, *, signal=None, kernel=<function mexican_hat_kernel>, chebyshev_order=30, lam_max=None)[source]#
Spectral Graph Wavelet Transform via Chebyshev approximation.
Computes T_g^{t_j} f = g(t_j · L) · f for each scale t_j, without eigendecomposition.
- Parameters:
L (SparseMatrix, shape (N, N)) – Laplacian (stiffness matrix).
scales (ndarray, shape (S,)) – Wavelet scales (positive reals).
signal (ndarray, shape (N,) or (N, d), optional) – Signal to transform. Default = identity (delta at each vertex) — gives the wavelet coefficient matrix.
kernel (callable) – Wavelet kernel g(x). Default: Mexican hat.
chebyshev_order (int) – Polynomial approximation order (higher = more accurate).
lam_max (float, optional) – Upper bound on eigenvalues of L.
None= estimate via power iteration.
- Returns:
ndarray, shape (S, N) or (S, N, d) – Wavelet coefficients at each scale.
- Return type:
References
Hammond DK, Vandergheynst P, Gribonval R. Wavelets on graphs via spectral graph theory. ACHA 30(2):129–150, 2011.