Creating arc line maps for wavelength calibration

Wavelength calibration is done using exposures of arc lamps (e.g., thorium-argon, copper-argon, copper-neon), which emit light in many specific and very narrow wavelength ranges. You will need to construct an arc line map (which relates pixel position to wavelength) for each configuration of your telescope and instrumentation, and then apply this to the science spectra. Arc line maps can be constructed using molly and a diagram of the expected arc lines in your wavelength range (usually available from the webpage of the telescope or instrument). Once this is made, it can be applied to all the extracted science spectra to convert their pixel scale to an absolute wavelength scale.

Opening .sdf files in molly

Opening .sdf files in molly requires a list of the files you want to work with (with or without the .sdf extension). Create the list, start molly, and load in the files:

\ls *arco.sdf > arco.lis
molly
lndf arco.lis 1
axes p c
plot 1 1 \

The last lines set the plotting axes to pixels versus counts and plot the first spectrum.

Making an arc line map and calibrating your arc spectrum

In molly, go into the arc sub-menu and plot the first arc spectrum there:

arc 1
plot
[press enter]

Inspect this and compare it to the arc line map from the observatory webpage to see how the two relate. Now start to construct a new arc map by automatically detecting the four to five strongest lines:

new
[press enter]
[give high threshold]
4
2

The number of lines detected will be reported. Now you need a text file containing two columns: arc line wavelengths (Angstroms) and identifications (e.g. 'Ne I' or 'Ar I'). If you haven't got this, then it is possible to enter wavelengths individually at the terminal. Alternatively, the ING website has decent plots of arc lines here, or you could use Tom's own line lists for neon, argon and helium .

Start arc line identification and select all lines:

id
[min], [max]
C

New enter D and the filename of your arc line wavelength file. Repeat if you have several files. The program will now ask you to enter wavelengths for your lines, and it will compare those values to the ones in the file you have given it. Adopt one of the values (usually the one in the file, to avoid propagating typing errors) for each line. Leave the arcident sub-sub-menu by entering 0 0 when it asks for a range of lines to identify.

Now you have entered a few arc line wavelengths, it is time to fit them and plot up the residuals:

fit
P

Check that things look fine (the residuals should normally be pretty small). If not, then see below.

Now it is time to increase the number of lines with identifications. Use the new command again, but lower the threshold so you are picking up about 10 lines. When you go through the id command, molly will interpolate the existing polynomial fit to the new lines it has found, and suggest wavelengths from the file of wavelengths you gave it. Refit this using fit and study the residuals of the fit: you will probably need to increase the order of the polynomial fit (which is 2 - linear - by default) by entering C in the fit sub-sub-menu.

Now you have a higher-order polynomial fitting your wavelengths, run the new command once more with a low threshold to detect all the lines which are strong enough to be reliable. Run through id again to assign these wavelengths and refit again.

Once you have reached a good final fit, save the corresponding arc line identifications to a file (dump command in the arc sub-menu) and create a master arc fit (through the fit command in the arc sub-menu). On exiting the arc sub-menu you will find that the arc spectrum you worked on now has a wavelength calibration.

Problems with arc line map generation

There are several ways in which the arc map generation can go wrong.

If the residuals of the best fit have significant structure, then you will need to increase the order of the fit: enter C in the fit sub-sub-menu to do this. A third order fit is usually not enough.

If the residuals of the fit are large (more than a pixel is usually an indication that something is well wrong) then one or two dodgy line identifications could be throwing everything off. Add in enough lines so that it is clear which is/are wrong, and mask them (using the edit subcommand). Don't delete them, as this will cause the line data to be forgotten and the arc lines to be renumbered.

Some lines can go dodgy if they are close to another line of broadly similar strength. These blends are generally not reliable so are best avoided. Reject any line which is or may be affected by blending and refit the wavelengths. Also, decreasing the Gaussian FWHM (4 was used for this above) might solve a few minor blending problems.

If everything is still going badly wrong, then start again. Identify a few reasonably strong lines which you are sure about, and give their wavelengths using the identify command. Gradually add in more lines once you have a basic calibration sorted.

If the above suggestions still do not work, then try to concentrate on one smallish region of the arc spectrum and work outwards gradually from there. If the fit is still not good enough, you may need a better arc spectrum or a more reliable line list.

Applying one wavelength calibration to a set of spectra

Now you have a wavelength-calibration arc spectrum, this calibration can be applied to the appropriate science spectra. Read these in to molly using lndf as before (first creating the list of spectra by issuing a shell command from within molly using the "!" symbol), and put them in the earliest slots which are free (by specifying "a" instead of a slot number). Then wavelength calibrate them:

!\ls 2*opt.sdf > opt.lis
lndf opt.lis a [big number] 1
acal  [first slot to do]  [last slot to do]  1 1 N  1.0e8 1.0e8 1.0e8

The acal command assumes that there is one arc spectrum which it applicable to all the science spectra, which is stored in slot 1. The final three large numbers effectively tell molly to just apply the arc calibration to all spectra irrespective of closeness in time or space between when the arc and the science images were obtained. Now plot your arc spectrum, then put in a vertical offset and plot all of your science spectra:

pl 1 1 \
offset 1000
pl  [first science slot]  [last science slot]

If you want to change the plot limits, you could either set them before plotting with the xyr command, or you could type plot and follow the prompts. Giving 0 0 for an axis range causes molly to choose its own range.

If you have a set of science images and several arc line calibrations, then you can use molly to automatically apply the appropriate calibration(s) to each science image. This is explained in the next section.