RVSAO -- An IRAF package to obtain radial velocities from spectra
 
The package RVSAO defined in this directory was developed by Jessica Mink at
the Harvard-Smithsonian Center for Astrophysics from the redshift package
originally written by Gerard Kriss at Johns Hopkins University and modified
significantly by Steve Levine at the University of Wisconsin.  It obtains
radial velocities and velocity dispersions using cross-correlation methods
or emission line fits.  It consists of several SPP tasks:
XCSAO and PXCSAO to cross-correlate spectra,
EMSAO and PEMSAO to find emission lines in spectra,
BCVCORR to compute solar system barycentric velocity correction,
SUMSPEC to add and/or modify spectra,
LINESPEC to creat synthetic emission line templates,
EQWIDTH to compute equivalent widths of lines in spectra,
WLRANGE Return the wavelength overlap range for a list of spectra
LISTSPEC List pixel, wavelength, delta wavelength, and/or pixel value for spectrum image
PIX2WL Compute the wavelength at a given pixel in a spectrum
WL2PIX Compute the pixel at a given wavelength in a spectrum
VELSET Artificially change the redshift of (log-wavelength) spectra
plus several CL scripts.

The Shell/ subdirectory contains CL scripts which include invocation of IRAF
and cn be run from the command line. If you put this directory in your search
path, you will have Unix command-line access to just about all of RVSAO's IRAF
tasks. Typing rvsao runs the script in that directory gives a list of commands
and a fairly complete explanation of how this works. Typing any of these shell
command without an argument gives a list of script-specific arguments.

If you have any problems, please contact Jessica Mink, jmink@cfa.harvard.edu.

A task, RELEARN, has been provided to aid in updating parameters.  Run it
instead of UNLEARN to keep your current parameters settings while adding
new parameters.  It can fail when parameters are dropped; just re-run it
until it works, and things will be OK. It is also an option in any of the
shell scripts.

A set of templates commonly used at the CfA is included in the templates/
subdirectory.  The README file contains some documentation about them.
There is more in 

After the Revision Notes, you will find installation instructions.

A fairly complete description of this package has been published in the
August 1998 issue of the Publications of the Astronomical Society of the
Pacific:
https://ui.adsabs.harvard.edu/abs/1998PASP..110..934K/abstract

For later publications, see http://tdc-www.harvard.edu/iraf/rvsao/papers/

-Jessica Mink, SAO Telescope Data Center, February 5, 2021

***************************************************************************

RVSAO Revision Log

2.8.4, February 5, 2021
EMSAO: Save individual apertures/orders when they are changed
emfit.x,emplot.x,xcfit.x,xcplot.x: Pass spectrum, specim in
comon/rvspec/ so that emplot can write to file(s)
Shell directory tasks updated to use IRAF2.16.1

2.8.3, July 6, 2015
* All .com and .h files are  in rvsao$lib only
BCVCORR: Fix bug keeping JD from parameter file
EMSAO,PEMSAO: Initialize savespec to FALSE
LISTSPEC: Bug fixed so appropriately-named file is written if requested
xcplot.x: Set qplot=TRUE if spectrum is edited

2.8.2, June 13, 2014
* Edit cosmic rays out of a spectrum by resetting a point at a time
* (using the , key) or by linearly interpolating between points on
* either side of a cosmic ray (using the d key twice).  The edited
* spectrum is automatically written out if you are running qplot or
* are saving information to the spectrum header and leave with "q".
XCSAO,EMSAO,PXCSAO,PEMSAO: Write back edited spectrum
xcfit.x: Call putspec to update spectrum after editing it (2014-05-02)
emplot.x: Fix bug which reversed red and blue limits (2013-03-15)
emplot.x: Add , command to replace individual pixel values (2014-05-01)
emplot.x: Add > command to write out edited spectrum (2014-05-02)
t_eqwidth.x: Drop declaration of results.com; it's not used

2.8.1, May 25, 2012
PEMSAO: Add maxlength parameter to set output spectrum file length in mode 11
xcrslts.x: add parameter maxlength to allow longer filename in mode 11

2.8.0, April 13, 2012
LISTSPEC: Add velform format for velocity per pixel output
SKYPLOT: Base on PEMSAO instead of XCSAO, like EMPLOT
juldate.x: Do not recompute HJD if already in header
juldate.x: Check for BJD as well as HJD

2.8.1, May 25, 2012
PEMSAO: Add maxlength parameter to set output spectrum file length in mode 11
xcrslts.x: add parameter maxlength to allow longer filename in mode 11

2.8.0, April 13, 2012
LISTSPEC: Add velform format for velocity per pixel output
SKYPLOT: Base on PEMSAO instead of XCSAO, like EMPLOT
juldate.x: Do not recompute HJD if already in header
juldate.x: Check for BJD as well as HJD
vcombine.x: Do not add constant dispersion error of 15 km/sec any more
xcfile.x: Only include file name in xc file if given full pathname
xcfile.x: Drop ".ms.fits" and ".fits" from object and template filenames
xcfile.x: Add ".xcor" file extension to output filename
xcfile.x: Fix bug by redimensioning title from SZ_LINE to SZ_PATHNAME
Add new shell script rvsaopar to set RVSAO task parameters from a dpar file
Add new shell script pxcsao to execute PXCSAO

See the NEWS file for the earlier history of the software.

***************************************************************************

To install this package in your local IRAF system, take the following steps:
 
1)	The package is distributed as a tar archive; IRAF is distributed
	with a tar reader.  The tar archive may be obtained over the web
	from http://tdc-www.harvard.edu/iraf/rvsao/rvsao-2.8.4.tar.gz

2)	Create a directory to contain the RVSAO external package files.  This
	directory should be outside the IRAF directory tree and must be owned
	by the IRAF account.  In the following examples, this root directory
	is /local/rvsao/.  Make the appropriate file name substitutions for
        your site.
 
3)	Log in as IRAF and edit the extern.pkg file in the hlib directory to
	define the package to the CL.  From the IRAF account, outside the CL,
	you can move to this directory with the command:

            % cd $hlib

	Define the environment variable rvsao to be the pathname to the rvsao
	root directory.  UNIX pathnames must be terminated with a '/'.
	Edit extern.pkg to include:

            reset rvsao	= <directory>/rvsao-2.8.4/
            task  rvsao.pkg   = rvsao$rvsao.cl

	Near the end of the hlib$extern.pkg file, update the definition
	of helpdb so it includes the rvsao help database, copying the syntax
	already used in the string.  Add this line before the line containing
	a closing quote:
 
	    ,rvsao$lib/helpdb.mip\

4)      Add to hlib$clpackage.men the package description:
 
            rvsao - Radial velocity package from SAO
 
5)	Unpack the tar file into the RVSAO root directory.

	On a UNIX system, where dirzip is the pathname of the directory
	into which the package was downloaded and rvsao is the RVSAO root
	directory:
	    % cd $irafpkg
	    % cd ..
	    % zcat $dirzip/rvsao-2.8.4.tar.gz | tar xvf -

	The archive file can be deleted once the package has been
	successfully installed.
 
6)      Restart IRAF and "cd rvsao".

7)	Symbolically link the appropriate binary directory to bin.
	bin is originally linked to bin.generic for distribution.

        On a PC running Redhat Linux, type
	    cl> mkpkg redhat

        On an Apple Macintosh running OS X on an Intel processor, type
	    cl> mkpkg macintel

        On an Apple Macintosh running OS X, type
	    cl> mkpkg macosx

        On a PC running Cygwin, type
	    cl> mkpkg cygwin

        On a PC running Linux, type
	    cl> mkpkg linux
	or
	    cl> mkpkg linux64

	For other architectures, make a directory of the proper bin.{arch}
	name, and link it to bin

8)      Make the package by typing
