Skip to content

compare_smoothings

Run every smoothing kernel on ctx.spectrum and collect the results.

Category Smoothing
Backend numpy - implemented here on top of numpy primitives
Version 1.0.1
Reads ctx.spectrum (a Spectrum1D)
Writes extras.smoothings, metrics.smoothings_rms

Pairwise residual RMS between any two smoothings is recorded in ctx.metrics so the caller can see how much the kernel choice actually matters on this particular spectrum.

Parameters

Parameter Default Required Description
methods ['smooth_savgol', 'smooth_gaussian'] - Names of smoothing algorithms to run (defaults to the 2 native ones).
per_method_params {} - Optional dict {method_name: {param: value}} for overrides.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("compare_smoothings", ctx, {
    "methods": [
        "smooth_savgol",
        "smooth_gaussian"
    ],
    "per_method_params": {}
})
spectro run compare_smoothings --input spectrum.fits \
  --param methods=["smooth_savgol","smooth_gaussian"] \
  --param per_method_params={}
{
  "tool": "compare_smoothings",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "methods": [
        "smooth_savgol",
        "smooth_gaussian"
      ],
      "per_method_params": {}
    }
  }
}

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

References

  • Catalogue smooth_* algorithms; this wrapper is composition only.
  • smooth_gaussian - Smooth a spectrum by convolution with a Gaussian kernel.
  • smooth_savgol - Smooth a spectrum with a Savitzky-Golay filter.