embed_wavelets¶
Embed a spectrum via a truncated discrete wavelet transform.
| Category | Embeddings |
| Backend | pywavelets - uses PyWavelets (optional extra embedding-wavelets) |
| Version | 2.0.1 |
| Reads | ctx.spectrum (a Spectrum1D) |
| Writes | embedding, extras.embedding_provenance, metrics.embedding_dim, metrics.embedding_norm |
Returns the first dim coefficients of the concatenated multi-level decomposition (approximation + level-L details + level-(L-1) details + … + level-1 details), zero-padded when the decomposition is shorter than dim, then L2-normalised. The ordering is stable: each output dimension always represents the same wavelet coefficient across all spectra, so cosine similarity is meaningful. Non-finite samples (NaN/inf) make the brick fail cleanly — the transform acts on the sample index, so bad pixels cannot be dropped ; interpolate or mask them first.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
dim |
256 |
- | Output vector length (positive integer). |
wavelet |
'db4' |
- | PyWavelets family name. Sensible choices: 'db1' (Haar - sharpest), 'db4' (default, smooth), 'sym8', 'coif5'. |
level |
5 |
- | Number of wavelet decomposition levels. Higher = coarser scales captured; bounded by log2(npix). |
Use it¶
References¶
- Daubechies 1992, 'Ten Lectures on Wavelets', SIAM.
- Mallat 2008, 'A Wavelet Tour of Signal Processing'.
- Starck & Murtagh 2002, 'Astronomical Image and Data Analysis' — wavelet methods on astronomical signals.
Related algorithms¶
embed_band_power- Embed a spectrum as the integrated flux in N adjacent wavelength bands.embed_continuum_subtracted- Subtract the polynomial continuum, then embed the line residual.embed_lick_indices- Embed a spectrum as the canonical Lick/IDS line-strength indices.embed_log_lambda- Resample to a uniform log-λ grid, then embed.embed_pretrained- Embed a spectrum with a local pre-trained PyTorch model.embed_remote- Embed a spectrum via a remote HTTPS inference endpoint.embed_spectrum- Compute a fixed-length, L2-normalised embedding of a spectrum.