Skip to content

dark_subtract

Subtract a master dark from ctx.image.

Category Preprocessing (2-D image)
Backend numpy - implemented here on top of numpy primitives
Version 1.0.0
Reads ctx.image (an ImageFrame)
Writes image

Reads the master dark from ctx.extras['master_dark'] (an ImageFrame) or from dark_key if you stored it under a different key.

Parameters

Parameter Default Required Description
dark_key 'master_dark' - Key in ctx.extras where the master dark is stored.
scale_by_exptime True - Scale the dark by EXPTIME(science)/EXPTIME(dark) before subtracting.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("dark_subtract", ctx, {
    "dark_key": "master_dark",
    "scale_by_exptime": True
})

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": "dark_subtract",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "dark_key": "master_dark",
      "scale_by_exptime": true
    }
  }
}

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

References

  • Howell 2006 — Handbook of CCD Astronomy, ch. 4.