Skip to content

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

from spectro_kernel import run_algorithm

output = run_algorithm("embed_wavelets", ctx, {
    "dim": 256,
    "wavelet": "db4",
    "level": 5
})
spectro run embed_wavelets --input spectrum.fits \
  --param dim=256 \
  --param wavelet=db4 \
  --param level=5
{
  "tool": "embed_wavelets",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "dim": 256,
      "wavelet": "db4",
      "level": 5
    }
  }
}

Every algorithm is an MCP tool of the same name; describe_algorithm returns this page's metadata as JSON.

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.