ARC N -- Fits wavelength scale to an arc spectrum

        N -- The arc to be fitted. Can be changed inside routine.

 ARC is interactive in nature and has many commands inside it.
 The general aim is to identify arc lines with specific wavelengths
 and fit a polynomial to the result. This can then be interpolated
 onto object spectra later. An outline of the procedure is as follows:

 First use 'NEW' to measure positions of lines in the arc spectrum (uses 
 cross-correlation with a gaussian of user specified FWHM). I normally use
 a FWHM comparable to the lines, but it should not matter. However, you should
 always use the same FWHM for all lines, and sometimes smaller FWHM may be
 less affected by closely spaced lines. Another parameter here allows one to
 avoid having lines too closely spaced. Next 'IDENTIFY' 2 or 3 lines spanning 
 as much of the wavelength range as possible (not very critical though).
 Come out of 'IDENTIFY' and 'FIT' a poly (2 coefficients to start), and then
 go back into 'IDENTIFY'. The routine will then predict wavelengths for the
 lines which helps greatly. If you have a good list of lines then these can
 now be loaded. With more lines you can see if a higher order fit is needed, 
 going back into 'FIT' etc, until you have completed the process. Check for
 blends and dump your line list to disk. You should only use good lines that
 will not be present in one spectrum but not another.

 For similar arcs, load your line list, 'TWEAK' the positions and then refit.
 If during the tweak, all the shifts are similar, then you are OK. If one is
 obviously discrepant, the line may have been a blend or weak, and it may be
 better to discard it, in which case you should re-do the original fit for
 consistency. Sometimes by applying an appropriate guess at the shift it is
 possible to recover such lines. It is however important to use the SAME set
 of lines for all your arcs, even if it means redoing every one because you
 cannot get the position of a line in your very last arc although you could
 in all the others. 

 If you have taken several different arcs at the start of the night which 
 give a good scale but then only observed one of them during the night
 to save time, you can first fit many lines with a high order poly and set
 it as a 'master' polynomial inside 'FIT'. For the nighttime arcs you can then
 just fit a few low order coefficients.
 Once you have finished, come out of ARC and dump the calibrated spectra. You
 can use 'DRIFT' to plot the drift of arc scale with time. Particularly useful
 if you are following a single object for a long time.

 Once you are underway with the TWEAK, FIT cycle, you can use 'COMB' to apply
 them to a succession of arcs, with no questions asked. If you are running this
 in a batch mode, I recommend that you set it to abort if any tweak fails ('ABORT').
 This flags the dangerous possibility that the first tweak fails without you noticing
 it. It aborts on all failures within the tweak section except failure to find a
 spectrum within the 'combination' section (which often occurs if one enters a range 
 guaranteed to exceed the number of arc spectra to ensure that you get them all).

 Typically I proceed as follows: first I fit as many lines as possible in one arc
 (or perhaps several arcs as long as they were taken under the same conditions).
 These define the high-order fit. You must go through every line carefully to check against
 blends; no short cuts here. I dump the final list to two files, one 'master_arc.lis',
 the other 'tweak_arc.lis'. When I calibrate everything in batch mode, I begin by loading
 the master arc list, and setting up a high order master polynomial. I then set it to
 tweak the lowest 2 or 3 terms. Then I load the tweak list, tweak it once to set up the
 tweak parameters, and then run 'combination' on all the arcs. 

 Very often, over the course of tens of arcs, one or more of the lines will fail during 
 a tweak. You then must delete it from the tweak list (I just do this to the disk file with
 'emacs') and fit ALL arcs again. I do this again with a script and go through every single
 arc of a run to boil the tweak list down to the lines that are rock solid. You have to be careful
 at this stage that lines are not lost just because the arcs themselves are corrupt. Again this is
 a tedious and long drawn out process, with no short cuts.

Related command: acal , drift

This command belongs to the class: calibration

Tom Marsh, Warwick