Skip to content

redshift_lines

Redshift z by per-line Gaussian fits against a list of rest-frame anchors.

Category Radial velocity
Backend scipy - implemented here on top of scipy primitives
Version 1.0.1
Reads ctx.spectrum (a Spectrum1D)
Writes metrics.z, metrics.z_error, metrics.n_lines_used, extras.matched_lines, extras.rows

Per-line Gaussian+constant fit in a window centred on the seeded λ_obs = λ_rest · (1 + z_guess); both emission and absorption amplitudes are tried, the better residual wins. Reported z is the median over surviving anchors ; z_error is the POPULATION standard deviation (np.std, ddof=0) of the per-line z values — a spread, not the error of the median — and both are rounded to 5 decimals (contract). Refuses to commit with < 2 matched lines (no spread). Non-finite samples are dropped and a descending wavelength axis is sorted before fitting (v1.0.1).

Parameters

Parameter Default Required Description
z_guess 0.0 yes Seed redshift (within ±z_search_width of the true value).
z_search_width 0.05 - Reject |z_est − z_guess| > this (z-units). Keeps catastrophic mis-identifications out of the median.
fit_window 15.0 - Half-window (Å) for each per-line Gaussian fit.
anchor_lines [['[O II] 3727', 3727.42], ['Ca II K', 3933.66], ['Ca II H', 3968.47], ['Hβ', 4861.33], ['[O III] 5007', 5006.84], ['Mg b', 5175.3], ['Na D', 5895.92], ['Hα', 6562.82], ['[N II] 6583', 6583.45]] - List of (name, λ_rest_aa) pairs to fit. Default = 9 strong SDSS-spec1d anchors (override for AGN templates etc.).

Use it

from spectro_kernel import run_algorithm

output = run_algorithm("redshift_lines", ctx, {
    "z_guess": 0.0,
    "z_search_width": 0.05,
    "fit_window": 15.0,
    "anchor_lines": [
        [
            "[O II] 3727",
            3727.42
        ],
        [
            "Ca II K",
            3933.66
        ],
        [
            "Ca II H",
            3968.47
        ],
        [
            "H\u03b2",
            4861.33
        ],
        [
            "[O III] 5007",
            5006.84
        ],
        [
            "Mg b",
            5175.3
        ],
        [
            "Na D",
            5895.92
        ],
        [
            "H\u03b1",
            6562.82
        ],
        [
            "[N II] 6583",
            6583.45
        ]
    ]
})
spectro run redshift_lines --input spectrum.fits \
  --param z_guess=0.0 \
  --param z_search_width=0.05 \
  --param fit_window=15.0 \
  --param anchor_lines=[["[O II] 3727",3727.42],["Ca II K",3933.66],["Ca II H",3968.47],["H\u03b2",4861.33],["[O III] 5007",5006.84],["Mg b",5175.3],["Na D",5895.92],["H\u03b1",6562.82],["[N II] 6583",6583.45]]
{
  "tool": "redshift_lines",
  "arguments": {
    "session_id": "<session_id>",
    "params": {
      "z_guess": 0.0,
      "z_search_width": 0.05,
      "fit_window": 15.0,
      "anchor_lines": [
        [
          "[O II] 3727",
          3727.42
        ],
        [
          "Ca II K",
          3933.66
        ],
        [
          "Ca II H",
          3968.47
        ],
        [
          "H\u03b2",
          4861.33
        ],
        [
          "[O III] 5007",
          5006.84
        ],
        [
          "Mg b",
          5175.3
        ],
        [
          "Na D",
          5895.92
        ],
        [
          "H\u03b1",
          6562.82
        ],
        [
          "[N II] 6583",
          6583.45
        ]
      ]
    }
  }
}

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

References

  • Stoughton et al. 2002, AJ 123, 485 — SDSS spec1d redshift pipeline (anchor-line seed approach).
  • Bolton et al. 2012, AJ 144, 144 — BOSS spec1d (template-based refinement on top of an anchor-line seed).
  • Kramida et al., NIST ASD — air rest wavelengths of the anchor lines.