Personal tools
You are here: Home / COSMOS / adjust-map


Back to Programs


adjust-map uses a comparison arc image to make small corrections to the mapping created by map-spectra.

USAGEadjust-map -m mapfile -f framename[s] [-d interval]
INPUT is the name of an existing map file
framename[s] is one or two sets of image files with images of a comparison arc
interval: diagnostic parameter; every 1/interval fit is plotted
OUTPUT is a new mapfile is a plot of the fits to each spectrum
mapfile.rms is the RMS of the fits to each spectrum
linelistfile with list of comparison lines to use [with optional weights]
search_heighthalf-height (in pixels) of region searched for line
search_widthhalf-width (in pixels) of region searched for line
slit_widthwidth of slit (in pixels)
ord_dispslit order of dispersion error fit
ord_sagslit order of y position error fit
ord_tiltslit order of tilt position error fit
ord_curvslit order of curvature error fit
fit_tiltfit slit tilt?
siglimitrejection limit for line offsets in the dispersion, in units of std deviation
edgesize of region at ends of slit to exclude in dispersion direction adjustment (in pixels)
iterationsnumber of iterations of fit to line offsets
outlier-wtunderweight outlying point?
nclumpnumber of points in clumps for underweighting
histogramuse histogram to reject lines outside search region?


Using an existing spectral map, adjust-map searches in the region of each spectral line to calculate an offset. All offsets for one spectrum are fit to a polynomial which is used to correct the polynomial solutions in the spectral map. If the parameter iterations is greater than 1, the order of the fits is reduced by 1 on the first iteration, and points which deviate from the fit by more than siglimit times the standard deviation are excluded from the next iteration.

The order of the fits must be no greater than the order of the original map: which is 7 for ord_disp and 5 for ord_sag. Take care if using high order fits: unless you have very many comparison lines you may make things worse rather than better. Also, the parameters search_height and search_width should be set with care. If set too large, the line search may find the incorrect line- either a neighboring comparison line in the same spectrum, or a line in an adjacent spectrum. If the initial map errors are comparable to the spacing between comparison lines and/or spectra, begin with a value of the search parameters which is sufficiently small so that no misidentifications will occur, and iterate the solution several times until it converges. Considerable care should also be devoted to selected a good set of comparison lines. Lines near to other, brighter lines are particularly to be avoided. If, as occasionally happens, the ends of the slit are badly cut, edge may be set to a non-zero value to exclude the slit ends in the adjustments in the wavelength direction.

The quality of the fits may be tested by setting the diagnostic parameter to a value other than zero, in which case each nth fit is plotted. Green points are those which were used on the final iteration; red points were excluded. Inspection of these plots will help the user set the optimal order for the fits, and also look for any troublesome comparison lines. In diagnostic mode no output files are written. If not run in diagnostic mode, plots of the fits to all spectra are output into a file named

If the order of the adjustment to either fit is set to a negative number, no correction of that fit is made.

It is often useful to interpolate between two comparison arc exposures which, for example, bracket an object spectrum. If two framenames are provided, the map adjustment is the mean of that of the two frames. The output mapfile name is a composite of the two framenames; e.g. from ccd0029 and ccd0030, a mapfile is produced.

Suggested fit order is 3 to 4 for ord_disp, 1 to 3 for ord_sag, but the order for ord_disp may need to be lowered if there are insufficient comparison lines.

Two options are available to improve the quality of the fits:

  1. In the line list file, if a second number follows the wavelength, it is used as a weight for the line in the fitting process. Lines without a weight are assigned weights of unity.
  2. If outlier-wt is set to y, a nearest neighbor algorithm is used to identify outlying points, which might be due to misidentified lines (usually caused by interference with a neighboring spectrum). Points which are far from other points are weighted inversely by the square of their distance to neighbors.

fit_curvfit slit line curvature?
h_ord_disphole order of dispersion error fit
h_ord_saghole order of y position error fit
h_ord_tilthole order of tilt position error fit
h_ord_curvhole order of curvature error fit
h_fit_tiltfit hole tilt?
h_fit_curvfit hole line curvature?
s_siglimitrejection limit for line offsets in the y-distortion, in units of std deviation
t_siglimitrejection limit for line offsets in the tilt, in units of std deviation
c_siglimitrejection limit for line offsets in the curvature, in units of std deviation

Important note: It is strongly recommended that bias-subtracted frames be used with adjust-map. Slit positions of weak lines in frames without bias subtraction may be less accurate.

Back to Programs