The command `CALIBRATE/LONG` approximates the dispersion
relation for each searched row of the arc
spectrum. The algorithm can be activated in different modes,
controlled by the parameter `WLCMTD`:

- The mode
`IDENT`must be used if the lines have been identified interactively using`IDENTIFY/LONG`. - The mode
`GUESS`allows a previously saved session to be used (command`SAVE/LONG`) for the determination of the dispersion relation. The two observation sets must in principle correspond to the same instrumental set-up. Limited shifts (up to 5 pixels) are taken into account by a cross-correlation algorithm. The name of the reference session must be indicated by the parameter`GUESS`. - It is also noteworthy to indicate the presence of a mode
`LINEAR`introduced in the package for the purpose of on-line calibration. This mode is still**in evaluation phase**and allows the results of the command`ESTIMATE/DISPERSION`to be taken into account in the calibration process.

The command `CALIBRATE/LONG` provides the following results:

- The coefficients of the dispersion relation for each searched
row of the two-dimensional spectrum are computed as a series
of polynomials
.
The results are written in the
table
`coerbr.tbl`. - The starting, final and average step wavelength
of the spectrum
are estimated and written in the keywords
`REBSTRT, REBEND, REBSTP`used by the commands`REBIN/LONG`and`RECTIFY/LONG`. - A two-dimensional dispersion relation of the form
is estimated if the parameter
`TWODOPT`is set to`YES`. This bivariate dispersion relation is necessary to use the command`RECTIFY/LONG`. The resulting dispersion coefficients are stored in the keyword`KEYLONGD`.

The command `CALIBRATE/TWICE` performs a two-pass determination of
the dispersion relation. In a first pass, the lines are identified
by a standard `CALIBRATE/LONG`. Only the lines which have consistently
identified at all rows are selected for the second pass, which then
performs a new calibration on a stable set of arc lines. If
after selection a good spectral coverage of the arc spectrum is secured,
this method provides very stable estimates of the dispersion relation.

The command `PLOT/CALIBRATE` visualizes the lines found by the
calibration process. The dispersion curve and the lines that were
used to determine it are presented by `PLOT/DELTA`. Residuals
to the dispersion curve are plotted by `PLOT/RESIDUAL`. For
two-dimensional spectra, the command `PLOT/DISTORTION` can be
used to check the stability of the dispersion relation along the
slit.

The iterative identification loop consists of estimating the wavelength of all lines in the arc spectrum and associate them to laboratory wavelengths to refine the estimates of the dispersion relation. The line identification criterion will associate a computed wavelength to the nearest catalog wavelength if the residual:

is small compared to the distance of the next neighbours in both the arc spectrum and the catalog:

where
is the distance to the next neighbour in the
line catalog,
the distance to the next neighbour in the
arc spectrum and *alpha* the tolerance parameter. Optimal values of
are in the range
.
The tolerance value is
controlled by the parameter `ALPHA`.

Lines are identified in a first pass without consideration of the rms of
the residual values by an iterative loop controlled by the parameter
`WLCNITER`. The residuals for each line are then checked in order
to reject outliers which residual is above the value specified by the
final tolerance parameter `TOL`. The degree of the polynomials
is controlled by the parameter `DCX` and the iterative loop is stopped
if residuals are found to be larger than `MAXDEV`.