Skip to content

extract_sky_lateral_bands

Median-combine two off-trace sky bands into a 1D pixel-axis reference.

Category Extraction (2-D to 1-D)
Backend numpy - implemented here on top of numpy primitives
Version 1.0.0
Reads ctx.image (an ImageFrame)
Writes extras.sky_spectrum, metrics.median_sky_counts

Band rows are instrument- and exposure-specific; set them from the preset that describes the slit geometry. The bands should be far enough from the trace to avoid wing contamination.

Parameters

Parameter Default Required Description
band_above_lo 0 yes First row (inclusive) of the band above the trace.
band_above_hi 0 yes Last row (exclusive) of the band above the trace.
band_below_lo 0 yes First row (inclusive) of the band below the trace.
band_below_hi 0 yes Last row (exclusive) of the band below the trace.
combine 'mean' - 'mean' or 'median' to combine the two band profiles.
extras_key 'sky_spectrum' - ctx.extras key under which the sky spectrum is stored.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("extract_sky_lateral_bands", ctx, {
    "band_above_lo": 0,
    "band_above_hi": 0,
    "band_below_lo": 0,
    "band_below_hi": 0,
    "combine": "mean",
    "extras_key": "sky_spectrum"
})

The CLI loads a single 1-D spectrum with --input; this algorithm needs ctx.image (an ImageFrame). Run it from Python or as a step of a pipeline preset.

{
  "tool": "extract_sky_lateral_bands",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "band_above_lo": 0,
      "band_above_hi": 0,
      "band_below_lo": 0,
      "band_below_hi": 0,
      "combine": "mean",
      "extras_key": "sky_spectrum"
    }
  }
}

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

References

  • Hanuschik 2003, A&A 407, 1157 — UVES optical sky emission atlas.
  • Osterbrock & Martel 1992, PASP 104, 76 — night-sky emission lines.
  • Stoughton et al. 2002, AJ 123, 485 — SDSS in-situ sky-line wavelength strategy.