Skip to content

embed_continuum_subtracted

Subtract the polynomial continuum, then embed the line residual.

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, metrics.continuum_rms

Uses the symmetric sigma-clipped polynomial continuum helper from algorithms._common; the residual (flux - continuum) is then passed to one of the standard embedding recipes. Set norm_method='none' to skip a second normalisation step — the residual already has zero mean. Non-finite samples (NaN/inf) make the brick fail cleanly: the DCT/resampling recipes act 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).
strategy 'dct' - Recipe applied to the residual: one of ('naive', 'dct', 'multiscale_dct').
continuum_order 3 - Polynomial degree for the continuum fit (2-5 typical).
sigma_clip 3.0 - Sigma threshold for the continuum-fit clip (default 3.0).
norm_method 'none' - Pre-embedding flux normalisation: one of ('none', 'min_max', 'z_score', 'continuum'). Defaults to 'none' because the residual is already zero-centred.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("embed_continuum_subtracted", ctx, {
    "dim": 256,
    "strategy": "dct",
    "continuum_order": 3,
    "sigma_clip": 3.0,
    "norm_method": "none"
})
spectro run embed_continuum_subtracted --input spectrum.fits \
  --param dim=256 \
  --param strategy=dct \
  --param continuum_order=3 \
  --param sigma_clip=3.0 \
  --param norm_method=none
{
  "tool": "embed_continuum_subtracted",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "dim": 256,
      "strategy": "dct",
      "continuum_order": 3,
      "sigma_clip": 3.0,
      "norm_method": "none"
    }
  }
}

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

References

  • Sousa et al. 2007, A&A, 469, 783 — continuum-normalised spectra for stellar parameter retrieval.
  • Worthey et al. 1994, ApJS, 94, 687 — line-strength indices on continuum-flattened spectra.
  • embed_band_power - Embed a spectrum as the integrated flux in N adjacent wavelength bands.
  • 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.
  • embed_wavelets - Embed a spectrum via a truncated discrete wavelet transform.