Skip to content

atmospheric_extinction_correct

Remove atmospheric extinction : F_0 = F · 10^(0.4 · k(λ) · X) with a mean site curve.

Category Corrections
Backend numpy - implemented here on top of numpy primitives
Version 1.0.0
Reads ctx.spectrum (a Spectrum1D)
Writes spectrum, metrics.airmass, metrics.k_mag_median, metrics.n_outside_curve

F_0(λ) = F(λ) · 10^(0.4 · k(λ) · X). curve='kpno' (default) uses the IRAF KPNO mean extinction table (82 nodes, 3200–10400 Å, mag/airmass) reproduced verbatim ; per the file's own note its last four nodes, 8708–10400 Å, are CTIO values) — a MEAN curve for a 2 km site, not a nightly measurement : expect a few 0.01 mag/airmass of aerosol scatter, and prefer a curve measured at your own site. curve='custom' reads ctx.extras[extinction_table_key] : a Spectrum1D whose flux is k(λ), a dict with 'wavelength_aa' and 'k_mag' lists, or an (N, 2) array. The curve is linearly interpolated onto the spectrum ; samples outside the curve's wavelength range take the nearest end value (counted in metrics.n_outside_curve). Airmass precedence : the airmass parameter, then the FITS AIRMASS keyword, then the geometry (RA/DEC + DATE-OBS at mid-exposure + site latitude/longitude/elevation from parameters or the SITELAT/SITELONG/SITEELEV, LAT-OBS/LONG-OBS/ALT-OBS or OBS-LAT/OBS-LONG/OBS-ELEV keywords) with astropy AltAz (no refraction) and Kasten & Young 1989 Eq. 3 (X(0°) = 0.99971, X(60°) = 1.99429, X(80°) = 5.586, X(90°) = 37.92 — 0.1–0.3 % below sec z at 45–60°) ; the brick fails when none is available. Wavelengths must be in Ångström. The uncertainty is multiplied by the same factor (curve and airmass taken as noise-free). The correction removes the smooth continuum extinction only — the O2 / H2O telluric bands are handled by remove_telluric_division.

Parameters

Parameter Default Required Description
airmass None - Airmass X of the observation. None ⇒ FITS AIRMASS keyword, then computed from the geometry (Kasten & Young 1989).
curve 'kpno' - 'kpno' (IRAF KPNO mean table, default) or 'custom' (user table in extras).
extinction_table_key 'extinction_table' - ctx.extras key holding the user extinction table when curve='custom' (Spectrum1D with flux = k mag/airmass, {'wavelength_aa', 'k_mag'} dict, or (N, 2) array).
ra_deg None - Target right ascension (deg) for the geometric airmass ; None ⇒ FITS RA.
dec_deg None - Target declination (deg) for the geometric airmass ; None ⇒ FITS DEC.
obstime None - Start-of-exposure time (ISO-8601) ; None ⇒ FITS DATE-OBS.
exposure_seconds None - Exposure duration (s) — the airmass is evaluated at mid-exposure ; None ⇒ FITS EXPTIME, then 0.
latitude_deg None - Observer geodetic latitude (deg) ; None ⇒ SITELAT-style keywords.
longitude_deg None - Observer geodetic longitude (deg, east positive) ; None ⇒ SITELONG-style keywords.
elevation_m None - Observer elevation (m) ; None ⇒ SITEELEV-style keywords, then 0.

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("atmospheric_extinction_correct", ctx, {
    "airmass": None,
    "curve": "kpno",
    "extinction_table_key": "extinction_table",
    "ra_deg": None,
    "dec_deg": None,
    "obstime": None,
    "exposure_seconds": None,
    "latitude_deg": None,
    "longitude_deg": None,
    "elevation_m": None
})
spectro run atmospheric_extinction_correct --input spectrum.fits \
  --param airmass=none \
  --param curve=kpno \
  --param extinction_table_key=extinction_table \
  --param ra_deg=none \
  --param dec_deg=none \
  --param obstime=none \
  --param exposure_seconds=none \
  --param latitude_deg=none \
  --param longitude_deg=none \
  --param elevation_m=none
{
  "tool": "atmospheric_extinction_correct",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "airmass": null,
      "curve": "kpno",
      "extinction_table_key": "extinction_table",
      "ra_deg": null,
      "dec_deg": null,
      "obstime": null,
      "exposure_seconds": null,
      "latitude_deg": null,
      "longitude_deg": null,
      "elevation_m": null
    }
  }
}

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

References

  • Hayes & Latham 1975, ApJ 197, 593 — mean atmospheric extinction (Rayleigh + aerosol + ozone) and the 10^(0.4 k X) correction.
  • Kasten & Young 1989, Applied Optics 28, 4735 — airmass formula X = 1/[cos z + 0.50572 (96.07995 − z)^−1.6364] (Eq. 3).
  • Tody 1986, Proc. SPIE 627, 733 — IRAF ; the built-in curve is onedstds$kpnoextinct.dat (KPNO mean extinction, 3200–10400 Å).
  • Hardie 1962, in Astronomical Techniques (ed. Hiltner), Univ. of Chicago Press, ch. 8 — extinction linear in airmass.