Skip to content

fit_telluric_scaling

Fit the airmass that best matches a telluric template to ctx.spectrum.

Category Corrections
Backend scipy - implemented here on top of scipy primitives
Version 1.0.1
Reads ctx.spectrum (a Spectrum1D)
Writes extras.telluric_fit, extras.telluric_template_scaled, metrics.telluric_airmass_fit

Only wavelengths inside the telluric bands carry information for this fit. The algorithm restricts the residual to the regions where the template transmission drops below band_threshold (default 0.9 — i.e. pixels where the template absorbs at least 10%). Outside those regions the spectrum is dominated by continuum / stellar lines and would only bias the fit. The rescaled template is written to ctx.extras['telluric_template_scaled'] (on the observed wavelength grid), which remove_telluric_division picks up by default.

Parameters

Parameter Default Required Description
template_key 'telluric_template' - Where to read the template from ctx.extras (output of synth_telluric).
band_threshold 0.9 - Pixels of the template where T < threshold count as 'inside a band'.
airmass_min 0.5 - Lower bound of the airmass search interval.
airmass_max 4.0 - Upper bound of the airmass search interval.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("fit_telluric_scaling", ctx, {
    "template_key": "telluric_template",
    "band_threshold": 0.9,
    "airmass_min": 0.5,
    "airmass_max": 4.0
})
spectro run fit_telluric_scaling --input spectrum.fits \
  --param template_key=telluric_template \
  --param band_threshold=0.9 \
  --param airmass_min=0.5 \
  --param airmass_max=4.0
{
  "tool": "fit_telluric_scaling",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "template_key": "telluric_template",
      "band_threshold": 0.9,
      "airmass_min": 0.5,
      "airmass_max": 4.0
    }
  }
}

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

References

  • Beer-Lambert atmospheric transmission scaling: T(airmass) = T(1)^airmass.
  • scipy.optimize.minimize_scalar.