modules.wavelength_calibration

KPF Wavelength Calibration module.

Copies the per-fiber wavelength solution from a precomputed master WLS L2 product onto a science L2. The master is located by CalibrationAssociation, which writes the full WLSFILE path to the RECEIPT header (its registry home); to_kpf2 forwards the L1 RECEIPT header to the L2, where this module reads it.

class kpfpipe.modules.wavelength_calibration.WavelengthCalibration(l2_obj, config=None)

Bases: object

Apply a precomputed wavelength solution to an extracted KPF L2 frame.

Reads WLSFILE (full path, legacy convention) from the L2 RECEIPT header (written by CalibrationAssociation on the L1 RECEIPT and carried through by to_kpf2), loads the corresponding KPFMasterL2, and copies each per-fiber {CHIP}_{FIBER}_WAVE array onto the science L2.

Parameters:
  • l2_obj (KPF2) – Extracted L2 frame. The RECEIPT header must contain a WLSFILE keyword.

  • config (None | dict | ConfigHandler) – Module configuration. Recognized keys: chips, fibers.

info()

Print a summary of the module configuration and association results.

load_wls(wls_path=None)

Load the master wavelength solution from disk.

If wls_path is provided it is used directly, bypassing the header lookup. Otherwise the path is read from WLSFILE in the L2 RECEIPT header (where CalibrationAssociation wrote it as a full path per the legacy WLS convention).

Parameters:

wls_path (str, optional) – Direct path to a master WLS L2 FITS file.

Returns:

The loaded master WLS data model.

Return type:

KPFMasterL2

Raises:
  • KeyError – If neither wls_path is given nor WLSFILE is present in the L2 RECEIPT header.

  • FileNotFoundError – If the resolved path does not exist.

perform(chips=None, fibers=None, *, wls_path=None)

Copy the master wavelength solution onto the science L2.

For every (chip, fiber) in the configured chips × fibers, copies {CHIP}_{FIBER}_WAVE from the master L2 onto the science L2. The chip-prefix keys resolve through the KPF2 alias system into slices of the underlying concatenated TRACE{n}_WAVE arrays.

Parameters:
  • chips (list of str, optional) – Chip identifiers, e.g. [‘GREEN’, ‘RED’]. Defaults to self.chips.

  • fibers (list of str, optional) – Fiber identifiers, e.g. [‘SKY’, ‘SCI1’, ‘SCI2’, ‘SCI3’, ‘CAL’]. Defaults to self.fibers.

  • wls_path (str, optional) – Direct path to the master WLS L2 file. If omitted, the path is read from WLSFILE on the L2 RECEIPT header.

Returns:

l2_obj – The input L2 with per-fiber _WAVE extensions populated and a ‘wavelength_calibration’ receipt entry. WLSFILE on RECEIPT is left untouched.

Return type:

KPF2