wavelength_calibrate_polynomial¶
Fit a polynomial to (pixel → wavelength) pairs, or apply known coefficients.
| Category | Wavelength calibration |
| Backend | numpy - implemented here on top of numpy primitives |
| Version | 1.1.0 |
| Reads | ctx.spectrum (a Spectrum1D) |
| Writes | spectrum, metrics.calibration_rms_angstrom, metrics.applied, metrics.wavelength_min_angstrom, metrics.wavelength_max_angstrom, metrics.dispersion_angstrom_per_px |
The polynomial is fitted with numpy.polynomial.Polynomial.fit, which handles the domain mapping so high orders stay well-conditioned. pixel_positions are 0-based indices on the current ctx.spectrum.wavelength axis (see the class docstring). v1.1.0 — apply mode: with coefficients the brick evaluates the given polynomial instead of fitting one ; coefficients_order says whether the list is lowest-degree first (numpy.polynomial convention, the default) or highest-degree first (numpy.polyval convention), pixel_offset is added to the pixel axis before the evaluation (absolute detector columns). The new axis must be strictly increasing, otherwise the brick fails and points at the coefficient order. Apply mode writes meta['wavelength_calibration'] = {method: 'polynomial_coefficients', coefficients, coefficients_order, pixel_offset}, wavelength_calibrated = True and needs_wavelength_calibration = False, and reports applied, wavelength_min_angstrom, wavelength_max_angstrom and dispersion_angstrom_per_px (no calibration_rms_angstrom: nothing was fitted). It does not resample: chain resample_linear for a uniform grid. The fit path (coefficients absent) is byte-identical to 1.0.1.
Parameters¶
| Parameter | Default | Required | Description |
|---|---|---|---|
pixel_positions |
None |
- | List of 0-based pixel indices identified in the arc spectrum (same frame as ctx.spectrum.wavelength; first sample = 0). |
wavelengths_angstrom |
None |
- | Rest wavelengths corresponding to those pixels (Å). |
order |
3 |
- | Polynomial degree (fit mode). |
coefficients |
None |
- | Known polynomial coefficients λ(x) in Å (apply mode, no fit); at least two. Leave null to fit pixel_positions / wavelengths_angstrom. |
coefficients_order |
'lowest_first' |
- | 'lowest_first' (c0 + c1·x + c2·x² …, numpy.polynomial convention) or 'highest_first' (numpy.polyval convention). |
pixel_offset |
0 |
- | Added to the pixel axis before evaluating the coefficients: the detector column of the spectrum's first sample when the solution is expressed in absolute columns (apply mode only). |
Use it¶
{
"tool": "wavelength_calibrate_polynomial",
"arguments": {
"session_id": "<session_id>",
"params": {
"pixel_positions": null,
"wavelengths_angstrom": null,
"order": 3,
"coefficients": null,
"coefficients_order": "lowest_first",
"pixel_offset": 0
}
}
}
Every algorithm is an MCP tool of the same name; describe_algorithm returns
this page's metadata as JSON.
References¶
- Tody 1986, Proc. SPIE 627, 733 — IRAF identify: polynomial dispersion solution fitted through identified arc lines.
- Tody 1993, ASP Conf. Ser. 52, 173 — IRAF in the Nineties (identify / dispcor dispersion functions).
- Massey & Hanson 2013, Astronomical Spectroscopy, in Planets, Stars and Stellar Systems vol. 2, Springer, DOI 10.1007/978-94-007-5618-2_2 (arXiv:1010.5270) — dispersion solutions as low-order polynomials of the detector column.
Related algorithms¶
fit_emission_lines_gaussian- Measure sub-pixel centroids of several emission lines at once.match_lamp_lines- Auto-identify arc-lamp lines against the bundled NIST atlas.measure_arc_geometry- Measure smile_radius + slant_deg from an arc-lamp 2-D image.refine_wavelength_zeropoint- Zero-point correction of a calibrated axis from one emission line of the spectrum itself.reidentify_arc_features- Re-anchor stored (pixel, λ) arc features onto a fresh arc exposure.wavelength_calibrate_easyspec- Fit a wavelength polynomial viaextraction.wavelength_calibrationand apply it.wavelength_calibration_in_situ- Refine the wavelength zero-point from simultaneously-acquired sky lines.wavelength_calibration_solar- Calibrate a solar spectrum from built-in Fraunhofer line wavelengths.