Ravere *

Introduction
The overall goal of this software is to obtain radial velocities from stellar spectra.  Pre-processing (bias removal, dark subtraction, and flat-fielding -- where required) is expected to have been done by programs such as MIRA, AIP4WIN, etc.  This program then provides intermediate capabilities replacing the following IRAF functions:

Part I:  ccdproc (strip overscan strip, trim edges as required), apall (correct trace, set apertures, fit background, extract spectrum 2D to 1D), and continuum (normalize continuum level across the wavelength range).

Part II:  identify (identify arc lines, fit deviations on the wavelength scale from linear fit) and dispcor (correct dispersion for object file, and write initial wavelength and pixel scale to the FITS header).

The final step is to use BROAD.exe, a Windows formulation of Rucinski's Broadening Functions, to determine apparent radial velocities by the method of singular value decomposition.  It is available from the author's website:  members.shaw.ca/bob.nelson.

Part I  Convert 2-D Frames to 1-D (objects, arcs)

1. Load 2-D frame.
This is obvious, except that some observatories save CCD image files in non-standard forms.  The DAO in Victoria, BC, Canada is one of these.  Images whose data are indicated by the header to be 16-bit unsigned (BITPIX = 16) are not.  If the maximum pixel value is less than 32,768 there is no problem; values will be read in correctly. However, if there are pixel values bigger than this, they will be read in as negative.  This problem is not too difficult to detect  if the data type is indicated as 16 and you see negative values near places of high intensity (black marks on the image), you have a non-standard data type.  In that case, just load images by [menu] File > Load DAO Non-standard 2-D File and hopefully all will be well..

2. Fix bad column #
If you have a bad column, enter the column number and this program will replace bad values (off the trace) by the average values on either side on the same row.  (This column number in the little box is saved.)  If there is no bad column, skip this step.

3. Trim overscan, etc.
CCD chips are often larger than the image produced by the spectrograph.  Therefore there will be unused rows and columns.  Unused rows are not a problem, but unused columns are.  You can determine the valid column numbers by examining the image by a viewer such as AIP4WIN, MIRA, CCDSoft, etc.  Then enter the corners of the rectangle that you want to keep in the appropriate boxes.  Illegal values should be trapped out.

4. Fix Trace (for cosmic ray hits) Start row #
For exposures longer than 5 or 10 minutes or so, cosmic ray hits will be a problem.  You could use software such as MIRA Pro, with its cosmic ray filter; however, the correction on the trace may be suspect, and the correction off the trace is irrelevant (since the background fit  which uses the median function  filters out extreme values anyway).  

To use this function, first find the column numbers of the trace (you can use Plot Vertical Slice for this, then exit that function).  Then set the little box on the main form for the starting or ending row number (the value will be saved for future use).  Click Fix Trace .  You will see a graph of the pixel values along the indicated row.  Youll see cosmic ray hits as sharp vertical spikes.  To remove a spike, left-click just to the left of the spike and left-click again just to the right.  This will zoom in.  Then right-click on the offending column(s) and left-click on Zap.  To return automatically to full row, click if necessary [menu] Options > Full Row after Zap.

Go to the next row using the vertical slider and repeat as required.

5. Set Aperture, Fit Background in Y-slice
Click Plot Vertical Slice  and the pixel values of the indicated column will be displayed.  You need to indicate the range of rows in the trace that will be added up.  Left click on the starting column and again on the ending column. (It works best if you click just to the right of the vertical line you want to select.)

Next you need to indicate the background ranges.  There are two of them, one on each side of the trace.  Right click at the ends of the left-hand range and right click at the ends of the right-hand range.  (The order is unimportant as long as you work on one range at a time.)  Next, click Fit Background.  If you have selected Power 0  Median (Horiz.) [this is the default selection], the median pixel value in the background apertures will be subtracted from each of the values in the trace aperture in step 6.  (Therefore cosmic ray hits in the background will be ignored.)  Click OK to complete the aperture selection and background fitting.

6 Transfer 2-D to 1-D
Click Crunch ! to add up the values within the trace aperture and subtract off the background.  This operation transfers the 2-dimensional image to a 1-dimensional one.

7. Normalize Continuum (skip for arcs)
The background needs to be made flat.  We are not interested in preserving shape of the continuum  just the wavelengths.  The continuum needs to be made horizontal for the Rucinski Broadening Functions routines.

You can fit the background automatically or manually (the latter is preferred).  For the manual method, left-click on the high points on the spectrum.  (Use the right click to de-select points.)  Once you have a string of points that you feel adequately delineate the continuum, click Fit Bkgrd.  If you like the fit, click Normalize; if not, click Reset.  After Normalize, if you want to go back, click Revert.  Once you are happy, click OK.  Dont forget to save, by clicking Save 1-D Frame .

Note that when you are selecting apertures for arc spectra in step 5, you may have to hunt around for the column of one of the lines.  Also, you do not want to try to normalize the continuum of arc spectra  it is largely done already!

Part II  Calibrate 1-D Object Frames

8. Load Arc Frame(s)
Click Load  under Arc 1 or Arc 2.  If you try to load a 2-Dimensional image you will get an error message.  If you try to load a 1-d image from a star, it will not plot correctly, and why would you want to do this?

9. ID Arc Lines, fit correction
Here is the tricky bit.  You will need to identify the first two lines of the arc spectrum.  Left click near the peak of a line whose wavelength you know (it is not necessary to hit the peak accurately, the program centroids) and type in the wavelength (in Angstroms) to at least two decimal places.  [There is a table of wavelengths included in the package in the text file entitled WL_table.txt.]  Click Update/Done.  Now left-click on the next line and enter the wavelength as before.

After the first two wavelengths have been entered, the program has an approximate fit and  when you left-click on a line  it will try to pick the wavelengths from the table automatically.  If the fit is good (deviations less than 1 Angstrom), click Update/Done; if it is poor, use the slider on the right to look at other values from the table that might be better, or click Cancel.

In this way, make identifications roughly evenly spaced across the spectrum.  Try to get values as close as possible to the ends, as large gaps will produce errors in the extrapolation.

When you are satisfied, click Calc. Fit.  If you see a point that lies off an obvious curve, put the cursor cross-hair on it and note the column number.  Click Cancel to return to the pervious screen, right-click on the offending line, click Delete Entry, and try again.  On the next screen, click Fit Differences.  If you like the fit, click OK and exit; if not, click Reset, or Cancel to go back.

If the above identification and fit have been successful, there is no need to enter the wavelengths each time  create and save a mask!  Go back to the plot by clicking Plot Arc 1, click Save Mask and save the file of values in a simple text file.  These values will be retained as long as Ravere is running; if you restart the program, you can reload the values for the mask by clicking Load Mask.

Once the mask is loaded, the sequence each time is Apply Mask, Calc Fit, Fit Differences and OK.  This is quite quick but is somewhat repetitive. The reason that I have not automated the whole process is that you are suppose to keep an eye on the Plot Differences plot to monitor any problems that might arise.

10. Load Object Frame  1-D
Load the 1-D image (spectrum) of the standard or program star for which you wish to correct the dispersion.

11. Correct the Dispersion in Object Spectrum
Click Fix ! and you are finished.  The non-linear dispersion of the raw spectrum has been corrected to linear, and the following values have been written to the header: the wavelength of the first pixel and the reciprocal dispersion (in Angstroms/pixel).  Look for the identifiers CRVAL1 and CD1_1, respectively.  Do not ask where these silly names came from  I just used the same names that IRAF uses.


-Bob Nelson, Prince George, BC, Canada, 2006-05-08

* Apologies to Paul Revere (whose name is spelled differently).  This is an acronym, which is also a play on words (IRAF is coming, IRAF is coming!).

