ERIS Pipeline Reference Manual 1.8.15
Functions
Utilities for wavelength calibration

Functions

cpl_matrix * enwu_linepos_2d (const hdrl_image *spectrum2d, const cpl_size slice_index, const cpl_vector *guess_pos)
 Fit the line peaks of a wave calibration spectrum.
 

Detailed Description

Function Documentation

◆ enwu_linepos_2d()

cpl_matrix * enwu_linepos_2d ( const hdrl_image *  spectrum2d,
const cpl_size  slice_index,
const cpl_vector *  guess_pos 
)

Fit the line peaks of a wave calibration spectrum.

Returns
A cpl_matrix with dimensions [nx, nlines], where nx is the number of columns in the 2d spectrum, nlines the size of guess_pos.

The function fits line peaks across the 2d wave calibration spectrum from a slit spectrograph.

Starting in the middle x position, and iterating upward in x across the right hand side of the 2d image, the routine looks at y-slices in turn.

For each slice the 1d spectrum and the current guess vector are passed to enwu_linepos_1d, which returns a vector of fitted positions. Successful fits in that vector are stored in the return matrix, and used as the 'guess' for the next slice. In this way, the routine can follow the curve of lines with x if the movement is gentle.

Unsuccessful fits in the vector are not stored in the return matrix and do not propagate to the next 'guess', instead the current 'guess'is carried over. This is intended to make the 'guess' more robust against noisy pixels which can throw the fit off in isolated cases, and once the guess goes wrong the algorithm fails.

The process is repeated for the left side of the 2d spectrum, starting in the middle and iterating downward in x.

The routine will return NULL if entered with the CPL error code set.

The routine will return NULL, and set CPL error code to CPL_ERROR_NULL_INPUT if called with spectrum2d or guess_pos NULL.

The routine will return NULL, and set CPL error code to CPL_ERROR_ILLEGAL_INPUT if guess_pos has 0 elements.

Elements of the return matrix for which the fit failed will be set to NaN.

Definition at line 87 of file eris_nix_wavecal_utils.c.

References hdrl_image_get_image_const(), and hdrl_image_get_size_x().