Skip to content

embed_log_lambda

Resample to a uniform log-λ grid, then embed.

Category Embeddings
Backend scipy - implemented here on top of scipy primitives
Version 1.0.1
Reads ctx.spectrum (a Spectrum1D)
Writes embedding, extras.embedding_provenance, metrics.embedding_dim, metrics.embedding_norm

The grid spacing is set so the output length is exactly dim. Wavelengths must be strictly positive (the log of a non-positive value is undefined); the algorithm fails fast with a clear error otherwise. Non-finite (NaN/inf) samples are dropped before the resampling — the log-λ interpolation is sampling-independent, so this is safe — and a descending wavelength axis is sorted first.

Parameters

Parameter Default Required Description
dim 256 - Output vector length AND number of log-λ samples (positive integer).
strategy 'naive' - Recipe applied to the resampled flux: one of ('naive', 'dct', 'multiscale_dct').
norm_method 'min_max' - Pre-embedding flux normalisation: one of ('none', 'min_max', 'z_score', 'continuum').

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("embed_log_lambda", ctx, {
    "dim": 256,
    "strategy": "naive",
    "norm_method": "min_max"
})
spectro run embed_log_lambda --input spectrum.fits \
  --param dim=256 \
  --param strategy=naive \
  --param norm_method=min_max
{
  "tool": "embed_log_lambda",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "dim": 256,
      "strategy": "naive",
      "norm_method": "min_max"
    }
  }
}

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

References

  • Tonry & Davis 1979, AJ, 84, 1511 — radial velocities from cross-correlation in log-λ space.
  • Baldry et al. 1999, ApJ, 521, 167 — Doppler invariance of log-wavelength representations.