Skip to content

response_from_standard

Derive the instrumental response curve from a standard-star observation.

Category Flux calibration
Backend scipy - implemented here on top of scipy primitives
Version 1.0.1
Reads ctx.spectrum (a Spectrum1D)
Writes extras.reference_spectrum, metrics.response_rms

Computes observed / catalog (after resampling the catalogue to the observed grid), masks Balmer + telluric windows, σ-clips, fits a low-frequency spline (default) or polynomial. spline_knots does NOT place a fixed number of knots: it sets the scipy UnivariateSpline smoothing factor s = var(ratio)·N / spline_knots (N = samples kept), which scipy converts into a knot count — larger spline_knots ⇒ smaller s ⇒ more knots ⇒ tighter fit (risks carving real features in), smaller ⇒ smoother. Sensible default : 20 for the full visible. No extinction / airmass step is performed here (correct upstream), and no exposure-time normalisation: the response absorbs the standard's exposure time unless the observed flux is already per second. Catalogue spectrum lives in ctx.extras['catalog_spectrum'], consistent with the second-spectrum idiom used by remove_telluric_division and combine_spectra_arithmetic.

Parameters

Parameter Default Required Description
fit 'spline' - 'spline' (default low-frequency UnivariateSpline) or 'polynomial'.
spline_knots 20 - Smoothness control for fit='spline': sets the UnivariateSpline smoothing factor s = var(ratio)·N / spline_knots (roughly the number of knots scipy ends up placing). Larger ⇒ tighter fit (risks eating real features) ; smaller ⇒ smoother.
poly_order 5 - Polynomial order when fit='polynomial'.
exclude_regions None - List of (wave_lo, wave_hi) windows (Å) to exclude from the fit. None ⇒ a default set covering Balmer + visible telluric bands.
sigma_clip 3.0 - σ threshold for residual clipping during the fit (≥ 1).
max_iter 3 - Maximum σ-clip iterations.
catalog_key 'catalog_spectrum' - ctx.extras key holding the catalogue Spectrum1D.
output_key 'reference_spectrum' - ctx.extras key receiving the fitted response curve.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("response_from_standard", ctx, {
    "fit": "spline",
    "spline_knots": 20,
    "poly_order": 5,
    "exclude_regions": None,
    "sigma_clip": 3.0,
    "max_iter": 3,
    "catalog_key": "catalog_spectrum",
    "output_key": "reference_spectrum"
})
spectro run response_from_standard --input spectrum.fits \
  --param fit=spline \
  --param spline_knots=20 \
  --param poly_order=5 \
  --param exclude_regions=none \
  --param sigma_clip=3.0 \
  --param max_iter=3 \
  --param catalog_key=catalog_spectrum \
  --param output_key=reference_spectrum
{
  "tool": "response_from_standard",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "fit": "spline",
      "spline_knots": 20,
      "poly_order": 5,
      "exclude_regions": null,
      "sigma_clip": 3.0,
      "max_iter": 3,
      "catalog_key": "catalog_spectrum",
      "output_key": "reference_spectrum"
    }
  }
}

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

References

  • Oke 1990, AJ 99, 1621 — flux calibration with secondary standards.
  • Bessell 1999, PASP 111, 1426 — UBVRI flux standards review.
  • Hamuy et al. 1992 PASP 104, 533 + 1994 PASP 106, 566 — Southern spectrophotometric standards.
  • Bohlin et al. 2014, PASP 126, 711 — CALSPEC HST standard stars.