UIT Library

This page is a listing of the entire contents of this library for IDL. This listing is the long version. Viewing the much more compact listing may be handier.

[Go Back to Main IDL Libraries Search Page]


Last modified: Thu Dec 21 21:30:13 2000.

List of Routines


Routine Descriptions

ABSCAL

[Next Routine] [List of Routines]
 NAME:
   ABSCAL
 PURPOSE:
   Provide an absolute calibration using the BZERO and BSCALE keywords
   in an FITS header
 CALLING SEQUENCE:
   RESULT = ABSCAL(VALUE,HEADER)
 INPUTS:
   VALUE -  Any scalar, vector, or array (usually an integer type giving a
            relative intensity).
   HEADER - A FITS  header array containing the absolute calibration
            keyword BSCALE, and optionally BZERO and BUNIT.
 OUTPUT:
   RESULT = BSCALE*VALUE + BZERO, where the BSCALE and BZERO scalars
            are taken from the FITS header.  
            If the absolute calibration keywords do not exist, then
            RESULT = VALUE, and !ERR = -1.
 SYSTEM VARIALBES:
   If the system variable !DEBUG is set, then ABSCAL will print the
   calibration units given by the BUNIT keyword.
 REVISION HISTORY:
   Written W. Landsman, STX Corporation     January 1987

(See /host/bluemoon/usr2/idllib/uit/pro/abscal.pro)


AD2XY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	AD2XY
 PURPOSE:
	Compute an X and Y position given the RA and DEC and the astrometry
	parameters CD, CRPIX, and CRVAL.  A tangent (gnomonic) projection is
	computed directly; other projections are computed using WCSXY2SPH.  
	AD2XY is meant to be used internal to other procedures.   For 
	interactive purposes, use ADXY.

 CALLING SEQUENCE:
	AD2XY, a ,d, cd, astr, x, y   

 INPUTS:
	A -     R.A. in DEGREES, scalar or vector
	D -     Dec. in DEGREES, scalar or vector
	ASTR - astrometry structure, output from EXTAST procedure containing:
   	 .CD   -  2 x 2 array containing the astrometry parameters CD1_1 CD1_2
		in DEGREES/PIXEL                                   CD2_1 CD2_2
	 .CDELT - 2 element vector giving increment at reference point in
		DEGREES/PIXEL
	 .CRPIX - 2 element vector giving X and Y coordinates of reference pixel
		(def = NAXIS/2)
	 .CRVAL - 2 element vector giving R.A. and DEC of reference pixel 
		in DEGREES
	 .CTYPE - 2 element vector giving projection types 

 OUTPUTS:
	X     - row position in pixels, scalar or vector
	Y     - column position in pixels, scalar or vector

 REVISION HISTORY:
	Converted to IDL by B. Boothman, SASC Tech, 4/21/86
	Use astrometry structure,  W. Landsman      Jan. 1994	

(See /host/bluemoon/usr2/idllib/uit/pro/ad2xy.pro)


ADSTRING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ADSTRING
 PURPOSE:
	Return RA and Dec as character string in sexigesimal format.
	RA and Dec may be entered as either a 2 element vector or as
	2 scalars.  You may also specify the precision of the declination
	in digits after the decimal point.

 CALLING SEQUENCE
	result = ADSTRING( ra_dec )	      
		or
	result = ADSTRING( ra,dec,[ precision ] )

 INPUTS:
	RA_DEC - 2 element vector giving the right ascension and declination
		in decimal degrees.
                     or
	RA     - Right ascension in decimal degrees, numeric scalar
	DEC    - Declination in decimal degrees, numeric scalar

 OPTIONAL INPUT:
	PRECISION  - The number of digits after the decimal of DEClination.
		The RA is automatically 1 digit more.  This parameter may 
		either be the third parameter after RA,DEC or the second 
		parameter after [RA,DEC].  It is not available for just DEC.  
		If no PRECISION parameter is passed, a precision of 1 for 
		both RA and DEC is returned to maintain compatibility with 
		past ADSTRING functions.  A precision of 0 will result in 
		the below format, always claimed, but but never delivered by 
		ADSTRING.

 OUTPUT:
	RESULT - Character string containing HR,MIN,SEC,DEC,MIN,SEC formatted
		as ( 2I3,F5.(p+1),2I3,F4.p ) where p is the PRECISION 
		parameter.    If only a single scalar is supplied it is 
		converted to a sexigesimal string (2I3,F5.1).

 EXAMPLE:
	(1) Display CRVAL coordinates in a FITS header, H

	IDL> crval = sxpar(h,'CRVAL*')  ;Extract 2 element CRVAL vector (degs)
	IDL> print, adstring(crval)     ;Print CRVAL vector sexigesimal format

	(2)  print,adstring(30.42,-1.23,1)  ==>  ' 02 01 40.80  -01 13 48.0'
	     print,adstring(30.42,+0.23)    ==>  ' 02 01 40.8  +00 13 48.0'
	     print,adstring(+0.23)          ==>  '+00 13 48.0'

 PROCEDURES CALLED:
	RADEC, SIXTY, NINT

 REVISION HISTORY:
	Written   W. Landsman                      June 1988
	Addition of variable precision and DEC seconds precision fix. 
	ver.  Aug. 1990 [E. Deutsch]
	Output formatting spiffed up       October 1991 [W. Landsman]
	Remove ZPARCHECK call, accept 1 element vector  April 1992 [W. Landsman]

(See /host/bluemoon/usr2/idllib/uit/pro/adstring.pro)


ADXY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ADXY
 PURPOSE:
	Use an image header to compute X and Y positions, given the
	RA and Dec in decimal degrees.  

 CALLING SEQUENCE:
	ADXY, HDR		;Prompt for Ra and DEC 
	ADXY, hdr, a, d, x, y, [ /PRINT ]

 INPUTS:
	HDR - FITS Image header containing astrometry parameters

 OPTIONAL INPUTS:
	A - Right ascension in decimal DEGREES, scalar or vector
	D - Declination in decimal DEGREES, scalar or vector        

	If A and D are not supplied, user will be prompted to supply
	them in either decimal degrees or HR,MIN,SEC,DEG,MN,SC format.

 OPTIONAL OUTPUT:
	X     - row position in pixels, same number of elements as A and D
	Y     - column position in pixels

 OPTIONAL KEYWORD INPUT:
	PRINT - If this keyword is set and non-zero, then results are displayed
		at the terminal.

 OPERATIONAL NOTES:
	If less than 5 parameters are supplied, or if the /PRINT keyword is
	set, then then the X and Y positions are displayed at the terminal.

	If the procedure is to be used repeatedly with the same header,
 	then it would be faster to use AD2XY.

 REVISION HISTORY:
	W. Landsman                 HSTX          January, 1988
	Use astrometry structure   W. Landsman   January, 1994	

(See /host/bluemoon/usr2/idllib/uit/pro/adxy.pro)


ANNSTATS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ANNSTATS
 PURPOSE:
    Integrate flux in annular apertures and get std. dev. in each
    annulus.  User responsible for subtracting sky first.  See 
    notes (1) and (2) below.
 CALLING SEQUENCE:
    annstats, image, x0, y0, radius, tot, npix, sigma, stderr, $
           mask=mask, /verbose
 INPUT PARAMETERS:
    image      2-D image array
    x0, y0     center of circular annuli (need not be integral)
    radius     vector of annulus radii
 OUTPUT PARAMETERS:
    For each annulus,
       tot     =   total of pixel values
       npix    =   number of pixels 
       mean    =   mean value per pixel
       sigma   =   standard deviation (scatter) among pixels
       stderr  =   standard error of the mean
 OPTIONAL INPUT KEYWORDS:
    mask       Must be same size as image.  If a pixel in
               the mask is 1, the corresponding pixel in the image is
               counted.  If 0, the corresponding pixel in the image is
               ignored (in all results).  See note (3).
    verbose    Use of /verbose will make the routine tell you what stage
               it's at.  See note (1).
 COMMON BLOCKS:
    none
 NOTES:
   (1) If you aren't sure you've set up right, use the /verbose keyword,
       because the routine is fairly slow.
   (2) Mask is intended to mask out stars or garbage.  Depending on your
       application, you might be better off modifying the input image.
 SIDE EFFECTS:  none
 PROCEDURE:   Similar to IDL/UIT/DAOPHOT aperture routine.
 MODIFICATION HISTORY:
  Modified from CIRCINT.  R.S.Hill, Hughes STX Corp., 5 August 1993.
  Message fixed.  One aperture possible.  RSH, HSTX, 12-Oct-1993.

(See /host/bluemoon/usr2/idllib/uit/pro/annstats.pro)


APER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	APER
 PURPOSE:
	Procedure (adapted from DAOPHOT) to compute concentric aperture 
	photometry.   A separate sky value is determined for each source 
	using  specified inner and outer sky radii.

 CALLING SEQUENCE:
	aper, image, xc, yc, [ mags, errap, sky, skyerr, phpadu, apr, skyrad, 
			badpix, TEXTOUT = , SILENT = ]
 INPUTS:
	IMAGE -  input image array
	XC     - vector of x coordinates.  COORDINATE VALUES
		MUST BE IN IDL CONVENTION! (First pixel is 0 not 1!)
	YC     - vector of y coordinates

 OPTIONAL INPUTS:
	PHPADU - Photons per Analog Digital Units, numeric scalar.  Converts
		the data numbers in IMAGE to photon units.  (APER assumes
		Poisson statistics.)  
	APR    - Vector of up to 12 REAL photometry aperture radii.
	SKYRAD - Two element vector giving the inner and outer radii
		to be used for the sky annulus
	BADPIX - Two element vector giving the minimum and maximum value
		of a good pix (Default [-32765,32767])

 OPTIONAL KEYWORD INPUTS:
	TEXTOUT - Determines output device (see TEXTOPEN)
		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)
	SILENT -  If supplied and non-zero then no output is displayed to the
		terminal.

 OUTPUTS:
	MAGS   -  NAPER by NSTAR array giving the magnitude for each star in
		each aperture.  (NAPER is the number of apertures, and NSTAR
		is the number of stars).   A flux of 1 digital unit is assigned
		a zero point magnitude of 25.
	ERRAP  -  NAPER by NSTAR array giving error in magnitude
		for each star.  If a magnitude could not be deter-
		mined then ERRAP = 9.99.
	SKY  -  NSTAR element vector giving sky value for each star
	SKYERR -  NSTAR element vector giving error in sky values

 SYSTEM VARIABLES:
	If keyword textout is not used, the non-standard system variable 
	!TEXTOUT will be used to determine the output device.
 PROCEDURES USED:
	MMM, TEXTOPEN, STRN
 REVISON HISTORY:
	Adapted to IDL from DAOPHOT June, 1989   B. Pfarr, STX
	Adapted for IDL Version 2,               J. Isensee, July, 1990
	Code, documentation spiffed up           W. Landsman   August 1991

(See /host/bluemoon/usr2/idllib/uit/pro/aper.pro)


APEROI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	APEROI 
 PURPOSE:
	Procedure  to compute aperture photometry for arbitrarily
	shaped aperture defined by DEFROI (DEFine Region Of Interest)
	The sky value is input.

 CALLING SEQUENCE:
	APEROI, Image, Roi, Mag, Errm, Skyin, [ Bscale, Badpix, 
		TEXTOUT = ]

 INPUTS:
	Image  - input image array
	Roi    - array of pixel locations defining aperture    
	Skyin    - constant sky value used for all sources.  

 OPTIONAL INPUTS:
	Bscale - Scale factor to give absolute calibration.  BSCALE may
		be obtained from an image header HDR by the command
			BSCALE = SXPAR(HDR,'BSCALE')
		Set BSCALE = 1 to keep data units rather than convert to
		magnitudes.   
	Badpix - Two element vector giving the minimum and maximum value
		of a good pixel (Default [-32765,32767])
               APEROI prompts for Bscale and Badpix if not supplied
 OPTIONAL INPUT KEYWORDS:
	TEXTOUT - Optional, textout = 3 prints to a file APER.PRT, 
		textout = 1 (default) prints to the screen.

 OUTPUTS:
	Mag   -   magnitude for region of interest.
		After computing an aperture flux,
		FLUX, in data units, a magnitude flux is computed from the
		relation 
			MAGS = -2.5 * alog10(BSCALE*FLUX) - 21.1 

		If BSCALE =1 then MAGS will return the output flux in data 
		units, and not convert to magnitudes.
	Errm  -   NAPER by NSTAR array giving error in magnitude (or flux if
		BSCALE =1) for each star.  If a magnitude could not be deter-
		mined then ERRAP = 9.99 (magnitude) or -9.99 (flux units)

 SYSTEM VARIABLES:
	Set !QUIET = 1 to suppress print output

 REVISON HISTORY:
	1991 April 26   J. K. Hill, STX

(See /host/bluemoon/usr2/idllib/uit/pro/aperoi.pro)


ARCBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ARCBAR
 PURPOSE:
	Create and display a bar of a specified input size in arcminutes

 CALLING SEQUENCE:
	arcbar, hdr, arcmins,[  LABEL= , SIZE =, THICK =, POSITION =  ]

 INPUTS:
	hdr - image FITS header, string array
	arcmins - length in arcminutes of bar, scalar 

 OPTIONAL KEYWORD INPUTS:
	LABEL - string giving user defined label for bar.  Default label is size
		of bar in arcminutes
	SIZE  - size of label, default = 1.0
	THICK -  Character thickness of the annotation, default = !P.THICK
	POS - 2 element vector giving the (X,Y) position in device units at
		which to begin the scale bar.   If not supplied, then the user
		will be prompted to place the cursor at the desired position

 EXAMPLE:
	Place a 3' arc minute scale bar, at position 300,200 of the current
	image display, (which is associated with a FITS header, HDR)

	IDL> arcbar, HDR, 3, pos = [300,200]

 REVISON HISTORY:
	written by L. Taylor (STX) from ARCBOX (Boothman)
	modified for Version 2 IDL,                     B. Pfarr, STX, 4/91
	Updated to use ASTROMETRY structures    J.Offenberg, HSTX, 31 Dec 92
	New ASTROMETRY structures               W.Landsman,  HSTX, Jan 94

(See /host/bluemoon/usr2/idllib/uit/pro/arcbar.pro)


ARROWS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ARROWS
 PURPOSE:
       To display "weathervane" directional arrows on an astronomical image 
	showing orientation of North and East.

 CALLING SEQUENCE:
       arrows,h, [ xcen,ycen, THICK = , CHARSIZE = , ARROWLEN = , COLOR = ,
				/NOTVERTEX ]

 INPUTS:
       h - FITS or STSDAS header array, must include astrometry

 OPTIONAL INPUTS:
       xcen,ycen - numeric scalars, specifying the center position of
		arrows.   Position in device units unless the /NORMALIZED 
		keyword is specified.   If not supplied, then ARROWS
		will prompt for xcen and ycen

 OPTINAL KEYWORD INPUTS:
       thick     - line thickness, default = 1.0, floating point scalar
       charsize  - character size, default = 2.0, floating point scalar
       arrowlen  - length of arrows in terms of normal Y size of vector-drawn
                     character,  default  = 3.5, floating point scalar
       color     - color that the arrows and NE letters should be.  Default
                    value is !P.COLOR
       NotVertex - Normally (historically) the specified xcen,ycen indicated
                    the position of the vertex of the figure.  If this
                    keyword is set, the xcen,ycen coordinates refer to a sort
                    of 'center of mass' of the figure.  This allows the
                    figure to always appear with the area irregardless of
                    the rotation angle.
	Normal - if this keyword is set and nonzero, the input center 
		(xcen,ycen) is taken to be in normalized coordinates.   The
		default is device coordinates.
 OUTPUTS:
       none
 EXAMPLE:
	Draw a weathervane at (400,100) on the currently active window, 
	showing the orientation of the image associated with a FITS header, hdr

	IDL> arrows, hdr, 400, 100

 METHOD:
	Uses EXTAST to EXTract ASTrometry from the FITS header.   The 
	directions of North and East are computed and the procedure
	ONE_ARROW called to create the "weathervane".

 REVISON HISTORY:
       written by B. Boothman 2/5/86 
       Recoded with new procedures ONE_ARROW, ONE_RAY.  R.S.Hill,HSTX,5/20/92
       Added separate determination for N and E arrow to properly display
         arrows irregardless of handedness or other peculiarities and added
         /NotVertex keyword to improve positioning of figure. E.Deutsch 1/10/93
	Added /DATA and /NORMAL keywords W. Landsman      July 1993

(See /host/bluemoon/usr2/idllib/uit/pro/arrows.pro)


ASCENDING_NODE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ASCENDING_NODE
 PURPOSE:
	To compute the right ascension of the ascending node of an orbit
	at a given time during a shuttle mission.
 CALLING SEQUENCE:
	node_ra = ascending_node(met, lnch_inf, orbt_inf)
 INPUTS:
	met      - The mission elapsed time to compute the RA for, in hours.
	lnch_inf - A structure containing information pertaining to launch:
		    {LNCHINF_ST, day:0.d, mon:0.d, year:0.d, time:0.d, 
		    daysav:0, site_lat:28.5d, site_lon:80.6d}
		day      - The day of the launch.
		mon      - The month of the launch.
		year     - The year of the launch.
		time     - The time of day of the launch, in decimal hours.
		daysav   - The daylight savings time flag.  Set to 1 if the
		           time is daylight savings time; set to 0 if standard
		           time.
		site_lat - The north latitude of the launch site, in degrees.
		site_lon - The west longitude of the launch site, in degrees.
	orbt_inf - A structure containing information pertaining to the orbit:
		    {ORBITINF_ST, met_ins:0.d, met_an2:0.d, alt:0.d, incl:0.d, 
		     eccen:0.d, del_u:155.d}
		met_ins  - The mission elapsed time of the insertion into the 
		           orbit.
		met_an2  - The mission elapsed time of the second ascending
		           node passage.
		alt      - The altitude (measured from ground level) of the 
		           orbit, in meters.
		incl     - The orbital inclination, in degrees.
		eccen    - The orbital eccentricity.
		del_u    - This is a parameter which aids in determining the
	                   longitude of the insertion into orbit.  It depends 
		           upon orbital altitude, inclination, and launch
		           profile.  Note that errors of 10 degrees in this
		           parameter result in an error in the RA of 0.6
		           degrees; therefore, an approximation of this
		           parameter is "good enough."  This parameter should
		           be provided in degrees.
 RETURNED:
	node_ra - The right ascension of the ascending node, in degrees.
 KEYWORDS:
	REG_RATE - The rate of change, in degrees per hour, of the ascending
	           node right ascension.
 PROCEDURE:
	The computation procedure is described in Appendix B of 
	"Celestial Target Observability for Astro Spacelab Missions"
	by Larry D. Mullins.  This is NASA Technical Memorandum
	NASA TM-86591, and was written at Marshall Space Flight Center.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 23 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/ascending_node.pro)


ASTDISP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   ASTDISP
 DESCRIPTION:
   This procedure prints of the X,Y,RA,DEC,DN in a standard format.  X,Y must
   be supplied.  RA,DEC may also be supplied, and a DN may also be supplied.
 INPUT:
   X         The X pixel coordinate
   Y         The Y pixel coordinate
 OPTIONAL INPUT:
   RA        Right Ascention
   DEC       DEClination  (if RA is supplied, DEC must also be supplied)
   DN        Data Number
 OUTPUT:
   Printed positions in both degrees and sexigesimal format
   All passed variables remain unchanged
 HISTORY:
   10-AUG-90 Version 1 written by Eric W. Deutsch
   20-AUG-91 Converted to standard header.  Vectorized Code.  E. Deutsch

(See /host/bluemoon/usr2/idllib/uit/pro/astdisp.pro)


ASTRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ASTRO
 PURPOSE:
    Interactive astronomical utitlity for precession and coordinate
    conversion.

 CALLING SEQUENCE:
    ASTRO, [ selection, EQUINOX = ]

 OPTIONAL INPUT:
   SELECTION - Scalar Integer (0-6) giving the the particular astronomical
        utility to be used.  (0) Precession, (1) RA, Dec to Galactic 
        coordinates, (2) Galactic to RA,Dec (3) RA,Dec to Ecliptic,
        (4) Ecliptic to RA, Dec, (5) Ecliptic to Galactic, (6) Galactic
        to Ecliptic.   Program will prompt for SELECTION if this parameter
        is omitted.

 OPTIONAL KEYWORD INPUT:
    EQUINOX - numeric scalar specifying the equinox to use when converting 
              between celestial and other coordinates.    If not supplied, 
              then the RA and Dec will be assumed to be in EQUINOX 1950.   
              This keyword is ignored by the precession utility.   For 
              example, to convert from RA and DEC (2000) to galactic 
              coordinates:
           IDL> astro, 1, E=2000

 METHOD:
    ASTRO uses PRECESS to compute precession, and EULER to compute
    coordinate conversions.   The procedure GET_COORDS is used to
    read the coordinates, and ADSTRING to format the RA,Dec output.

 NOTES:
   ASTRO temporarily sets !QUIET to suppress compilation messages and
         keep a pretty screen display.   
         
 REVISION HISTORY
   Written, W. Landsman November 1987
   Code cleaned up       W. Landsman   October 1991
   Added Equinox keyword, call to GET_COORDS, W. Landsman   April, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/astro.pro)


ASTROM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ASTROM
 PURPOSE:
	Computes parameters describing a linear fit to a plate    
	solution using the algorithm supplied by R. S. HARRINGTON, USNO
	Use the procedure ASTROMIT for interactive use of this program

 CALLING SEQUENCE:
	astrom, raref, decref, idgs, ximg, yimg, astr, err, [ fl ,
				/NOQUESTIONS, DUMPTYPE= ]

 INPUTS:
	raref - Array of RA'S of astrometric reference stars (DEGREES)
	decref- Array of DEC'S of astrometric reference stars (DEGREES)
	idgs  - Array of indices of selected reference stars.  IDGS must
		contain the same or fewer elements than RAREF and DECREF.
		If the total # of reference stars is N, then to select
		all the reference stars, set IDGS = INDGEN(N)
	ximg  - Array of image source X COORDS.                  
	yimg  - Array of image source Y COORDS.
	astr  - A structure, of type ASTROMETRY, containing the initial guess
		at the plate solution.

 OPTIONAL INPUTS:
	fl    - Camera Focal Length (in pixel units).  If omitted, a focal
		length of 1.7E5 (UIT camera) will be assumed
 KEYWORDS:
	NOQUESTIONS - If set, user will not be asked 'Ren/Del/Cont'
	DUMPTYPE    - If 0, printed information will NOT be dumped.  If 1,
		printed information will be dumped to ASTROM.DMP in the
		same format as the screen.  If 2, a higher precision and
		sexigesimal format will be dumped to file ASTROM.DMP.
		DumpType=2 is noticeably slower...
 OUTPUTS:
	astr  - The input ASTROMETRY structure is filled with the just-computed
		plate solution.
	err   - (output) error in star location (measured - calc) in arcsec   
		Same number of elements as IDGS

 REVISION HISTORY:
	Written  by J. K. HILL, STX CORP.                        7/11/86  
	Converted to IDL, made interactive by R. H. CORNETT, STX 5/29/87
	03-SEP-90 Fixed Error calculation and made it dump in to file. (Deutsch)
	Added option to delete or rename output file, J. Isensee, ST Systems Corp.
	Added Calling sequence message, N. Collins, STX, 11/20/90
	20-AUG-91 Fixed Error calculation by removing extra SQRT inserted in
	line 161 probably when the ERR variable was changed to ERROUT by someone.
	Therefore, all error values were wrong, probably since 11/20/90.  Also
	changed variable ERROUT back to ERR because only SOME of the ERRs had
	been changed, which gave more errors.       (E. Deutsch)
	20-AUG-91 Added /NoQues parameter to avoid Del/Ren Prompt.  (E. Deutsch)
	24-AUG-91 Added DumpType= keyword and corresponding code.   (E. Deutsch)
	24-AUG-91 Changed Dumpfile Unit=8 to /get_lun               (E. Deutsch)
 	Fixed the returned ERR array.  The square of the errors was being
	returned; a square root is now taken prior to returning.  The displayed
	error analysis is not affected.  M. R. Greason, Hughes STX, 
	10 December 1992.
	Converted to the new, image-distortion-related, astrometry scheme.
	Reformatted the procedure and beefed up the internal documentation.
	M. R. Greason, Hughes STX, 6 January 1993.
	Fixed variable-name error.  RSH, HSTX, 25-Mar-93
	New astrometry software WBL HSTX  Feb 94

(See /host/bluemoon/usr2/idllib/uit/pro/astrom.pro)


ASTROMIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ASTROMIT
 PURPOSE:
	Uses the procedure ASTROM to derive an astrometry solution from a 
	set of reference star positions and coordinates.  The reference stars 
	may be culled interactively to obtain the best astrometric solution.     
	The procedure writes to a file ASTROM.DMP during each iteration.

 CALLING SEQUENCE:
	ASTROMIT, X, Y, A, D [, HDR, FL, /UNDISTORT]

 INPUTS:
	X - Vector (at least 3 elements) containing the X positions of a set
		of astrometric reference stars
	Y - Vector containing Y positions of reference stars
	A - Vector (same # of elements as X) containing the Right Ascension 
		(decimal degrees) of the astrometric reference stars
	D - Vector containing declinations (decimal degrees) of reference stars

 OPTIONAL INPUTS:
	HDR - Image header which may be updated with the astrometric solution.
	FL  - Camera focal length.  If not supplied, a focal length appropriate
		to UIT is assumed
 KEYWORDS:
	UNDISTORT - If present and non-zero, the reference star (x,y) positions
		are assumed to have been corrected for image distortion
		(transformed into the undistorted frame of reference).  THIS
		KEYWORD SHOULD ONLY BE USED FOR UIT IMAGES.
 METHOD:
	The procedure ASTROM is called (twice) to compute an initial astrometry
	solution.  The errors in the initial solution are then displayed for
	each reference star.  The user then has the option of culling the
	the reference star list, either by setting a maximum tolerable error
	or by removing individual stars.
 NOTES:
	ASTROMIT will write the results of each iteration to a file ASTROM.DMP.
	However, under Unix only the final iteration is saved.

 PROCEDURES USED:
	ZPARCHECK,ASTROM,PUTAST,STRN,STRNUMBER,SXADDHIST
 REVISION HISTORY:
	Written R. Cornett, W. Landsman               January 1988
	Fixed to allow header updates if npar GE 5, B Pfarr, June 1989
	20-AUG-91 Fixed so that it correctly puts residual in header.  (E. Deutsch)
	24-AUG-91 Modified to work with latest mods to ASTROM.         (E. Deutsch)
	Corrected ASTROM bug, requiring a change in how the residual is put into
	the header.  M. R. Greason, Hughes STX, 10 December 1992.
	Converted to the new, image-distortion-related, astrometry scheme.
	Reformatted the procedure and beefed up the internal documentation.
	M. R. Greason, Hughes STX, 6 January 1993.
	Fixed misnomers in calling sequence, bug in ctype handling, a couple
	of instances of not including the structure name astr.  
	RSH, HSTX, 25-Mar-93
	Fixed a loop init. and processing.  MRG, HSTX, 8-Apr-1993.
	Individual star deletion fixed (`where' added).  RSH, HSTX, 18 June 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/astromit.pro)


ASTSCALE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ASTSCALE
 PURPOSE:
    Transfer astrometry from condensed image to full-resolution image,
    or between any two images differing _only_ in plate scale.
    Astrometry is transferred from header in an array to header on disk.
 CALLING SEQUENCE:
    astscale,name,hd,scalefac=scalefac
 INPUT PARAMETERS:
    name = filename of destination image header on disk (without .hhh)
    hd   = header array with astrometry (e.g., produced by VIDEO)       
 OPTIONAL INPUT PARAMETERS:
    scalefac (keyword) = size of disk image/size of image on which
                         astrometry was done (default = 4.0)
 OUTPUT PARAMETERS:  none
 COMMON BLOCKS:  none
 SIDE EFFECTS:   New version of name.HHH generated.
 PROCEDURE:  straightforward
 MODIFICATION HISTORY:
    Written by R. S. Hill, Hughes STX Corp., 28-May-1992.

(See /host/bluemoon/usr2/idllib/uit/pro/astscale.pro)


AVG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	AVG
 PURPOSE:
	Calculate the average value of an array, or calculate the average
	value over one dimension of an array as a function of all the other
	dimensions.
 CALLING SEQUENCE:

	RESULT = AVG( ARRAY, [ DIMENSION ] )
 INPUTS:
	ARRAY = Input array.  May be any type except string.
 OPTIONAL INPUT PARAMETERS:
	DIMENSION = Optional dimension to do average over, scalar
 OUTPUTS:
	The average value of the array when called with one parameter.

	If DIMENSION is passed, then the result is an array with all the
	dimensions of the input array except for the dimension specified,
	each element of which is the average of the corresponding vector
	in the input array.

	For example, if A is an array with dimensions of (3,4,5), then the
	command B = AVG(A,1) is equivalent to

			B = FLTARR(3,5)
			FOR J = 0,4 DO BEGIN
				FOR I = 0,2 DO BEGIN
					B(I,J) = TOTAL( A(I,*,J) ) / 4.
				ENDFOR
			ENDFOR

 RESTRICTIONS:
	Dimension specified must be valid for the array passed; otherwise the
	input array is returned as the output array.
 PROCEDURE:
	AVG(ARRAY) = TOTAL(ARRAY)/N_ELEMENTS(ARRAY) when called with one
	parameter.
 MODIFICATION HISTORY:
	William Thompson	Applied Research Corporation
	July, 1986		8201 Corporate Drive
				Landover, MD  20785
       Converted to Version 2      July, 1990
       Replace SUM call with TOTAL    W. Landsman    May, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/avg.pro)


A_B

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	A_b
 PURPOSE:
	Compute interstellar extinction in the B bandpass as a function 
	of galactic position  using the 21 parameter function given by
	deVaucoulers in the 2nd Reference Catalog of Galaxies (RC2).   Note 
	that this formula is no longer used in the RC3 and that reddenings
	are instead obtained from the Burstein-Heiles maps.

 CALLING SEQUENCE:
	result = A_b( l2, b2)

 INPUT PARAMETERS
	l2 = galactic longitude (degrees), scalar or vector
	b2 = galactic latitude  (degrees), scalar or vector

 OUTPUT PARAMETERS
	RESULT - Interstellar extinction Ab in magnitudes, scalar

 NOTES:
	The controversial aspect of the deVaucoulers reddening curve
	is that it predicts an extinction of about 0.2 at the poles 

	The parameters used here differ from the ones printed in the RC2
	but are the ones actually used for entries in the catalog
	(see Rowan-Robinson 1985) 

 REVISION HISTORY
	Written by R. Cornett and W. Landsman, STX October 1987
	Vectorized code      W. Landsman   STX    December 1992

(See /host/bluemoon/usr2/idllib/uit/pro/a_b.pro)


BAKFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BAKFILE
 PURPOSE:
	To perform a fog-level correction on an image, using a bilinear
	interpolation technique.
 CALLING SEQUENCE:
	bakfile [, infile, outfile, PATCH=patfil, /DOC, BASEFOG=basefog]
 INPUTS:
       infile  The file containing the image to be processed.
       outfile The output file. 
 KEYWORDS:
	PATCH   If present, get the patch information from the specified
	        file.  Otherwise, get it from:
	           /usr4/uitbdr/patches/patchs.dat
	DOC     If present and non-zero, status information concerning the
	        processing of the image is displayed as the image is processed.
	BASEFOG If present, this value is used as the base fog level.
	        Defaults to 200.
 RESTRICTIONS:
	The image MUST be a UIT image, either of the normal or of the
	substep variety.
 PROCEDURE:
	Fog levels are computed for the four corners of the image.  If 
	processing a "normal" image, a series of patches are used to determine
	these fog levels.  If a substepped image, a pixel strip along each
	side is used.  These four fogs are then used to perform a bilinear
	interpolation of the fog throughout the image; these interpolated
	fogs are used to adjust the fog level to the base fog level throughout 
	the image.
 MODIFICATION HISTORY:
	Written by Michael R. Greason and Susan Gessner, HUGHES STX, 
               21 November 1991.  

(See /host/bluemoon/usr2/idllib/uit/pro/bakfile.pro)


BAKSUB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BAKSUB
 PURPOSE:
	To perform a fog-level correction on an image, using a bilinear
	interpolation technique.
 CALLING SEQUENCE:
	baksub [, im, hd, PATCH=patfil, /DOC, BASEFOG=basefog]
 INPUTS:
       im      The image array.
       hd      The header array.
 KEYWORDS:
	PATCH   If present, get the patch information from the specified
	        file.  Otherwise, get it from:
	           /usr4/uitbdr/patches/patchs.dat
	DOC     If present and non-zero, status information concerning the
	        processing of the image is displayed as the image is processed.
	BASEFOG If present, this value is used as the base fog level.
	        Defaults to 200.
 RESTRICTIONS:
	The image MUST be a UIT image, either of the normal or of the
	substep variety.
 PROCEDURE:
	Fog levels are computed for the four corners of the image.  If 
	processing a "normal" image, a series of patches are used to determine
	these fog levels.  If a substepped image, a pixel strip along each
	side is used.  These four fogs are then used to perform a bilinear
	interpolation of the fog throughout the image; these interpolated
	fogs are used to adjust the fog level to the base fog level throughout 
	the image.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 26 September 1991. 
	BASEFOG added.  MRG, STX, 8 October 1991.
       File i/o converted to image and header supplied. Susan Gessner,
		MRG, HUGHES STX, 21 November 1991.
       Selects patch file based on input image size. Nicholas Collins, 
               Hughes STX, 24 Feb. 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/baksub.pro)


BDRASTROM

[Previous Routine] [Next Routine] [List of Routines]
  NAME
	BDRDASTROM
  PURPOSE:
	Add astrometry from the HDRS database into a UIT FITS header.

  CALLING SEQUENCE:
	bdrastrom ,h [,/Nocompress,/OLD]

  INPUT - OUTPUT:
	h - UIT FITS header, string array.   It can be for either a compressed 
		or full-resolution UIT image, but must be in the original UIT
		orientation.   BDRASTROM will not work on subimages or rotated
		images.

  KEYWORD INPUT:
	NOCOMPRESS - If present and non-zero, the restored astrometry will 
		NOT be compressed.
	OLD - If present and non-zero, HDRSOLD rather than HDRS will be used for
		FLIGHT12 or QUICK13 images.

  REVISION HISTORY:
	Written,   W.Landsman         October 1991
	Added NOCOMPRESS option   J. Offenberg  22 January 92
	Added OLD option for pre-Flght13  J. Offenberg Jan 29 1992
	Updated for compatiblity with ASTROMETRY structures and image 
		distortion.       J. Offenberg Jan 1993

(See /host/bluemoon/usr2/idllib/uit/pro/bdrastrom.pro)


BIGDIV

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	BIGDIV

 PURPOSE:
	Divide a image in one file by another (flatfield) image and write to 
	a third file.   Do in 8 steps to save virtual memory.   The numerator
	image and the denominator image must be the same size, INTEGER*2 
	datatype and the dimensions must be an even multiple of 512 x 512 
	(usually 2048 x 2048).

 CALLING SEQUENCE:
	bigdiv, image1, image2, scale, image3

 INPUTS:
	image1 - filename of the INTEGER*2 STSDAS numerator image.
	image2 - filename of the INTEGER*2 SDAS denominator image.  
	scale  -  scale factor, scalar: ratio = num*scale/denom 
		The scale factor will always be converted to floating point.
	image3 - name of output file to write quotient image.   The division is
		done using REAL*4 arithmetic which is then converted to
		INTEGER*2.

 NOTES:
	BIGDIV make the following adjustments to the division:
	(1)   BIGDIV will change any 0 pixels in the denominator image to 1, 
		to avoid divide by zero.
	(2)   Any input values of 32766 in the numerator image will be set to 
		32767 in the quotient image
	(3)   Any input values of 32767 in the denominator image will be set to 
		0 in the quotient image

 EXAMPLE:
	Divide the image 'FUV0342_LIN' by the flatfield image 'B1M', scale
	by 270 and put the quotient image in 'FUV0342F'

	IDL> bigdiv,'FUV0342_LIN','B1M',270,'FUV0324F'

  MODIFICATION HISTORY
	written by Wayne Landsman, STX
	modified to handle saturated pixels, Bob C., STX 1/30/91
	Problem indexing bad pixels  corrected  Wayne L.  STX  27-Sep-91
	Do image sizes any multiple of 512 x 512 rather than just 2048 x 2048
                                           Wayne L.  Nov-91

(See /host/bluemoon/usr2/idllib/uit/pro/bigdiv.pro)


BLINK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BLINK
 PURPOSE:
	To allow the user to alternatively examine two or more windows within
	a single window.

 CALLING SEQUENCE:
	BLINK, Wndw [, T]

 INPUTS:
	Wndw  A vector containing the indices of the windows to blink.
	T     The time to wait, in seconds, between blinks.  This is optional
	      and set to 1 if not present.  

 OUTPUTS:
	None.

 PROCEDURE:
	The images contained in the windows given are written to a pixmap.
	The contents of the the windows are copied to a display window, in 
	order, until a key is struck.

 EXAMPLE:
       Blink windows 0 and 2 with a wait time of 3 seconds

         IDL> blink, [0,2], 3 

 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 2 May 1990.
       Allow different size windows   Wayne Landsman    August, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/blink.pro)


BORDER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BORDER
 PURPOSE:
       To blacken out a border around an image. (50 pixels wide)
 CALLING SEQUENCE:
       border, imagein, imageout
 INPUTS:
       imagein    - input image array
 OUTPUTS:
       imageout - output image array
 REVISON HISTORY:
       written by B. Pfarr, STX,12/14/90

(See /host/bluemoon/usr2/idllib/uit/pro/border.pro)


BOXAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BOXAVE
 PURPOSE:
	Box-average a 1 or 2 dimensional array.   This procedure differs from
	the intrinsic REBIN function in the follow 2 ways: 

	(1) the box size parameter is specified rather that the output 
		array size
	(2) for INTEGER arrays, BOXAVE computes intermediate steps using REAL*4 
		arithmetic.   This is considerably slower than REBIN but avoids 
		integer truncation

 CALLING SEQUENCE:
	result = BOXAVE( Array, Xsize,[ Ysize ] )     

 INPUTS:
	ARRAY - Two dimensional input Array to be box-averaged.  Array may be 
		one or 2 dimensions and of any type except character.   

 OPTIONAL INPUTS:
	XSIZE - Size of box in the X direction, over which the array is to
		be averaged.  If omitted, program will prompt for this 
		parameter.  
	YSIZE - For 2 dimensional arrays, the box size in the Y direction.
		If omitted, then the box size in the X and Y directions are 
		assumed to be equal

 OUTPUT:
	RESULT - Output array after box averaging.  If the input array has 
		dimensions XDIM by YDIM, then RESULT has dimensions
		XDIM/NBOX by YDIM/NBOX.  The type of RESULT is the same as
		the input array.  However, the averaging is always computed
		using REAL arithmetic, so that the calculation should be exact.
		If the box size did not exactly divide the input array, then
		then not all of the input array will be boxaveraged.

 PROCEDURE:
	BOXAVE boxaverages all points simultaneously using vector subscripting

 REVISION HISTORY:
	Written, W. Landsman, October 1986
	Call REBIN for REAL*4 and REAL*8 input arrays, W. Landsman Jan, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/boxave.pro)


BPRECESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	BPRECESS
 PURPOSE:
	Calculate the mean place of a star at B1950.0 on the FK4 system from the
	mean place at J2000.0 on the FK5 system.    

 CALLING SEQUENCE:
	bprecess, ra, dec, ra_1950, dec_1950, [ MU_RADEC = , PARALLAX = 
					RAD_VEL =  ]

 INPUTS:
	RA,DEC - Input J2000 right ascension and declination in *degrees*.
		Scalar or N element vector

 OUTPUTS:
	RA_1950, DEC_1950 - The corresponding B1950 right ascension and 
		declination in *degrees*.    Same number of elements as
		RA,DEC but always double precision.

 OPTIONAL INPUT-OUTPUT KEYWORDS
	MU_RADEC - 2xN element double precision vector containing the proper 
		   motion in seconds of arc per tropical *century* in right 
		   ascension and declination.
	PARALLAX - N_element vector giving stellar parallax (seconds of arc)
	RAD_VEL  - N_element vector giving radial velocity in km/s

	The values of MU_RADEC, PARALLAX, and RADVEL will all be modified
	upon output to contain the values of these quantities in the
	B1950 system.  The parallax and radial velocity will have a very 
	minor influence on the B1950 position.   

 NOTES:
	The algorithm is taken from the Astronomical Almanac 1990, page B42.
	Also see Aoki et al (1983), A&A, 128,263

	The error in using the IDL procedure PRECESS for converting between
	B1950 and J1950 can be up to 1.5", mainly in right ascension.   If
	better accuracy than this is needed then BPRECESS should be used.

 EXAMPLE:
	The SAO2000 catalogue gives the J2000 position and proper motion for
	the star HD 119288.   Find the B1950 position. 

	RA(2000) = 13h 42m 12.740s      Dec(2000) = 8d 23' 17.69''  
	Mu(RA) = -.0257 s/yr      Mu(Dec) = -.090 ''/yr

	IDL> mu_radec = 100D* [ -15D*.0257, -0.090 ]
	IDL> ra = ten(13, 42, 12.740)*15.D 
	IDL> dec = ten(8, 23, 17.69)
	IDL> bprecess, ra, dec, ra1950, dec1950, mu_radec = mu_radec
	IDL> print, adstring(ra1950, dec1950,2)
	        ===> 13h 39m 44.526s    +08d 38' 28.63"

 REVISION HISTORY:
	Written,    W. Landsman                October, 1992
	Vectorized, W. Landsman                February, 1994

(See /host/bluemoon/usr2/idllib/uit/pro/bprecess.pro)


BRUZUAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BRUZUAL
 PURPOSE:
	Extract a spectrum from the BRUZUAL database (Bruzual & Chalrot, 1993,
	ApJ, 405, 538) for a specified model at specified ages.    Meant to 
	be analogous to the procedure CLUST_FLUX

 CALLING SEQUENCE:
	BRUZUAL, wave, time, model, flux

 INPUT-OUTPUT PARAMETERS
	WAVE - Wavelength(s) (A) at which to determine flux, scalar or vector
		If this parameter is undefined on input, then on output it
		will contain the Bruzual wavelengths actually tabulated.
		Otherwise the Bruzual spectra are quadratically interpolated
		onto the input wavelength grid.
	TIME - Time(s) (in Myr) following beginning of star formation at 
		which to evaluate flux, scalar or vector.    Spectra are not 
		interpolated over time, rather the closest point in the 
		Bruzual time grid is used.   Upon output, TIME will contain
		the time values actually used.     If TIME is undefined on
		input the Bruzual time grid is used.

 OUTPUT:
	FLUX  - Flux vector dimensioned NWAVE by NTIME where NWAVE is the number
		of elements in WAVE and NTIME is then number of elements in 
		TIME.  Units are ergs s(-1) A(-1) per solar mass formed.   

 INPUT PARAMETER
 	MODEL - An integer scalar (1-19) specifying the Bruzual model to use 
		(1) Salpeter IMF, Inst. Burst, 0.1 - 125 Msun
		(2) Salpeter IMF, Inst. Burst, 0.1 - 65  Msun
	 	(3) Salpeter IMF, Inst. Burst, 0.1 - 30  Msun
		(4) Salpeter IMF, Inst. Burst, 0.1 - 2.5 Msun
		(5) Salpeter IMF, Inst. Burst, 2.5 - 125 Msun
		(6) Scalo (1986) IMF, Inst. Burst, 0.1 - 125 Msun
		(7) Scalo (1986) IMF, Inst. Burst, 0.1 -  65 Msun
		(8) Scalo (1986) IMF, Inst. Burst, 0.1 -  30 Msun
		(9) Scalo (1986) IMF, Inst. Burst, 0.1 - 2.5 Msun
		(10) Scalo (1986) IMF, Inst. Burst, 2.5 - 125 Msun
		(11) Miller-Scalo IMF, Inst. Burst, 0.1 - 125 Msun
		(12) Miller-Scalo IMF, Inst. Burst, 0.1 -  65 Msun
		(13) Miller-Scalo IMF, Inst. Burst, 0.1 -  40 Msun
		(14) Miller-Scalo IMF, Inst. Burst, 0.1 - 2.5 Msun
		(15) Miller-Scalo IMF, Inst. Burst, 2.5 - 125 Msun
		(16) Salpeter IMF, 1 Gyr Burst, 0.1 - 125 Msun
		(17) Salpeter IMF, Exponential Decayng SFR with tau = 1 Gyr, 
		   	0.1 - 125 Msun
		(18) Salpeter IMF, Exponential Decaying SFR with Mu = 0.50, 
			0.1 - 125 Msun
		(19) Salpeter IMF, Constant SFR 1e-10 Msun/yr. 0.1 - 125 Msun

 EXAMPLE:
	Return the Bruzual flux at 1600 A every million years for the first 
	10 million years.   Assume a Salpeter IMF with mass range 0.1-65 Msun
	(model 2)

	IDL> age = indgen(11)
	IDL> bruzual, 1600, age, 2, flux

	Upon output the AGE vector is modified to contain the ages actually
	used
 REVISION HISTORY
	Written,  W.Landsman  HSTX            April, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/bruzual.pro)


BSORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BSORT
 PURPOSE:
	Function to sort data into ascending order, like a simple bubble sort.
	original subscript order is maintained when values are equal (FIFO).
	(This differs from the IDL SORT routine alone, which may rearrange 
	order for equal values)

 CALLING SEQUENCE:  
	result = bsort( array, [ asort, /INFO, /REVERSE ] )

 INPUT:
	Array - array to be sorted

 OUTPUT:
	result - sort subscripts are returned as function value

 OPTIONAL OUTPUT:
	Asort - sorted array

 OPTIONAL KEYWORD INPUTS:
       /REVERSE - if this keyword is set, and non-zero, then data is sorted
                 in descending order instead of ascending order.
	/INFO = optional keyword to cause brief message about # equal values.

 HISTORY
	written by F. Varosi Oct.90:
	uses WHERE to find equal clumps, instead of looping with IF ( EQ ).
	compatible with string arrays, test for degenerate array 
	20-MAY-1991	JKF/ACC via T AKE- return indexes if the array to 
			be sorted has all equal values.
	Aug - 91  Added  REVERSE keyword   W. Landsman      

(See /host/bluemoon/usr2/idllib/uit/pro/bsort.pro)


BUILDAST

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	BUILDAST
  PURPOSE:
	Build an ASTROMETRY structure from given data.  If data are not
	supplied, prompt for all necessary.  A CD matrix must be supplied and
	will not be prompted.

  CALLING SEQUENCE:
	ASTR = BUILDAST( CD, [CRPIX, CRVAL, CType, Flag, Cam, Equinox, $
			/RADIANS,SCALE=scl,OFFSET=offst])

  INPUTS:
   	CD   - 2 x 2 array containing the astrometry parameters CD1_1 CD1_2
   	      	in DEGREES/PIXEL                                CD2_1 CD2_2
	CRPIX - 2 element vector giving X and Y coord of reference pixel
	CRVAL - 2 element vector giving R.A. and DEC of reference pixel 
       	in DEGREES
	CTYPE - 2 element vector giving dimension types (Nominally "RA--TAN",
		"RA--UIT", "DEC--TAN","DEC--UIT")  (Defaults to "*--TAN")
	FLAG - String containing "T" if plate solution requires a distortion
		to match the plate, "F" if not. (Defaults to "F")
	CAM -  String containing the UIT camera of the image ("A", "B" or "").
		(Defaults to "")
       EQUINOX- Scalar containing the equinox of astrometry coordinates 
               (Defaults to 2000).

  KEYWORD INPUT:
	RADIANS - If present and non-zero, assumes that the input CD and CRVAL
		are in RADIANS, not DEGREES.
       SCALE - Scalar containing the multiplicative scale factor of the image
               (e.g. 4.0 for a 512x512 compressed UIT image).  If not 
		supplied, default value of 1 assumed (SCALE=0 ignored).
       OFFSET - 2 element vector containing the X and Y offsets needed to put
               the CRPIXes at (1024.5,1024.5) AFTER scaling.  If not supplied,
		default value of [0,0] assumeed.

  OUTPUT:
     Function value = ASTROMETRY structure, containing:
   	.CD   -  2 x 2 array containing the astrometry parameters CD1_1 CD1_2
   	      	 in DEGREES/PIXEL                                 CD2_1 CD2_2
	.CRPIX - 2 element vector giving X and Y coordinates of reference pixel
	.CRVAL - 2 element vector giving R.A. and DEC of reference pixel 
       	 in DEGREES
	.CTYPE - 2 element vector giving dimension types (Nominally "RA---TAN"
		 or "RA---UIT", "DEC--TAN","DEC--UIT")
	.FLAG -  String containing "T" if plate solution requires a distortion
		 to match the plate, "F" if not.
	.CAM -   String containing the UIT camera of the image ("A" or "B","N"
		 or blank if not a UIT image).
       .EQUINOX- Scalar containing equinox of CRVAL coordinates (def=2000)
	.SCALE - Scalar containing the multiplicative scale factor of the image
		 (e.g. 4.0 for a 512x512 compressed UIT image).  Will be 1.0
		 if not a UIT image.
	.OFFSET - 2 element vector containing the X and Y offsets needed to put
		 the CRPIXes at (1024.5,1024.5) AFTER scaling.  Will be [0,0] 
		 if not a UIT image.
  PROCEDURE:
	Routine prompts for any missing parameters (CD matrix must be 
	supplied).
	Once values for all fields are complete, the routine will build an
	ASTROMETRY structure and return it.
  COMMON BLOCKS:
	None

  EXAMPLES:
	IDL> astr = buildast(cd, crpix, crval)	;Prompts for other values
	IDL> putast,hdr, buildast(cd, cp, cv, ct, f, cam, equ) ;Puts astrometry
								into header hdr
  MODIFICATION HISTORY:
	Written.  Joel D. Offenberg, Hughes STX, January, 1993.
       All numerics floated.  RSH, HSTX, 22-Apr-1993.
       Degrees converted to radians for entered CRVALs.  RSH, HSTX,
          23-Apr-1993.
	Now able to handle IRAS headers (3 CTYPES, 3 CRPIX---just ignore the 
	third.)		JDO, HSTX, May 26, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/buildast.pro)


BYTESWAP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BYTESWAP
 CALLING SEQUENCE:
	byteswap, im
 PURPOSE:
	To swap the bytes in an image array.
 INPUT/OUTPUT:
	im  The image array (both input and output).
 COMMON BLOCKS:
	None
 PROCEDURE:
	The byteorder procedure is used to perform the conversion.  The
	form of this conversion depends upon the datatype of the array.
	If it is of I*2 format, a short integer swap is performed.  If it 
	is of I*4 format, a long integer swap is performed.  Otherwise, 
	nothing is done.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 30 August 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/byteswap.pro)


CALFIX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CALFIX
 PURPOSE:
    Updates calibration keywords in a UIT FITS header to use the latest 
    values.    Exposure time is read from the NEWFRAMES data base.   
    Absolute calibration is set to the Landsman 10-Dec In-Flight calibration.
    These are the values used in REV 2.
 CALLING SEQUENCE:
    CALFIX,'image_name' ,[cmpr= ]
            or
    CALFIX,header, [cmpr= ]
 INPUT-OUTPUT PARAMETERS:
    image_name = name of .HHH header file.   The file will be updated 
                 with the proper calibration.
           or
    header  - FITS header, string array
 KEYWORD PARAMETERS:
    cmpr = compression factor, e. g. 4 for images boxaveraged by
       a factor 4.   If not supplied, then CALFIX checks the PIXELSIZ
       keyword to determine the compression.   Warning - HREBIN did not
       reset the PIXELSIZ keyword prior to 10-Dec-91.
       
 OUTPUT PARAMETERS:
    none
 SIDE EFFECTS:
    Writes changed copy of header to disk.
 PROCEDURE:
    Header read, parameters retrieved, manipulated, stored.
 MODIFICATION HISTORY:
    Written by R. S. Hill, ST Sys. Corp., 4 Feb 1991
    Correction for PIXELSIZ parameter ne 20, added by J. K. Hill, STX, 2/5/91 
    Also fixes character-string formatting problem.  RSH, STX, 9 April 1991.
    Updated to emulate REV 2 calibration   WBL   10 Dec 1991
    Exp time is read from NEWFRAMES database. N. Collins, HSTX, 24 Feb. 1994

(See /host/bluemoon/usr2/idllib/uit/pro/calfix.pro)


CCM_UNRED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CCM_UNRED
 PURPOSE:
	Deredden a flux vector according to the parameterization
	of Cardelli, Clayton, and Mathis (1989 ApJ. 345, 245),
	including the update for the near-UV given by O'Donnell (1994, ApJ, 
	422, 158).   Parameterization is valid from the IR to the far-UV 
	(3.5 microns to 0.1 microns).

 CALLING SEQUENCE:
	CCM_UNRED, wave, flux, ebv, funred, [ R_V = ]      

 INPUT:
	WAVE - wavelength vector (Angstroms)
	FLUX - calibrated flux vector, same number of elements as WAVE
	EBV  - color excess E(B-V), scalar.  If a negative EBV is supplied,
		then fluxes will be reddened rather than deredenned.

 OUTPUT:
	FUNRED - unreddened flux vector, same units and number of elements
		as FLUX

 OPTIONAL INPUT KEYWORD
	R_V - scalar specifying the ratio of total selective extinction
		R(V) = A(V) / E(B - V).    If not specified, then R_V = 3.1
		Extreme values of R(V) range from 2.75 to 5.3

 EXAMPLE:
	Determine how a flat spectrum (in wavelength) between 1200 A and 3200 A
	is altered by a reddening of E(B-V) = 0.1.   Assume an "average"
	reddening for the diffuse interstellar medium (R(V) = 3.1)

	IDL> w = 1200 + findgen(40)*50      ;Create a wavelength vector
	IDL> f = w*0 + 1                    ;Create a "flat" flux vector
	IDL> ccm_unred, w, f, -0.1, fnew  ;Redden (negative E(B-V)) flux vector
	IDL> plot,w,fnew                   

 NOTES:
	(1) The CCM curve shows good agreement with the Savage & Mathis (1979)
		ultraviolet curve shortward of 1400 A, but is probably
		preferable between 1200 and 1400 A.
	(2)  Many sightlines with peculiar ultraviolet interstellar extinction 
		can be represented with a CCM curve, if the proper value of 
		R(V) is supplied.
	(3)  Curve is extrapolated between 912 and 1000 A as suggested
		by Longo et al. (1989, ApJ, 339,474)

 REVISION HISTORY:
	Written   W. Landsman        Hughes/STX   January, 1992
	Extrapolate curve for wavelengths between 900 and 1000 A   Dec. 1993
	Use updated coefficients for near-UV from O'Donnell   Feb 1994

(See /host/bluemoon/usr2/idllib/uit/pro/ccm_unred.pro)


CCRTWARP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CCRTWARP
 PURPOSE:
    Warps an image to match a reference image.  Prompts the user to pick
    out corresponding sources on two display channels using cursor.
    Neighborhood of cursor is searched for centroid in the image array.
    POLY_2D used to do real work a couple of layers down.
 CALLING SEQUENCE:
   ccrtwarp,ch,chref,oldim,refim,newim[,x,y,xref,yref],$
           fwhm=fwhm,missing=missing,degree=degree,fast=fast
 INPUT PARAMETERS:
    ch    = channel number with display of image to be warped
    chref = channel number with display of reference image
    oldim = image to be warped
    refim = image to which the warped image will conform
    fwhm [keyword] passed ultimately to CNTRD (centroid) routine.
            Default is set by CWARPLIST routine.
    missing [keyword] = missing keyword of poly_2d
    degree [keyword] = degree of polynomical to be fit; default is 1
    fast [keyword] = flag for nearest-neighbor transformation;	
                     default is bilinear interpolation
 OUTPUT PARAMETERS:
    newim = output image
    x, y, xref, yref [optional] = coordinates of corresponding sources
 COMMON BLOCKS:
    none
 SIDE EFFECTS:
    none
 PROCEDURE:
    Calls cwarplist and imwarp.  Latter calls POLY_2D.
 MODIFICATION HISTORY:
    Written by R. S. Hill, ST Systems Corp., 10 April 1991
    Degree keyword added.  RSH, STX, 15 April 1991
    Fast keyword added.  RSH, STX, 16 April 1991
    CRTWARP changed to CCRTWARP for centroiding from actual image.
       RSH, STX, 17 April 1991
    fwhm keyword substituted for boxrad.  RSH, STX, 2 May 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/ccrtwarp.pro)


CDEL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CDEL
 PURPOSE:
	To delete a window and update the common blocks.

 CALLING SEQUENCE:
	CDEL, IPLANE

 INPUTS:
	IPLANE - Image window index.
 OUTPUTS:
	None.

 COMMON BLOCKS:
	The variable CHAN in the common block TV is set to 0 if it is
	equal to IPLANE.

 PROCEDURE:
	The given window is deleted.

 REVISION HISTORY:
	Written by Michael R. Greason, May 1990.
	OPND variable in common block TV replaced with WINDOW_STATE statement,
			K.Rhode, STX, 7/90.
	WINDOW_STATE procedure and the IMAGES common block added.  
						    MRG, STX, August 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/cdel.pro)


CDROT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CDROT
 PURPOSE:
    Rotates matrix by an angle.
 CALLING SEQUENCE:
    cdrot, cd, newcd, angle
 INPUT PARAMETERS:
    cd = input matrix (usually astrometric CD's)
    angle - angle by which to rotate CD matrix, scalar
 OUTPUT PARAMETERS:
    newcd = output matrix (usually astrometric CD's)
 COMMON BLOCKS:
    none
 PROCEDURE:
    Computes rotation matrix from trig functions, multiplies.
 MODIFICATION HISTORY:
    Written by J. K. Hill, STX
    Double precision.  RSH, HSTX, 18 Feb 93.

(See /host/bluemoon/usr2/idllib/uit/pro/cdrot.pro)


CHAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CHAN
 PURPOSE:
	To display a different image window and update the common blocks.

 CALLING SEQUENCE:
	CHAN, IPLANE, [ /PLOT, /FREE ]

 INPUTS:
	IPLANE - Image window index.

 OUTPUTS:
	None.

 OPTIONAL INPUT KEYWORDS:
	PLOT - If this keyword is set, then a window of the default size is
		is opened.   However, images displayed with CTV will not be 
		displayed to this plane.
	FREE - If present and non-zero, a free window is created.

 COMMON BLOCKS:
	The variable CHAN in the common block TV is updated to the new image 
	plane 

 PROCEDURE:
	The given window is made active and shown.  If it has yet to be opened,
	it is opened with the WINDOW command

 REVISION HISTORY:
	Written, Wayne Landsman, July, 1986  Adapted for IVAS July 1989
	Adapted for workstations.  Michael R. Greason, May 1990.
	Removed hard-coding of number of windows   W. Landsman  January, 1991
	Added /FREE keyword		J. D. Offenberg Nov, 1991
	Removed the RETAIN = 2 default
	Switch to X windows if not already there W. Landsman  Mar 1994

(See /host/bluemoon/usr2/idllib/uit/pro/chan.pro)


CHARCURVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CHARCURVE
 PURPOSE:
	To fetch the UIT characteristic curve from its file and return it to the
	calling level.

 CALLING SEQUENCE:
	CHARCURVE, Intensity [, Ind, HDFILE=, HDENTRY= ]

 INPUTS:
	Ind     The optional index in the curve file of the desired curve. 
		This defaults to 0.

 OUTPUTS:
	Intensity  This is a 4096 element integer array containing the
			characteristic curve.

 KEYWORDS:
	HDFILE     If specified, the H&D curve is extracted from this file.
		Otherwise, it is retreived from UIT_DATA:newhd.dat
	HDENTRY    If specified, the H&D curve is assumed to be this entry
		in the file.  Otherwise, it is assumed to be Ind.  This
		keyword overrides the Ind parameter.

 RESTRICTIONS:
     The intensity must be specified.

 PROCEDURE:
	The file is opened and associated to a 4096 element integer array.  The
	desired element is stored in the argument, the file is closed, and
	execution returns to the calling level.

 MODIFICATION HISTORY:
	Written by Robert H. Cornett, STX, 24 April 1988.
	Modified to the current H&D curve.  Documentation added. IND added.
		Michael R. Greason, STX, 9 December 1988.
	Again modified to a new H&D curve.  MRG, STX, 27 March 1990.
	Adapted to the new H&D curve.  The keywords added.  MRG, STX, 
		MRG, STX, 3 October 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/charcurve.pro)


CHECKERBOARD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:                                              
       CHECKERBOARD
 PURPOSE:
       To create a checkerboard array (alternating bytes 0 and 255)
       One use of CHECKERBOARD is to study resolution and distortion
       on the TV display
 CALLING SEQUENCE:                                             
       checkerboard,x,[width]
 OPTIONAL INPUTS:
       width - size of (square) output array.  If not supplied, then
       a 512 x 512 array will be output
 OUTPUTS:
       x  - byte array containing alternating values
 REVISON HISTORY:
       written by B. Pfarr and W. Landsman 4/87

(See /host/bluemoon/usr2/idllib/uit/pro/checkerboard.pro)


CHECK_FITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CHECK_FITS
 PURPOSE:
	Given a FITS array IM, and a associated FITS or STSDAS header HDR, this
	procedure will check that
		(1) HDR is a string array, and IM is defined and numeric   
		(2) The NAXISi values in HDR are appropiate to the dimensions 
                   of IM
		(3) The BITPIX value in HDR is appropiate to the datatype of IM
	If HDR contains a DATATYPE keyword (as in STSDAS files), then this is 
	also checked against the datatype of of IM
	If the UPDATE keyword is present, then FITS header will be modified, if
	necessary, to force agreement with the image array

 CALLING SEQUENCE:
	check_FITS, im, hdr, [ dimen, idltype, /UPDATE, /NOTYPE, /SDAS ]

 INPUTS:
	IM -  FITS or  STSDAS array, (e.g. as read by SXREAD or READFITS )
	HDR - FITS or  STSDAS header (string array) associated with IM

 OPTIONAL OUTPUTS:
	dimen - vector containing actual array dimensions
	idltype- data type of the FITS array as specified in the IDL SIZE
		function (1 for BYTE, 2 for INTEGER*2, 3 for INTEGER*4, etc.)

 OPTIONAL KEYWORD INPUTS:
	/NOTYPE - If this keyword is set, then only agreement of the array
		dimensions with the FITS header are checked, and not the 
		data type.
	/UPDATE - If this keyword is set then the BITPIX, NAXIS and DATATYPE
		FITS keywords will be updated to agree with the array
	/SDAS - If this keyword is set then the header is assumed to be from
		an SDAS (.hhh) file.    CHECK_FITS will then ensure that (1)
		a DATATYPE keyword is included in the header and (2) BITPIX
		is always written with positive values.
	/FITS -  If this keyword is present then CHECK_FITS assumes that it is
		dealing with a FITS header and not an SDAS header, see notes
		below.

 SYSTEM VARIBLE:
	If there is a fatal problem with the FITS array or header then !ERR is
	set to -1.   ( If the UPDATE keyword was supplied, and the header could
	be fixed then !ERR = 0.)

 PROCEDURE:
	Program checks the NAXIS1 and NAXIS2 parameters in the header to
	see if they match the image array dimensions.

 NOTES:
	An important distinction between an STSDAS header and a FITS header
	is that the BITPIX value in an STSDAS is always positive, e.g. BITPIX=32
	for REAL*4 data.    Users should use either the /SDAS or the /FITS 
	keyword if it is important whether the STSDAS or FITS convention for 
	REAL*4 data is used.     Otherwise, CHECK_FITS assumes that if a 
	DATATYPE keyword is present then it is dealing with an STSDAS header.

 MODIFICATION HISTORY:
	Written, December 1991  W. Landsman Hughes/STX to replace CHKIMHD
	No error returned if NAXIS=0 and IM is a scalar   W. Landsman  Feb 93
	Fixed bug for REAL*8 STSDAS data W. Landsman July 93
	Make sure NAXIS agrees with NAXISi  W. Landsman  October 93

(See /host/bluemoon/usr2/idllib/uit/pro/check_fits.pro)


CHKDTYPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CHKDTYPE
 PUROPOSE:
	Compares Datatype of an Image to that stored in its header, and corrects
	the header if any discrepancy is found (at user's discretion)
 CALLING SEQUENCE:
	CHKDTYPE, IM, HD [, /INFO, /SILENT, /AUTO] 
 INPUTS:
	IM - 2-dimensional image
	HD - FITS header for IM
 OUTPUTS:
	If necessary, BITPIX and DATATYPE fields of HD will be changed.
 OPTIONAL KEYWORD INPUTS:
	INFO - Informational status only-- will not change FITS header
	AUTO - Automatically updates header with new parameters
	SILENT - Supresses informational messages unless IM and HD disagree. 
 PROCEDURE:
	Compares BITPIX and DATATYPE in HD to the datatype of IM.  If they
	agree, return.  If not, allow the user the option to change the header,
	unless INFO or AUTO are selected.  If the routine returns with the
	header and image still disagreeing, !ERR is set to -1, otherwise
	!ERR is set to zero.
 SIDE EFFECTS:
	None
 COMMON BLOCKS:
	None
 HISTORY:
	Written by J. D. Offenberg, Hughes-STX, 05 DEC 1991

(See /host/bluemoon/usr2/idllib/uit/pro/chkdtype.pro)


CHNGCAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CHNGCAM
 PURPOSE:
	For UIT images.   Transforms astrometry for an NUV image to that for 
	an FUV image in the same acquisition.

 CALLING SEQUENCE:
	chngcam, hdn, hdf, [ ANGLE =, COMPRESS = , OFFSET = , DISTORT = ] 

 INPUT PARAMETERS:
	hdn = NUV image header
 OPTIONAL INPUT KEYWORDS:
	angle  = angle of rotation in degrees (DEFAULT = 174.6, 174.87 if image 
		distortion is present)
	compress = compression factor as compared to 20 micron pixel spacing on
		film (DEFAULT = 1)
	distort = If present and non-zero, forces angle to be 174.87, regardless
		of what HDN says.  ANGLE keyword over-rides DISTORT.
	offset = offset of centers in pixels 
	(DEFAULT = -[28.62/COMPRESS, 15.11/COMPRESS])

 OUTPUT PARAMETERS:
	hdf = FUV image header (modified, not created)

 PROCEDURE:
	Matrix multiplication.
 MODIFICATION HISTORY:
    Written by J. K. Hill, STX
    CRPIX change added.  R. S. Hill, STX, 7 March 1991
    Image distortion angles added, Updated to use ASTROMETRY structure.
			M.R. Greason & J.D. Offenberg  Hughes STX, Jan 1993
    Brought into conformity with BDR routine ULCCAM.  Conversion
       based on MRG's angle, together with an FUV-->NUV scale change and a
       revised offset.  Based on two pairs of images, NUV0402-FUV0496
       (M33) and NUV0442-FUV0556 (M81).   R. S.Hill, HSTX, 18 Feb 93.
    Astrometry recentered on middle of image, in conformity with BDR
       version of algorithm.  RSH, HSTX, 2 July 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/chngcam.pro)


CHNGXY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CHNGXY
 PURPOSE:
       To convert x and y values based on the reference frame of one header
       into x and y values based on the reference frame of a new header.
 CALLING SEQUENCE:
       chngxy,hdr1,x1,y1,hdr2,x2,y2
 INPUTS:
       hdr1 - first FITS header
       x,y  - x and y values based on hdr1, scalars or vectors
       hdr2 - second FITS header
 OUTPUTS:
       x2,y2 - x and y values based on hdr2
 SIDE EFFECTS:
       if hdr2  is at a different equinox, it will be precessed to match
       hdr1.
 REVISON HISTORY:
       written by J. Hill, STX
       documented for public use, B. PFarr, STX, 2/91

(See /host/bluemoon/usr2/idllib/uit/pro/chngxy.pro)


CINIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	CINIT
 PURPOSE:
	To initialize the common block TV, TEK, IMAGES, and TAPEINFO (on
	the SUNs)
 CALLING SEQUENCE:
	CINIT
 INPUTS:
	None.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	The common blocks are initialized.
 SIDE EFFECTS:
	The TV is reset to zero roam and zoom factors.
 REVISION HISTORY:
	Written, Wayne Landsman, July 1986.
	Converted to workstation use.  Michael R. Greason, May 1990.
	OPND variable removed from common block TV.  K.Rhode, July 1990.
	TAPEINFO added.  MRG, STX, October 1990.
	TEK added, N. Collins, STX, Nov. 28, 1990.  

(See /host/bluemoon/usr2/idllib/uit/pro/cinit.pro)


CIRCINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CIRCINT
 PURPOSE:
    Integrate flux in circular apertures.  User responsible for 
    subtracting sky first.  See notes (1) and (2) below.
 CALLING SEQUENCE:
    circint, image, x0, y0, radius, tot, npix, totdif, npixdif, t8, $
           mask=mask, /verbose
 INPUT PARAMETERS:
    image      2-D image array
    x0, y0     center of circular apertures (need not be integral)
    radius     vector of aperture radii
 OUTPUT PARAMETERS (see note 2):
    tot        total raw flux in each aperture
    npix       number of pixels in each aperture
    totdif     total raw flux for each annulus (difference of successive
               apertures)
    npixdif    number of pixels in each annulus
    t8         like totdif, but each annulus is divided into eight sections
               (X dimension = 8, Y dimension = number of annuli).  Allows
               assessment of error due to lumpiness of distribution, by
               method of Djorgovski & King
 OPTIONAL INPUT KEYWORDS:
    mask       Must be same size as image.  If a pixel in
               the mask is 1, the corresponding pixel in the image is
               counted.  If 0, the corresponding pixel in the image is
               ignored (in all results).  See note (3).
    verbose    Use of /verbose will make the routine tell you what stage
               it's at.  See note (1).
 COMMON BLOCKS:
    none
 NOTES:
   (1) If you aren't sure you've set up right, use the /verbose keyword,
       because the routine is fairly slow.
   (2) For a surface brightness profile, plot totdif/npixdif vs. radius.
       For an aperture growth curve, plot tot vs. radius.
   (3) Mask is intended to mask out stars or garbage.  Depending on your
       application, you might be better off modifying the input image.
 SIDE EFFECTS:  none
 PROCEDURE:   Similar to IDL/UIT/DAOPHOT aperture routine.
 MODIFICATION HISTORY:
  Integrate in circular aperture.
  RSH - STX - 20 Aug 1990
  Modified to ignore some pixels according to mask image.
  RSH - STX - 19 Sept 90
  Totals done for annuli rather than discs.
  RSH - STX - 20 Sept 90
  Use of mask corrected.  RSH - STX - 27 Sept 90
  Small change to conserve array space.  RSH - STX - 5 Nov 90
  Fractional-pixel approximation adopted from Wayne Landsman's version
     of DAOPHOT APER.  Annuli computed from discs.  RSH - STX - 17 July 91
  Annuli divided into octants for subsequent error estimate due to random
     distribution of sources.  RSH - STX - 22 July 91
  Several bugs fixed.  RSH - STX - 3 Oct 91
  Spiffed up for UIT IDL library.  RSH - Hughes STX - 11 June 92
  Speeded up initializaion.  RSH - HSTX - 5 August 1993

(See /host/bluemoon/usr2/idllib/uit/pro/circint.pro)


CIRRANGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CIRRANGE
 PURPOSE:
	To force an angle into the range 0 <= ang < 360.
 CALLING SEQUENCE:
	cirrange, ang
 INPUTS/OUTPUTS:
	ang     - The angle to modify, in degrees.  This parameter is
	          changed by this procedure.  Can be a scalar or vector.
 KEYWORDS:
	RADIANS - If present and non-zero, the angle is specified in
  	          radians rather than degrees.  It is forced into the range
	          0 <= ang < 2 PI.
 PROCEDURE:
	The upper limit is added to negative values until there are no
	more.  Then the MOD operator is applied to all the angles to deal
	with values that are too large.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 10 February 1994.

(See /host/bluemoon/usr2/idllib/uit/pro/cirrange.pro)


CLEANPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CLEANPLOT
 PURPOSE:
	Reset all system variables (!P,!X,!Y,!Z) set by the user which 
	affect plotting to their default values.

 CALLING SEQUENCE:
	Cleanplot

 INPUTS:	
	None

 OUTPUTS:	
	None

 SIDE EFFECTS:	
	The system variables that concern plotting are reset
	to their default values.  A message is output for each
	variable changed.   The CRANGE, S, WINDOW, and REGION fields of the
	!X, !Y, and !Z system variables are not checked since these are 
	set by the graphics device and not by the user.    

 PROCEDURE:
	This does NOT reset the plotting device.
	This does not change any system variables that don't control plotting.

 RESTRICTIONS:
	If user default values for !P, !X, !Y and !Z are different from
	the defaults adopted below, user should change P_old etc accordingly

 MODIFICATION HISTORY:
	Written IDL Version 2.3.0  W. Landsman & K. Venkatakrishna May '92
	Handle new system variables in V3.0.0     W. Landsman   Dec 92

(See /host/bluemoon/usr2/idllib/uit/pro/cleanplot.pro)


CLUSTMOD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CLUSTMOD
 PURPOSE:
	Return the flux of a model star cluster as a function of mass at a 
	specified age and at specified wavelengths    

 CALLING SEQUENCE:
	CLUSTMOD, w, f, age, expon, [ log_Z, init_M, Mass_Range = ,/Silent
		    Mdot =, /NoInterp, /OldMaeder , /OldKurucz , Z_evol = ]

 INPUTS:
	W - wavelength(s) (A) at which to evaluate fluxes. Set W = -1 to 
		evaluate Lyman continuum fluxes.    Wavelengths may be 
		modified upon output if the /NoInterp keyword is set.
	AGE - age (in Myr) of the the star cluster, scalar

 OPTIONAL INPUT:
	EXPON - power law exponent, uusally negative, scalar or vector
		The number of values in expon equals the number of different
		power-law components in the IMF
		A Saltpeter IMF has a scalar value of expon = -1.35
	LOG_Z - Log of the metallicity relative to solar.   Values of 
		LOG_Z = 0.3, 0, -0.4,-0.7, or -1.5 are preferred since these 
		correspond exactly to available evolutionary tracks.    User 
		prompted if LOG_Z not supplied

 OPTIONAL INPUT-OUTPUT
	INIT_M - Masses at which to evaluate cluster flux.  If not suppled
		or set to 0, then INIT_MASS is set equal to the masses used 
		in the evolution grid of Schaller et al. plus a 20 element 
		grid for the post main-sequence.   Masses are truncated to 
		those with lifetimes less than AGE.

 KEYWORD INPUT:
	MASS_RANGE - vector containing upper and lower limits of the IMF and
               masses where the IMF exponent changes.   The number of values
		in mass_range should be one more than in expon.   The values
		in mass_range should be monotonically increasing.

 OPTIONAL KEYWORD INPUTS:
	Z_Evol - scalar giving metal abundance to use with evolutionary tracks.
		Allowed values are 0.04, 0.02, 0.004, 0.008 or 0.001 for the 
		new Schaller et al. tracks or 0.002, 0.005, 0.02, or 0.04 if 
		the OldMaeder keyword is used.     If not supplied, then the 
		value of log_Z is used to select the track with the closest 
		metallicity.
       Mdot - scalar either 1 (default) or 2.   If Mdot = 2 then  
		CLUSTMOD uses evolutionary tracks with the double the mass loss 
		rate of the deJager parameterization whenever the winds are 
		driven by radiation pressure (main-sequence + Wolf-Rayet phases)
	NoInterp - If this keyword set, then the input wavelengths are rounded
		off to the nearest Kurucz model wavelengths.    This avoids
		interpolation in wavelength and saves considerable time.
	OldKurucz - If set and non-zero, then the old (1979) Kurucz models are
		used.
	OldMaeder - If set and non-zero, then the old (1989) Maeder tracks are
		are used.
	Silent - If set and non-zero, the informational messages are suppressed

 OUTPUT:
	F - Flux of star cluster at specified wavelengths and masses
		dimension NWAVE by NMASS.     Flux units are erg s-1 A-1 cm-2
		per solar mass in the cluster.   If W = -1 then F is the 
		number of Lyman continuum photons (x 10(45)) emitted per 
		solar mass in the cluster.

 EXAMPLE:
	Compute the flux at 1600 A for a solar metallicity 10Myr old model at 
	the masses used in the Schaller et al. tracks.     Use the IMF of 
	Lequex (1981) which has an exponent of -0.6 between 0.007 and 1.8 
	Msun, and an exponent of -1.7 between 1.8 and 120 Msun.

	IDL> clustmod, 1600, f, 10, [-.6,-1.7], 0, init_m, mass=[0.007,1.8,120]

 REVISION HISTORY:
	Written    Wayne Landsman             September, 1989
	Update for new Kurucz models          July, 1992
	Added /NoInterp keyword               September, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/clustmod.pro)


CLUST_FLUX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CLUST_FLUX
 PURPOSE:
	Returns the flux of a model star cluster at a specified wavelength
	as a function of time.

 CALLING SEQUENCE:
	CLUST_FLUX, wave, time, expon, flux,[ log_z, init_m, Mass_range = , 
			NoInterp = , Z_evol = , OldKurucz =, Oldmaeder = ,
			Mdot = mdot, /SILENT ]

 INPUTS:
	WAVE - Wavelength(s) (A) at which to determine flux, scalar or vector
		Set WAVE = -1 to determine the Lyman continuum flux.    WAVE
		may be modified upon output, if the /NoInterp keyword is set
	TIME - Time(s) (in Myr) following starburst at which to evaluate flux, 
		scalar or vector
	EXPON - power law exponent, usually negative, scalar or vector
		The number of values in expon equals the number of different
		power-law components in the IMF
		A Saltpeter IMF has a scalar value of expon = -1.35

 KEYWORD INPUT:
	MASS_RANGE - vector containing upper and lower limits of the IMF and
               masses where the IMF exponent changes.   The number of values
		in mass_range should be one more than in expon.   The values
		in mass_range should be monotonically increasing.    For 
		a scalar value of EXPON the default value of MASS_RANGE is
		[0.1, 110].

 OPTIONAL INPUT:
	LOG_Z  - Log of the metal abundance relative to solar.  Suggested values
		are 0.3, 0, -0.4, -0.7, or -1.5.  CLUST_FLUX will prompt for 
		LOG_Z if not supplied.
	INIT_M - This parameter determines the discrete masses at which to 
		evaluate the cluster flux.   If INIT_M is not supplied,
		or set to 0, then the discrete initial masses of the Schaller 
		et al (1992) models are used (with a factor of 10 finer grid for
		the post-main-sequence).   The user can alter this default mass 
		grid in two ways:

		(1)  If INIT_M is a vector it is assumed to explicitly contain 
		each mass at which the cluster flux is to be evaluated

		(2)  If INIT_M is a scalar positive integer, it specifies how
		how many times finer the mass grid should be than the 
		default; i.e setting INIT_M=2 will double the number of
		mass_grid points.

 OPTIONAL KEYWORD INPUT:
	Z_Evol - scalar giving metal abundance to compute Schaller (1992) 
		evolution models with.   Must be 0.04, 0.02, 0.004, 0.008, or 
		0.001.  If not supplied, then metallicity closest to log_Z is 
		selected. 
	NoInterp - If this keyword set, then the input wavelengths are rounded
		off to the nearest Kurucz model wavelengths.    This avoids
		interpolation in wavelength and saves considerable time.
	OldKurucz - If this keyword is set and non-zero, then the old (1979)
		Kurucz models are used.   Cannot be used with /NoInterp
	OldMaeder - If set and non-zero, then the old (1989) Maeder tracks are
		are used.
	Silent - If set and non-zero, informational messages are suppressed

 OUTPUT:
	FLUX  - Flux vector dimensioned NWAVE by NTIME where NWAVE is the number
		of elements in WAVE and NTIME is then number of elements in 
		TIME.  Units are ergs s(-1) A(-1) per solar mass formed.   
		If WAVE = -1, then FLUX is given in 10(45) Lyman continuum 
		photons per second.
 EXAMPLES:
	Find the 1600 A flux every Myr during the first 10 Myr, for a star
	cluster with an IMF exponent gamma = -2, and upper and lower mass
	limits of 0.1 and 110 Msun

          IDL> CLUST_FLUX, 1600, indgen(11), -2, f, mass_range = [0.1,110]

 REVISION HISTORY:
	Written         W. Landsman         September, 1989
	Updated for new Maeder models       August, 1992
	Added /NoInterp keyword             September, 1992
	Support multicomponent IMF          April, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/clust_flux.pro)


CNTRD

[Previous Routine] [Next Routine] [List of Routines]
  NAME: 
	CNTRD
  PURPOSE:
	Compute centroid coordinates of a stellar object using the
	algorithm in the DAOPHOT FIND subroutine.

  CALLING SEQUENCE: 
	CNTRD, img, x, y, xcen, ycen, [ fwhm , /SILENT, /DEBUG]

  INPUTS:     
	IMG - Two dimensional image array
	X,Y - Scalar or vector integers giving approximate stellar center

  OPTIONAL INPUT:
	FWHM - floating scalar; Centroid is computed using a box of half
		width equal to 1.5 sigma = 0.637* FWHM.  CNTRD will prompt
		for FWHM if not supplied

  OUTPUTS:   
	XCEN - the computed X centroid position, same number of points as X
	YCEN - computed Y centroid position, same number of points as Y

	Values for XCEN and YCEN will not be computed if the computed
	centroid falls outside of the box, or if the computed derivatives
	are non-decreasing.   If the centroid cannot be computed, then a 
	message is displayed and XCEN and YCEN are set to -1.

  OPTIONAL OUTPUT KEYWORDS:
	SILENT - Normally CNTRD prints an error message if it is unable
		to compute the centroid.   Set /SILENT to suppress this.
	DEBUG - If this keyword is set, then CNTRD will display the subarray
		it is using to compute the centroid.

  PROCEDURE: 
	Maximum pixel within distance from input pixel X, Y  determined 
	from FHWM is found and used as the center of a square, within 
	which the centroid is computed as the value (XCEN,YCEN) at which 
	the derivatives of the partial sums of the input image over (y,x)
	with respect to (x,y) = 0.

  MODIFICATION HISTORY:
	Written 2/25/86, by J. K. Hill, S.A.S.C., following
	algorithm used by P. Stetson in DAOPHOT.
	Improved error checking      W. Landsman       August, 1991
	Allowed input vectors        G. Hennessy       April,  1992
	Fixed to prevent wrong answer if floating pt. X & Y supplied
		W. Landsman        March, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/cntrd.pro)


COLOR2PHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COLOR2PHOT
 PURPOSE:
	Extracts objects from a UITPHOT table, selecting those with
	colors and magnitudes between an interactively specified ranges.

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	flg = color2phot([sel, WIDTH=wdth, SILENT=slnt, TXTWDGT=outtext,
		BASWDGT=baswdgt,] INSWDGT=instext)
	sel       - A structure array containing position/magnitude information
	            for the selected stars.  Each element contains:
			XI     - The x coordinate of the star in the image.
			YI     - The y coordinate of the star in the image.
			XT     - The x coordinate of the star in the table.
			YT     - The y coordinate of the star in the table.
			RA     - The right ascension of the star, in degrees.
			DEC    - The declination of the star, in degrees.
			EQNX   - The equinix of the celestial coordinates.
			MAG1   - The first aperture magnitude of the star.
			ERR1   - The first aperture magnitude error.
			MAG2   - The second aperture magnitude of the star.
			ERR2   - The second aperture magnitude error.
			MAG3   - The third aperture magnitude of the star.
			ERR3   - The third aperture magnitude error.
			MAGPSF - The PSF magnitude of the star.
			ERRPSF - The PSF magnitude error.
			SKY    - The sky flux.
			ERRSKY - The sky error.
			IND    - The index in the table of the star.
			FILTER - The table's filter.
			COLOR  - A structure containing the UV color of the
			         star.  This structure contains the color, and
			         two strings indicating the filters used.
	returned  - The number of positions that have been selected and
	            extracted.
 KEYWORDS:
	BASWDGT   - The widget id for the most basic widget.  This is the
	            widget maintaining the SHOWPHOT command menu and is
	            used here to desensitize that menu while objects are
	            being extracted from the table.
	INSWDGT   - The instruction widget.  This is where the instructions
	            for the use of this function are written.  This keyword
	            is mandatory.
	SILENT    - If present and non-zero AND if sel has been specified on
	            the command line, information concerning each selected star
	            is not written to the screen.
	TXTWDGT -   If present and non-negative, and if FILE has not been 
	            specified, the output is written to this widget instead of 
	            the standard output.
	WIDTH     - Defines the size of the full-width half-max used in the
	            centroid, the size of the boxes displayed about the stars,
	            and the maximum separation between the table and image
	            star positions defining a match.  1/3 of this number is
	            used to determine the maximum separation.
 COMMON BLOCKS:
	Image_Blk    The image common block.  See IMG_INIT for details.
	Table_Bk1    The first FITS table block.  See TAB_INIT for details.
	Table_Bk2    The second FITS table block.  See TAB_INIT for details.
	Color_Share  Provides the event handler with the variables it needs
	             from COLOR2PHOT.
 PROCEDURE:
	A set of widgets are created to allow the user to interactively
	specify the ranges (through a set of sliding bars).  The
	user finalizes the range by pressing either the Abort button (which
	cancels further processing), or one of the Done buttons (one will 
	cause the objects' info to be written to the Output widget while the
	other suppresses this output).  All objects with colors and magnitudes
	between the range are then extracted from the table.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 1 May 1992.
	Position indexing problem corrected.  MRG, HSTX, 16 July 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/color2phot.pro)


COLORMAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    COLORMAG
 PURPOSE:
    Create a color-magnitude plot from 2 uitphot tables.
 CALLING SEQUENCE:
    Colormag,filename1,head1,filename2,head2,cdst
 INPUTS:
    filename1 - name of nuv fits table 1 (example: nuv0388t1_1 )
    head1   - header with GOOD astrometry for file1
    filename2 - name of fuv fits table 2 (example:fuv0485t1_1 )
    head2   - header with GOOD astrometry fof file2
    cdst - critical distance, in real pixels for determining matches
 KEYWORD INPUTS:
    title - string for title of plot
    xmin  - min x value (from first image)
    xsize - length of x (from first image)
    ymin  - min y value (from first image)
    ysize - length of y (from first image)
 OUTPUT:
    none
 SIDE EFFECTS:
 REVISION HISTORY:  
    Written, B. PFarr, STX, 2/91

(See /host/bluemoon/usr2/idllib/uit/pro/colormag.pro)


COMPRESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   COMPRESS
 PURPOSE:
   Create a compressed image on disk.   Combines the function of 
       STRD, HREBIN, and STWRT.
 CALLING SEQUENCE: 
   compress, name, OUTSIZE = outsize, [ OUTNAME = , BOXAVE = ]
 INPUTS:
   name - scalar string giving the name of the SDAS file containing the
          big image.
 OPTIONAL KEYWORD INPUT:
   OUTSIZE - two element vector giving the size of the output image to be
         created.    The default output size is 512 by 512.
   OUTNAME - scalar string giving the name of the output image file
             If not supplied, the default is created by
               (1) Using the first 7 letters of the input file name
               (2) Appending a 'G' for geomed images, and a 'Q13'
                   for QUICK13 images
               (3) Appending a 'C' (for compressed image)
   BOXAVE -  if this keyword is set and non-zero then the compress image is
             created using the BOXAVE function rather than the REBIN function.
             BOXAVE always computes intermediate steps using REAL*4 
             arithmetic and so is much slower, but should be used when
             photometric accuracy is needed.
 EXAMPLE:
    A 2048 x 2048 UIT image 'FUV0537Q13E' exists on the default directory.
    Create a 512 x 512 compressed image named FUV0537Q13C

              IDL> COMPRESS, 'FUV0537Q13E'
 SIDE EFFECTS:
    A new SDAS image file is created on disk
 REVISION HISTORY
     Written   W. Landsman           October 1991
     Fixed up for non-UIT images    W. Landsman         February, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/compress.pro)


COMP_NITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COMP_NITE
 PURPOSE:
	To determine the sunset and sunrise times for a shuttle in orbit
	during a given range of time.
 CALLING SEQUENCE:
	comp_nite, times, start_time, stop_time [, time_res]
 INPUTS:
	start_time - The start of the time range, in hours MET.
	stop_time  - The end of the time range, in hours MET.
	time_res   - The time resolution (the max. error in the reported 
	             times), in hours.  Defaults to 15 sec. (note:  going
	             much finer will result in arithmetic errors).
 OUTPUTS:
	times      - An array of structures containing sunrise and sunset
	             times, in hours MET.  The structure declaration is:
			{TIME_STRCT, rise_time:0.0d, set_time:0.0d}
 COMMON BLOCKS:
	mission_comm - Contains a structure which, in turn, contains the
	               orbit parameters.
 RESTRICTIONS:
	The SETORB procedure must be called before using this procedure.
 PROCEDURE:
	CALL_EXTERNAL is used to call the "compnite" C function.  This
	function steps through the time range, in time_res increments,
	looking for changes between day and night.  These times are
	recorded in the output arrays.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 20 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/comp_nite.pro)


CONS_DEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONS_DEC
 PURPOSE:
	Returns a set of Y pixels values, given an image with astrometry, and
	either
	(1)  A set of X pixel values, and a scalar declination value, or
	(2)  A set of declination values, and a scalar X value

	Form (1) can be used to find the (X,Y) values of a line of constant
	declination.  Form (2) can be used to find the Y positions of a set
	declinations, along a line of constant X.

 CALLING SEQUENCE:
	Y = CONS_DEC( DEC, X, CD, ASTR, ALPHA)

 INPUTS:
	DEC - Declination value(s) in DEGREES (-!PI/2 < DEC < !PI/2).  
		If X is a vector, then DEC must be a scalar.
	X -   Specified X pixel value(s) for line of constant declination 
		If DEC is a vector, then X must be a scalar.
	ASTR - Astrometry structure, as extracted from a FITS header by the
		procedure EXTAST
 OUTPUT:
	Y   - Computed set of Y pixel values.  The number of Y values is the
		same as either DEC or X, whichever is greater.

 OPTIONAL OUTPUT:
	ALPHA - the right ascensions (DEGREES) associated with the (X,Y) points

 RESTRICTIONS:
	Program will have difficulty converging for declination values near
	90.  For tangent (gnomonic) projections only.  

 REVISION HISTORY:
	Written, Wayne Landsman  STX Co.	                  April 1988
	Algorithm  adapted from AIPS memo 27. by Eric Griessen
	Use new astrometry structure,     W. Landsman    HSTX     Jan. 1994

(See /host/bluemoon/usr2/idllib/uit/pro/cons_dec.pro)


CONS_RA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONS_RA
 PURPOSE:
	Return a set of X pixel values given an image with astrometry, 
	and either
	(1) a set of Y pixel values, and a scalar right ascension, or
	(2) a set of right ascension values, and a scalar Y value.

	In usage (1), CONS_RA can be used to determine the (X,Y) values
	of a line of constant right ascension.  In usage (2), CONS_RA can
	used to determine the X positions of specified RA values, along a
	line of constant Y.

 CALLING SEQUENCE:
	X = CONS_RA( RA, Y, ASTR)

 INPUTS:         
	RA -  Right Ascension value in DEGREES (0 < RA < 2*PI).  If Y is a
		vector, then RA must be a scalar
	Y -   Specified Y pixel value(s) for line of constant right ascension
		If RA is a vector, then Y must be a scalar
	ASTR - Astrometry structure as extracted from a FITS header by the 
		procedure EXTAST
 OUTPUTS
	X   - Computed set of X pixel values.   The number of elements of X
		is the maximum of the number of elements of RA and Y.

 RESTRICTIONS:
	Program will have difficulty converging for declination values near
	90.    For tangent projection only.  

 REVISION HISTORY:
	Written, Wayne Landsman  STX Co.	April, 1988
	Algorithm adapted from AIPS memo No. 27 by Eric Griessen
	New astrometry structure

(See /host/bluemoon/usr2/idllib/uit/pro/cons_ra.pro)


CONTRAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONTRAST
 PURPOSE:
	Use the mouse to change the slope and Y intercept of the color
	lookup table on an X windows display. 

 CALLING SEQUENCE:
	CONTRAST, [ cont ]

 OPTIONAL INPUT:
	CONT - If this optional parameter is supplied and non-zero, then
		CONTRAST is initialized by placing the cursor at the position 
		of the previous call to CONTRAST.    Otherwise, CONTRAST 
		initializes with the cursor in the center of the image.

 OUTPUT:
	None

 SIDE EFFECTS:
	Mouse button enabled:	LEFT - Reverses black and white
				RIGHT - Exit

 PROCEDURE:
	The y position (0-!D.Y_SIZE) is converted into a slope of range -10 
	to 10 by using a tangent function.  The x position (0-!D.X_SIZE) is 
	converted into a Y-intercept range of -128 to 128.

 COMMON BLOCKS:
	The COLORS common block (see LOADCT) store the modified color table
	The CONTRAST common block stores the final position of the cursor.

 REVISION HISTORY:  
	Adapted from IVAS version on contrast, B. Pfarr, STX, 1/91
	Added CONT parameter   W. Landsman       STX    August, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/contrast.pro)


CONV_STSDAS

[Previous Routine] [Next Routine] [List of Routines]
-
 NAME:
	CONV_STSDAS
 PURPOSE:
	Convert the internal format of an STSDAS image (.hhh and .hhd file)
	to the host machine architecture.     Useful for copying STSDAS files
	between different machines.     If the host is not a Vax, then by
	default CONV_STSDAS assumes the image originated on a Vax.   If the
	host is a Vax, then CONV_STSDAS assumes that the image originated on
	an IEEE machine (e.g. SparcStation).

 CALLING SEQUENCE:
	CONV_STSDAS, sdas_name, [ /FROM_IEEE]

 INPUTS:
	sdas_name - scalar string giving name of the STSDAS (.hhh and .hhd)
		image.    Do not supply the filename extension.    The
		internal format of this file will be modified by CONV_STSDAS.

 OPTIONAL KEYWORD INPUT:
	/FROM_IEEE - On little endian machines (mipsel, ms-dos) this keyword
		indicates that the STSDAS file originated on an IEEE machine
		(e.g SparcStation) rather than a Vax.

 EXAMPLE:
	Suppose files test.hhd and test.hhh have been copied with FTP from
	a Vax to a Sparcstation.   Convert these files to the SparcStation
	internal format.

	IDL> conv_stsdas, 'test'

 METHOD:
	CONV_STSDAS reads each group image and parameter block and uses 
	IEEE_TO_HOST or CONV_VAX_UNIX to convert the internal format.   The
	converted images and parameter blocks are written back to the orginal
	file.

 PROCEDURE CALLS
	sxopen, fdecomp, datatype, sxgpar, ieee_to_host, conv_vax_unix

 NOTES:
	(1)  When copying STSDAS files to a Vax, be sure the .hhh file is 
		formatted as fixed block 80 byte.
	(2)  CONV_STSDAS has no way of knowing if a file really came from
		a different machine architecture.    If it is applied to a file
		that already has the correct internal format, then CONV_STSDAS
		will "convert" this file and corrupt the internal format.

 REVISION HISTORY:
	Written   W. Landsman                     January, 1993
	Don't require .hhh extension		April, 1993
	Increase speed by calling SXGINFO	May, 1993
-
 On_error,2

(See /host/bluemoon/usr2/idllib/uit/pro/conv_stsdas.pro)


CONV_VAX_UNIX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   CONV_VAX_UNIX     
PURPOSE:
    To convert VAX IDL data types to UNIX (Sun,MIPS,etc.) IDL data types.
    The architecture is obtained from IDL sys.var. !VERSION.ARCH.   

 CALLING SEQUENCE:
    		var_unix = conv_vax_unix( var_vax )
 INPUT-OUTPUT PARAMETER:
    variable 
        The data variable to be converted.  This may be a scalar
	 or an array.  All IDL datatypes are valid (including structures).
	The result of the conversion is returned by the function.
 INPUT KEYWORD:  
	TARGET_ARCH = name (string) of desired target architecture
		if using this function on a VAX.
		otherwise !VERSION.ARCH is used to determine the conversion.
               Valid names are 'sparc','386','386i',',or 'mipsel'
 EXAMPLE:
	Read a 100 by 100 matrix of floating point numbers from a data
	file created on a VAX.  Then convert the matrix values into Sun format.

	IDL> openr,1,'vax_float.dat'
	IDL> data = fltarr(100,100)
	IDL> forrd,1,data
	IDL> data = conv_vax_unix( data )

 MODIFICATION HISTORY:
       Written   F. Varosi               August 1990
       Added support for MIPSEL (DecStation)   P. Keegstra   April 1992

(See /host/bluemoon/usr2/idllib/uit/pro/conv_vax_unix.pro)


COORDPLOT

[Previous Routine] [Next Routine] [List of Routines]
  NAME
	COORDPLOT
  PURPOSE
	Compares two sets of coordinates by plotting vectors between original
	and final positions.  Results are plotted on an IDL plot window.
  CALLING SEQUENCE
	Coordplot, First_x, First_y, Second_x, Second_y [,window = w, mag = m, $
			/large, /hardcopy, title= t]
  INPUTS:
	First_x, First_y: Vectors containing X and Y coordinates of points in
			  the first image
	Second_x, Second_y: vectors containing X and Y coodinates of points in
			  the second image.  SEE RESTRICTIONS.
  OPTIONAL INPUTS:
	Window:   Specify IDL Window number.  If no number is specified, routine
		  selects a currently free window.
	Mag:      Specify magnitude of differential vectors.  Default is x10.
	Large:    Output window is 824 x 824 pixels.  Default is 512 x 512
	Hardcopy: If present and non-zero, routine will automatically print
 		  out the coordplotted window (intended for use with the LARGE 
		  keyword).  This uses the TVLASER routine.  See TVLASER for 
		  more details.
	Title:    Specify title of plot for hardcopy
  OUTPUTS:
	None.
  SIDE EFFECTS:
	A plot window is created. 
  RESTRICTIONS:
	First_x, First_y, Second_x, Second_y must all be one-dimensional arrays
       and all have the same number of elements.  There must be a one-to-one
       relation between the points in the four sets (i.e. The Nth item of each
	array must correspond to the same image data point in all four cases)
   COMMON BLOCKS:
	None.
   MODIFICATION HISTORY
	Created from scratch by Joel D. Offenberg, STX, Aug 1991
	Based on a concept by Kanav Bhagat, STX.

(See /host/bluemoon/usr2/idllib/uit/pro/coordplot.pro)


COORD_INDEX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COORD_INDEX
 PURPOSE:
	A SHOWPHOT procedure to find cross-index two sets of coordinates, 
	looking for unique matches.
 CALLING SEQUENCE:
	coord_index, x1, y1, x2, y2, ind1, ind2 [, SEPARATION=sep]
 INPUTS:
	x1    An array containing the first coord. of the first set of coords.
	y1    An array containing the second coord. of the first set of coords.
	x2    An array containing the first coord. of the second set of coords.
	y2    An array containing the second coord. of the second set of coords.
 OUTPUTS:
	ind1  The array of indices indicating which elements in the second
	      coordinate set match the elements in the first.  -1's indicate
	      unmatched elements.
	ind2  The array of indices indicating which elements in the first
	      coordinate set match the elements in the second.  -1's indicate
	      unmatched elements.
 KEYWORDS:
	SEPARATION  Indicates the maximum separation allowed between matching
	            coordinates.  This parameter may be no less than 0.5 and
	            it defaults to 1.
 RESTRICTIONS:
	The two components of each set of coordinates must have the same
	length.  The two sets of coordinates need not.
 PROCEDURE:
	SRCOR is used to find the matches between the two tables.  The index
	arrays returned by this procedure are then converted into the format
	required by SHOWPHOT (seen the OUTPUTS section above).
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 28 April 1992.
	Rewritten using SRCOR.  MRG, Hughes STX, 15 May 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/coord_index.pro)


COPYCHAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COPYCHAN
 PURPOSE:
	To copy an image from one window to another.  X-windows version

 CALLING SEQUENCE:
	copychan, in, out, [ /PIXMAP]

 OPTIONAL INPUTS:
	in   - window to be copied (0-127), this window must already exist
	out  - window to copy to (0-127).   If the output window does not
		already exist, it will be created
	COPYCHAN will prompt for the input and output windows if not supplied

 OUTPUTS:
	none

 SIDE EFFECTS:
	Image on input window is copied to output window.  The active window
	is not changed.

 EXAMPLE:
	An image in plane 0 will have graphics written over it by VIDEO.   
	Save the pristine image in a PIXMAP so that it can be quickly 
	redisplayed.

	IDL> COPYCHAN,0,5,/PIX              ;Save image in pixmap on window 5
	.........VIDEO graphics overlay commands
	IDL> COPYCHAN,5,0                   ;Restore the pristine image 

 REVISION HISTORY:
	written by W. Landsman    February, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/copychan.pro)


CORREL_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	correl_images
 PURPOSE:
	Computes the 2-D cross-correlation function of two images for
	a range of (x,y) shifting by pixels of one image relative to the other.
 CATEGORY:
	E3 correlation (image)
 CALLING SEQUENCE:
		Result = correl_images( image_A, image_B )
 INPUTS:
		image_A, image_B = the two images of interest.
 KEYWORDS:
	XSHIFT = the + & - shift to be applied in X direction, default=7.
	YSHIFT = the Y direction + & - shifting, default=7.
	XOFFSET_B = initial X pixel offset of image_B relative to image_A.
	YOFFSET_B = Y pixel offset, defaults are (0,0).
	REDUCTION = optional reduction factor causes computation of
			Low resolution correlation of bin averaged images,
			thus faster. Can be used to get approximate optimal
			(x,y) offset of images, and then called for successive
			lower reductions in conjunction with CorrMat_Analyze
			until REDUCTION=1, getting offset up to single pixel.
	MAGNIFICATION = option causes computation of high resolution correlation
			of magnified images, thus much slower.
			Shifting distance is automatically = 2 + Magnification,
			and optimal pixel offset should be known and specified.
			Optimal offset can then be found to fractional pixels
			using CorrMat_Analyze( correl_images( ) ).
	/NUMPIX	 causes the number of pixels for each correlation
		to be saved in a second image, concatenated to the
		correlation image, so Result is fltarr( Nx, Ny, 2 ).
	/MONITOR causes the progress of computation to be briefly printed.
 OUTPUTS:
	Result is the cross-correlation function, given as a matrix.
 PROCEDURES USED:
	nint - Nearest Integer function
 PROCEDURE:
	Loop over all possible (x,y) shifts, compute overlap and correlation
	for each shift. Correlation set to zero when there is no overlap.
 MODIFICATION HISTORY:
	Written, July,1991, Frank Varosi, STX @ NASA/GSFC

(See /host/bluemoon/usr2/idllib/uit/pro/correl_images.pro)


CORREL_OPTIMIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	correl_optimize
 PURPOSE:
	Find the optimal (x,y) pixel offset of image_B relative to image_A,
	by means of maximizing the correlation function.
 CATEGORY:
	E3 correlation (image)
 CALLING SEQUENCE:
	correl_optimize, image_A, image_B, xoffset_optimum, yoffset_optimum 
 INPUTS:
	image_A, image_B = the two images of interest.
 KEYWORDS:
	XOFF_INIT = initial X pixel offset of image_B relative to image_A,
	YOFF_INIT = Y pixel offset, (default offsets are 0 and 0).
	MAGNIFICATION = option to determine offsets up to fractional pixels,
			(example: MAG=2 means 1/2 pixel accuracy, default=1).
	/NUMPIX: sqrt( sqrt( # pixels )) used as correlation weighting factor.
	/MONITOR causes the progress of computation to be briefly printed.
	/PRINT causes the results of analysis to be printed.
 OUTPUTS:
	xoffset_optimum = optimal X pixel offset of image_B relative to image_A.
	yoffset_optimum = optimal Y pixel offset.
 CALLS:
	function  correl_images( image_A, image_B )
	pro  corrmat_analyze
 PROCEDURE:
	The combination of function correl_images( image_A, image_B ) and
	corrmat_analyze of the result is used to obtain the (x,y) offset
	yielding maximal correlation. The combination is first executed at
	large REDUCTION factors to speed up computation, then zooming in 
	recursively on the optimal (x,y) offset by factors of 2.
	Finally, the MAGNIFICATION option (if specified)
	is executed to determine the (x,y) offset up to fractional pixels.
 MODIFICATION HISTORY:
	Written, July,1991, Frank Varosi, STX @ NASA/GSFC

(See /host/bluemoon/usr2/idllib/uit/pro/correl_optimize.pro)


CORRMAT_ANALYZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	corrmat_analyze
 PURPOSE:
	Analyze the 2-D cross-correlation function of two images
	and find the optimal(x,y) pixel offsets.
	Intended for use with function CORREL_IMAGES.
 CATEGORY:
	E3 correlation (image)
 CALLING SEQUENCE:
	corrmat_analyze, correl_mat, xoffset_optimum, yoffset_optimum, [...]
 INPUTS:
	correl_mat = the cross-correlation matrix of 2 images.
			(as computed by function CORREL_IMAGES( imA, imB ) ).
 NOTE:
	If correl_mat(*,*,1) is the number of pixels for each correlation,
	(the case when /NUMPIX was specified in call to CORREL_IMAGES)
	then sqrt( sqrt( # pixels )) is used as correlation weighting factor.
 KEYWORDS:
	XOFF_INIT = initial X pixel offset of image_B relative to image_A.
	YOFF_INIT = Y pixel offset, (both as specified to correl_images).
	REDUCTION = reduction factor used in call to CORREL_IMAGES.
	MAGNIFICATION = magnification factor used in call to CORREL_IMAGES,
		this allows determination of offsets up to fractions of a pixel.
	PLATEAU_THRESH = threshold used for detecting plateaus in 
		the cross-correlation matrix near maximum, (default=0.01),
		used only if MAGNIFICATION > 1
	/PRINT causes the result of analysis to be printed.
 OUTPUTS:
	xoffset_optimum = optimal X pixel offset of image_B relative to image_A.
	yoffset_optimum = optimal Y pixel offset.
	max_corr = the maximal correlation corresponding to optimal offset.
	edge = 1 if maximum is at edge of correlation domain, otherwise=0.
	plateau = 1 if maximum is in a plateua of correlation function, else=0.
 FUNCTION CALLS:
	function  nint( number )	nearest integer function
 PROCEDURE:
	Find point of maximum cross-correlation and calc. corresponding offsets.
	If MAGNIFICATION > 1:
	the  correl_mat is checked for plateau near maximum, and if found,
	the center of plateau is taken as point of maximum cross-correlation.
 MODIFICATION HISTORY:
	Written, July-1991, Frank Varosi, STX @ NASA/GSFC

(See /host/bluemoon/usr2/idllib/uit/pro/corrmat_analyze.pro)


CROAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CROAM
 PURPOSE:
	To allow a user to roam around an image using the mouse cursor.
       Works on SparcStations but not on VaxStations (see restrictions).
 CALLING SEQUENCE:
	croam, image, xsize=window-x-size, ysize=window-y-size, quiet=printflag
 INPUTS:
	image  The array containing the image to examine.
    KEYWORDS:
	xsize  The x-axis size of the display window.  Defaults to 512.
	ysize  The y-axis size of the display window.  Defaults to 512.
	quiet  A flag indicating whether or not to print positional
	       information.  If present and non-zero, the printing of
	       positional information is suppressed.
 RESTRICTIONS:
	This procedure can only be used on a workstation which allows pixmaps
	larger than the screen size to be defined.     It will work on a 
       SUN but not on a VAX.

	There is an as yet undetermined upper limit to the size of the image.

	Unlike the Deanza version of this routine, this procedure cannot
	zoom in on an image.
 SIDE EFFECTS:
	The current window (or window 0 if no window is current) is resized
	and redisplayed.
 PROCEDURE:
	The image is "displayed" in a pixmap (a window which is not displayed).
	Then, as the cursor is moved around the window, portions of this
	pixmap are copied into the displayed window.

	The procedure terminates once a mouse button has been struck.
 MODIFICATION HISTORY:
	Written for SUN workstations by Michael R. Greason, STX, 
		11 January 1991.
       Fixed free window allocation, outer bounds while roaming
               W. Landsman April 1992

(See /host/bluemoon/usr2/idllib/uit/pro/croam.pro)


CROLL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CROLL
 PURPOSE:
    Roll the current color lookup table at a fixed rate.  
 CALLING SEQUENCE:
    CROLL		;Roll the color table every 0.1 seconds
    CROLL,RATE         ;Specify roll rate in units of 0.1 seconds
    CROLL,RATE,DIRECTION	;Specify direction of roll
 OPTIONAL INPUTS:
    RATE - Rate in units of 0.1 seconds at which the color table
           is updated.
    DIRECTION - If present and non-zero, then color table rolls to the left.
                Otherwise color table rolls to the right
 OUTPUTS:
    None.
 PROCEDURE:
    The color table is read with SAVLUT.  Each color vector is shifted 
    incrementally from 0 to 255.
 EXAMPLES:
    CROLL           ;Roll to the right, update every 0.1 seconds
    CROLL,0.5       ;Roll to the right, update every 0.05 seconds
    CROLL,2,1       ;Roll to the left,  update every 0.2 seconds
 REVISION HISTORY:
    W. B. Landsman, ST Systems          February, 1988
    Modified for workstations.  M. Greason, STX, June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/croll.pro)


CRTWARP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CRTWARP
 PURPOSE:
    Warps an image to match a reference image.  Prompts the user to pick
    out corresponding sources on two display channels using cursor.
    Neighborhood of cursor is searched for max pixel.  POLY_2D used to
    do real work a couple of layers down.   Use CCRTWARP to use centroid
    position rather than position of max pixel value.
 CALLING SEQUENCE:
   crtwarp, ch, chref, oldim, newim [, x, y, xref, yref],$
           boxrad=boxrad,missing=missing,degree=degree,fast=fast
 INPUT PARAMETERS:
    ch    = channel number with display of image to be warped
    chref = channel number with display of reference image
    oldim = image to be warped
    boxrad [keyword] = 'radius' of box to be searched for max; e.g.,
                       boxrad = 5 means the box has 11 pixels on a side
    missing [keyword] = missing keyword of poly_2d
    degree [keyword] = degree of polynomical to be fit; default is 1
    fast [keyword] = flag for nearest-neighbor transformation;	
                     default is bilinear interpolation
 OUTPUT PARAMETERS:
    newim = output image
    x, y, xref, yref [optional] = coordinates of corresponding sources
 COMMON BLOCKS:
    none
 PROCEDURE:
    Calls warplist and imwarp.  Latter calls POLY_2D.
 MODIFICATION HISTORY:
    Written by R. S. Hill, ST Systems Corp., 10 April 1991
    Degree keyword added.  RSH, STX, 15 April 1991
    Fast keyword added.  RSH, STX, 16 April 1991

(See /host/bluemoon/usr2/idllib/uit/pro/crtwarp.pro)


CT2LST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     CT2LST
 PURPOSE:
     To convert local civil time to local mean sidereal time.
 CALLING SEQUENCE:
     CT2LST, Lst, Lng, Tz, Time, [Day, Mon, Year]
 INPUTS:
     Lng   The west longitude in degrees of the place for which the local 
           sidereal time is desired, scalar
     Tz    The time zone of the site in hours.  Use this to easily account 
           for Daylight Savings time (e.g. 4=EDT, 5 = EST/CDT), scalar
     Tme   If the optional parameters are specified then this is the time
           of day of the specified date in decimal hours.  If the optional
           parameters are not specified then this is the Julian date of
           time in question, scalar or vector
 OPTIONAL INPUTS:
     Day   The day of the month.
     Mon   The month, in numerical format.
     Year  The year.
 OUTPUTS:
     Lst   The Local Sideral Time for the date/time specified in hours.
 RESTRICTIONS:
     If specified, the date should be in numerical form.  The year should
     appear as yyyy.
 PROCEDURE:
     The Julian date of the day and time is question is used to determine
     the number of days to have passed since 0 Jan 1968.  This is used
     in conjunction with the GST of that date to extrapolate to the current
     GST; this is then used to get the LST.
 MODIFICATION HISTORY:
     Adapted from the FORTRAN program GETSD by Michael R. Greason, STX, 
          27 October 1988.
     Corrected the handling of "too few arguments".  MRG, Hughes STX,
          25 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/ct2lst.pro)


CTV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CTV
 PURPOSE:
	Load an array to the image display.  It differs from the native IDL 
	procedure TV in the following ways:

	(1)  The size and position of the image is stored in the common block
		IMAGES.
	(2)  The user is warned if the image array is larger than the screen 
		size
	(3)  The window is resized to the size of the image, unless the position
		parameter is given.
	(4)  Negative numbers may be used for the X and Y parameters to extract 
		a subarray of a large image.
	(5)  The optional TITLE and PIXMAP keywords are available

 CALLING SEQUENCE:
	CTV, IMAGE
	CTV, IMAGE, Header [,X,Y,Field]
	CTV, IMAGE, Header [,Position]
	CTV, IMAGE, X, Y [,Field]
	CTV, IMage, Position

 INPUTS:
	IM - Image array to be loaded to the TV screen

 OPTIONAL INPUT PARAMETERS:
	USER can enter up to 4 input parameters: at most, 3 can be integer 
	numbers and one can be a FITS header (String array).  The numerical 
	parameters will be defined thus:

	1 numerical parameter  ==> Position
	2    ''     parameters ==> X and Y (in same order as given)
	3    ''         ''     ==> X, Y and Field (in same order as given)

	The placement of the FITS header, if there is one, can be arbitrary.
	The FIELD parameter can also be given as a keyword parameter.

	X - X position of window, starting from the lower left hand corner of
		the screen. (If X but not Y is specified, X will be the 
		POSITION)
	Y - Y position of window, starting from the lower left hand corner of
		the screen.

	If X and Y are negative, then a 512 x 512 subimage is extracted
	from IM beginning at position X,Y.
	If X and Y aren't given, the current window position is used.

	FIELD - Image window index to be used.  If omitted, the current image
		channel (from the common block TV) is used.  FIELD can also be
		 given as a Keyword Input (See below.)
	HEADER   - FITS header.  Information from the header will be used to
		create the window's title, unless a specific TITLE (keyword) is 
		specified.
	POSITION - Scalar giving position on screen where image will be
		displayed.  Position 0 is in the upper left hand corner and
		positions run from left to right, and from top to bottom.
		See documentation for TV for more information.

 OPTIONAL KEYWORD INPUTS:
	PIXMAP - A keyword parameter indicating whether the image should be
		written to a pixmap instead of a visible window.  If set and 
		non-zero,the image is written to a pixmap.  The PIXMAP keyword
		may be used with any of the four calling sequences.
	FIELD - Same as parameter FIELD above.
	TITLE - A scalar string to be displayed as the title to the image 
		window.
	FIELD - Same as FIELD above

 OUTPUTS:
	None.

 COMMON BLOCKS:
	The current image plane is read from the common block TV.  The lower
	left hand corner and the window size are stored in the common block
	IMAGES.

 SIDE-EFFECTS:
	The current image plane is over-written.  

 RESTRICTIONS: 
	The image array must be two-dimensional.

 MODIFICATION HISTORY:
	Written, W. Landsman September, 1986
	Adapted to workstations.  M. Greason, May 1990.
	Subimage extraction re-installed.  M. Greason, June 1990.
	Use GET_SCREEN_SIZE  to get max window size  W. Landsman March 1991
	Added TITLE keyword         W. Landsman   Sep 1991
	Added HEADER parameter.     J. D. Offenberg  Oct 1991

(See /host/bluemoon/usr2/idllib/uit/pro/ctv.pro)


CTVPARAMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CTVParams
 PURPOSE:
	Used by CTV and CTVSCL to sort out numerical (integer) parameters
	and FITS header.
 INPUTS:
	P - i-th parameter of undetermined type.
	Index- number i (i.e. ordinal position of P among all parameters {P})
 OUTPUTS
	NP- INTARR to receive numerical values of P
	H - FITS header (same value as parameter with type STRARR)
	HYN - Boolean, takes value of 1 if H is filled.
 	TFlag- Boolean, takes value of 1 if routine runs into trouble.  Messages
		indicating type of trouble will be printed to screen.
	Index- incremented if an element of NP is filled.
 RESTRICTIONS:
	P must be a string array or a scalar.
	NP must be of type INTARR, FLTARR, DBLARR
 COMMENT:
 	Routine was created to work with CTV and CTVSCL program and thus is
	fairly eccentric for general use.  IF THIS ROUTINE IS MODIFIED, MAKE
	SURE CTV and CTVSCL ARE ALSO MODIFIED TO ACCOMODATE THE CHANGES.
 Modifcation history:
	Written 	J.D. Offenberg	Oct, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/ctvparams.pro)


CTVRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CTVRD
 PURPOSE:
	Read an image displayed on the TV into an IDL variable.  It differs
	from the function TVRD in three ways:
		(1)  CTVRD is a procedure, wheras TVRD is a function
		(2)  If a starting position X0,Y0 or image size XSIZE,YSIZE is
			not supplied, CTVRD will use the values supplied by the
		             last call to CTV or CTVRD
		(3)  The default channel is the current window, rather than
		window 0.

 CALLING SEQUENCE:
	CTVRD, image, x0, y0, xsize, ysize, channel, ORDER = , TRUE = ,WORDS = 

 OPTIONAL INPUTS:
	X0,Y0       - scalars giving the starting position on the TV display 
		to be read.
	XSIZE,YSIZE - scalars giving the X and Y size of the image to be read
	CHANNEL     - the window to read.  Defaults to the current window.

 OPTIONAL KEYWORD INPUTS:
	ORDER, TRUE, WORDS- These Keywords, if present, are passed directly 
		to the TVRD routine.  See TVRD documentation for more details.

 OUTPUT:
	IMAGE - 2-dimensional byte array read from the TV display

 NOTES:
	The output image array of TVRD is unaffected by the current or roam or 
	zoom in the window

 EXAMPLE:
	Invert the image currently on the TV display
	CTVRD,A            ;Read the current image into the IDL variable A
	CTV,REVERSE(A,2)   ;Reverse the image, and display on the TV

 REVISION HISTORY:
	Written for workstation use.  M. Greason, STX, June 1990.
	Modified to also support IVAS and DeAnza   W. Landsman  STX Feb, 1991
	Keywords added to act as TVRD keywords.  J. Offenberg STX Oct, 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/ctvrd.pro)


CTVSCL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CTVSCL
 PURPOSE:
	Load an array to the image display after byte scaling.  It differs from 
	the IDL procedure TVSCL in the following ways:

	(1)  The default MIN and MAX for the scaling is computed by calculating
		the sky value and variance of the image
	(2)  The size and position of the image is stored in the common block
		IMAGES.
	(3)  The user is warned if the image array is larger than the screen 
		size
	(4)  The window is resized to the size of the image, unless the position
		parameter is given.
	(5)  Negative numbers may be used for the X and Y parameters to extract 
		a subarray of a large image.
	(6)  The MAXD and MIND keywords can be used to specify the range of the
		image to be scaled.
	(7)  An image title can be displayed by either supplying a FITS header
		or by use of the TITLE keyword.
	(8)  The /LOG keyword lets one take the LOG of the image before scaling

 CALLING SEQUENCE:
	CTVSCL,IM,PIXMAP=1	    ;Scale & display image in center of current channel
	CTVSCL,IM,X,Y,HEADER
	CTVSCL,IM,HEADER[,X,Y,FIELD]
	CTVSCL,IM,HEADER[,POS]
	CTVSCL,IM,POS,HEADER
	CTVSCL,IM,X,Y,FIELD, $
            [/PIXMAP,MAXD = maxd, MIND = mind, TOP = top, TITLE = title,/LOG,
		SIGRANGE =[s1,s2],/SILENT ]

	CTVSCL will accept up to 4 parameters following the IM parameter- up 
	to 3 numbers and up to one string array.  The string array is assumed 
	to be a FITS header and can be placed arbitrarily among the number 
	parameters.  The definition of the numerical parameters is dependent 
	upon the number of them: 

	1 number	POSITION 
	2 numbers	X, Y	(in order of appearance in procedure call)
	3 numbers	X, Y, FIELD. (in order of appearance in procedure call)
	FIELD may also be specified as a keyword.	

 INPUTS:
	IM - 2-d image array to be loaded to the image window

 OPTIONAL INPUT PARAMETERS:
	X - X position of display, starting from the lower left hand corner.
	Y - Y position of display, starting from the lower left hand corner.
		If X or Y are not specified, the current window position is 
		used.
		If X and Y are negative, then a 512 x 512 subimage is extracted
		from IM beginning at position X,Y.
		Note that the maximum and minimum values of the subimage (not 
		the original image) are used to scale into a byte array
	POSITION - Scalar giving position on screen where image will be
		displayed.  Position 0 is in the upper left had corner and
		positions run from left to right, and from top to bottom.
		See documentation for TV for information on POSITION.
	FIELD - Image channel to be loaded.  If omitted, the current image
		channel (from the common block TV) is used.
	HEADER = FITS header for image, from which a summary is extracted and
		written to the window's title bar.

 OPTIONAL KEYWORD INPUTS:
	PIXMAP - A keyword parameter indicating whether the image should be
		written to a pixmap instead of a visible window.  If set and 
		non-zero, the image is written to a pixmap.  The PIXMAP 
		keyword may be used with any of the four calling sequences.
	MAXDATA - Maximum value of IM to consider before scaling, scalar
	MINDATA - Minimum value of IM to consider before scaling, scalar
	SILENT - If present and non-zero, all print-to-screen commands are 
		suppressed.
	SIGRANGE - Two-element vector containing range of scaling (*sigma, with
		respect to average.) Default is [-0.5,12].  USE OF SIGRANGE 
		OVER-RIDES MINDATA, MAXDATA.
	TOP - Maximum value of the scaled result, scalar
		The MAXDATA, MINDATA, and TOP keyword values are passed 
		directly to the BYTSCL procedure -- see documentation for BYTSCL
	TITLE - A scalar string to be displayed as the title to the image
		window.
	LOG - If present and non-zero, LOG10 of IMAGE is used.
	FIELD - acts same as FIELD parameter

 OUTPUTS:
	None.

 EXAMPLE:
	One has a 2048 x 2048 image array BIGIM, and associated FITS header, H.
	Display a 512 x 512 subimage starting at pixel (800,800) and include 
	a title extracted from the header

            IDL> ctvscl,IM,-800,-800,H

 COMMON BLOCKS:
	The current image plane is read from the common block TV.  The lower
	left hand corner and the image size are stored in the common block
	IMAGES.

 RESTRICTIONS:
	Program can only store the size and starting position of a single
	image on a given image frame.

 MODIFICATION HISTORY:
	Adapted to workstations.  M. Greason, May 1990.
	Added TITLE keyword, J. Isensee, September 9, 1991.
	Added new default scaling, HEADER parameter, LOG, SIGRANGE keywords  
				J. Offenberg Oct, 1991
	Made more robust scaling, fix position parameter problems WBL May 1992

(See /host/bluemoon/usr2/idllib/uit/pro/ctvscl.pro)


CURFULL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CURFULL

 PURPOSE:
	This program is designed to essentially mimic the IDL CURSOR command,
	but using a full screen cursor rather than a small cross cursor.
	Uses OPLOT and X-windows graphics masking to emulate the cursor.

 CALLING SEQUENCE:
	curfull, [X, Y, WaitFlag], [/DATA, /DEVICE, /NORMAL, /NOWAIT, /WAIT,
		/DOWN, /CHANGE, LINESTYLE=, THICK=, /NOCLIP]

 REQUIRED INPUTS:
	None.

 OPTIONAL INPUTS: 
	WAITFLAG = if equal to zero it sets the NOWAIT keyword {see below} 

 OPTIONAL KEYWORD PARAMETERS:
	DATA = Data coordinates are returned.
	DEVICE = device coordinates are returned.
	NORMAL = normal coordinates are returned.
	NOWAIT = if non-zero the routine will immediately return the cursor's
		present position.
       WAIT = if non-zero will wait for a mouse key click before returning.
       DOWN = equivalent to WAIT
       CHANGE = returns when the mouse is moved OR if a key is clicked.
       LINESTYLE = style of line that makes the cursor.
       THICK = thickness of the line that makes the cursor.
       NOCLIP = if non-zero will make a full-screen cursor, otherwise it will
		default to the value in !P.NOCLIP.

 NOTES:
	Note that this procedure does not allow the "UP" keyword/flag...which 
	doesn't seem to work too well in the origianl CURSOR version anyway.

       If a data coordinate system has not been established, then CURFULL
 	will create one identical to the device coordinate system.   Note
	that this kluge is required even if the user specified /NORMAL
	coordinates, since CURFULL makes use of the OPLOT procedure

	Only tested on X-windows systems.    If this program is interrupted,
	the graphics function might be left in a non-standard state.   Type
	DEVICE,SET_GRAPHICS=3 to return the standard graphics function.

 PROCEDURE:
	The default cursor is blanked out and full-screen (or full plot window, 
 	depending on the value of NOCLIP) intersecting lines are drawn centerd
	on the cursor's position. 

 MODIFICATION HISTORY:
	Written by J. Parker  22 Nov 93
	Create data coordinates if not already present, W. Landsman Nov. 93

(See /host/bluemoon/usr2/idllib/uit/pro/curfull.pro)


CURS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CURS
 PURPOSE:
    Selects an X windows cursor shape
 CALLING SEQUENCE:
    curs		;Interactively select a cursor shape.
    curs, sel   	;Make the given CURSOR_STANDARD value the cursor
                        shape.
 OPTIONAL INPUT:
    sel  -  Either an integer giving the CURSOR_STANDARD value (usually an 
            even value between 0 and 152) indicating the cursor shape, or 
            a string from the following menu
         a -- Up arrow              
         b -- Left-angled arrow
         c -- Right-angled arrow
         d -- Crosshair
         e -- Finger pointing left 
         f -- Finger pointing right
         g -- Narrow crosshair
         h -- Cycle through all possible standard cursor shapes
 OUTPUTS:
    None.
 RESTRICTIONS:
    Uses the CURSOR_STANDARD keyword of the DEVICE procedure, which is
    only available under X windows.
 PROCEDURE:
    If the user supplies a valid cursor shape value, it is set.  Otherwise,
    an interactive command loop is entered; it will continue until a valid
    value is given.
 MODIFICATION HISTORY:
    Converted to VAX 3100 workstations / IDL V2.  M. Greason, STX, May 1990.
    Avoid bad cursor parameter values  W. Landsman   February, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/curs.pro)


CURVAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CURVAL
 PURPOSE:   
	Display values associated with the cursor as it is moved over an image.
	Users on the IVAS or DeAnza may prefer the closely related procedure 
	IMVAL

 CALLING SEQUENCE(S):
	CURVAL        Display x,y and byte intensity (inten)
	CURVAL,HD     Display x,y,inten, and also ra & dec (from header info)
	CURVAL,IM     Display x,y,inten, and also pixel value (from image array)
	CURVAL,HD,IM  Display x,y,inten,pixel value,ra,dec, and also flux  

 INPUTS:
	Hd  = Header array
	Im  = Array containing values that are displayed.  Any type.

 OPTIONAL KEYWORD INPUTS:
	X0,Y0  = coordinates of lower left-hand corner of input image 
		By default, CURVAL uses the values in the common block TV.
	FILENAME  = name of file to where CURVAL data can be saved.
		Data will only be saved if left or center mouse button
		are pressed.
 OUTPUTS:
	None.
 SIDE EFFECTS:
	X and Y values, etc., of the pixel under the cursor are constantly
	displayed.  
	Pressing left or center mouse button prints a line of output, and starts
	a new line.
	Pressing right mouse button exits the procedure.
	If the keyword FILENAME is defined, the date and time, and a heading 
	will be printed in the file before the data.
 REVISION HISTORY:
	Written,  K. Rhode,  STX  May 1990
	(Much of this program was adapted from the IDL procedures 
	CURVAL, written by W. Landsman, and RDPIX, written by D.Stern.)  
 	Added call to UNZOOM_XY      W. Landsman    May 1991
	Added keyword FILENAME	D. Alexander  June 1991
	Updated to use ASTROMETRY structures.  J.D.Offenberg, HSTX, Jan 1993
	Use new astrometry structures          W. Landsman    HSTX, Jan 1994

(See /host/bluemoon/usr2/idllib/uit/pro/curval.pro)


CWARPLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CWARPLIST
 PURPOSE:
    Allows user to cursor-select corresponding sources as shown on two
    different display channels.  Lists of corresponding X, Y coordinates
    returned.  Source located at centroid in image array, in box surrounding
    cursor position.
 CALLING SEQUENCE:
    cwarplist, ch, chref, refim, x, y, xref, yref, FWHM = fwhm
 INPUT PARAMETERS:
    ch     = channel containing one of the images ('object image')
    chref  = channel containing other image ('reference image')
    oldim  = array containing object image
    refim  = array containing reference image
    fwhm [keyword] passed to CNTRD (centroid) function; default=1.5
 OUTPUT PARAMETERS:
    x, y   = coordinates of sources on object image
    xref, yref = corresponding coordinates on reference image
         If x,y and xref,yref already contain values upon calling CWARPLIST,
         then the new coordinates will be appended to the vectors.    This
         allows one to accumulate the vectors with multiple calls to 
         CWARPLIST
 COMMON BLOCKS: none
 SIDE EFFECTS:
    Displays boxes around selected sources.
 MODIFICATION HISTORY:
    Written by R. S. Hill, ST Systems Corp., 10 April 1991
    Changed from WARPLIST to CWARPLIST to do centroiding.
       RSH, STX, 17 April 1991
    Final computed points plotted, not initially chosen ones.  Also,
       fwhm keyword substituted for boxrad.  RSH, STX, 2 May 1991
    User can reject a mistake.  Symbol size increase.  RSH, STX, 5/13/91
    Work on zoomed, offset images  WBL         April 1992

(See /host/bluemoon/usr2/idllib/uit/pro/cwarplist.pro)


CZOOM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:	
	CZOOM
 PURPOSE:
	Display part of an image (or graphics) from the current window
	expanded in another window.
	The cursor is used to mark the center of the zoom.

 CALLING SEQUENCE:
	Czoom, [INC = , /INTERP ]

 INPUTS:
	None - All input parameters are keywords.

 KEYWORD INPUTS:
	Inc = zoom expansion factor, default = 2, maximum = 20.
	Interp = 1 or set to interpolate, otherwise pixel replication is used.

 OUTPUTS:
	No explicit outputs. 

 COMMON BLOCKS:
	Current image plane read from common block TV
	Left hand corner of image and window size read from common block IMAGES

 SIDE EFFECTS:
	A window is created.
	A pixmap window is created and destroyed.

 RESTRICTIONS:
	Only works with color systems.
	Maximum size of zoom window is 512x512

 PROCEDURE:
	Left mouse button decrements zoom by inc,
	Middle mouse button increments zoom by inc,
	Right button exits.
	Zoom window is always active except before first zoom and after
	total unzoom.

 MODIFICATION HISTORY:
	Written by K. Bhagat, ST Systems Corp., 	August 1990
	Revised	   J. D. Offenberg,       STX.,		June 1991
       Added kluge for case where offset applied to original image
                                                 W.Landsman   July, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/czoom.pro)


DAOERF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   DAOERF
 PURPOSE:         
   Calulates the intensity of a 2 dimensional gaussian PSF at a pixel 
   position x, by integrating between x-0.5 and x+0.5.  It differs from
   ERF in 2 ways (to agree with DAOPHOT calls):
       (1)  The number of output elements in F and PDER is identical with
            the number of elements in X and Y
       (2)  The order of the parameter vector A is different
 CALLING SEQUENCE:
   DAOERF,XIN,YIN,A,F		;Calculate the only the value of the function
   DAOERF,XIN,YIN,A,F,PDER	;Also calculate the first derivatives.
 INPUTS:
   XIN - input scalar, vector or array, giving X coordinate values
   YIN - input scalar, vector or array, giving Y coordinate values, must have
         same number of elements as XIN.
   A - 5 element parameter array describing the gaussian
       A(0) - peak intensity
       A(1) - X position of peak intensity (centroid)
       A(2) - Y position of peak intensity (centroid)
       A(3) - X sigma of the gaussian (=FWHM/2.345)         
       A(4) - Y sigma of gaussian
 OUTPUTS:
    F - array containing value of the function at each (XIN,YIN) 
 OPTIONAL OUTPUTS:
    PDER - 2 dimensional array of size (NPTS,5) giving the analytic
         derivative at each value of F with respect to each parameter A.
 REVISION HISTORY:
         Written: W. Landsman                October, 1987

(See /host/bluemoon/usr2/idllib/uit/pro/daoerf.pro)


DAO_VALUE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DAO_VALUE
 PURPOSE:
	This function returns the value of a point-spread function at a
	given point.  The value of the point-spread function is the sum of a
	two-dimensional integral under a bivariate Gaussian function, and 
	a value obtained by interpolation in a look-up table.  DAO_VALUE will
	optionally compute the derivatives wrt X and Y

 CALLING SEQUENCE:
	Result = DAO_VALUE( xx, yy, gauss, psf, [ dvdx, dvdy ] )

 INPUTS:
	XX,YY   - the real coordinates of the desired point relative 
		to the centroid of the point-spread function.
	GAUSS  -  5 element vector describing the bivariate Gaussian
	GAUSS(0)- the peak height of the best-fitting Gaussian profile.
	GAUSS(1,2) - x and y offsets from the centroid of the point-spread 
		function to the center of the best-fitting Gaussian.
	GAUSS(3,4) - the x and y sigmas of the best-fitting Gaussian.
	PSF  -  a NPSF by NPSF array containing the look-up table.

 OUTPUTS:
    RESULT - the computed value of the point-spread function at
             a position XX, YY relative to its centroid (which 
             coincides with the center of the central pixel of the
             look-up table).

 OPTIONAL OUTPUTS:
       DVDX,DVDY - the first derivatives of the composite point-spread
             function with respect to x and y.

 NOTES
 	although the arguments XX,YY of the function DAO_VALUE
	are relative to the centroid of the PSF, the function RINTER which
	DAO_VALUE calls requires coordinates relative to the corner of the 
	array (see code).

 REVISON HISTORY:
	Adapted to IDL by B. Pfarr, STX, 11/17/87 from 1986 STSDAS version
	of DAOPHOT

(See /host/bluemoon/usr2/idllib/uit/pro/dao_value.pro)


DARKSPOT

[Previous Routine] [Next Routine] [List of Routines]
 PROCEDURE:
	DARKSPOT
 PURPOSE:
	Draw circles around UIT's infamous dead spots, including compensating
	for GEOMed images.  Image should be displayed in the current window.

 CALLING SEQUENCE:
	DARKSPOT, HEADER, [ Window = ]

 INPUTS:
	HEADER - FITS header of UIT image in the window.

	Table of dark spots is loaded from the files A_SPOTS.DAT and 
	B_SPOTS.DAT, which are in the UIT_DATA directory.

 KEYWORD INPUTS:
	Window - If specified, the routine will use the window number given 
		rather than the current window.  

 SIDE EFFECTS:
	The currently selected window may change during the running of the 
	routine, but will be back to the original at the exit.

	SVExtast will add the SV parameters (mimicing the same parameters in 
	FLIGHT13 headers) if they are not present in the original header.  This
	will save the necessity to make another look-up in the data base.
 HISTORY:
	 Written J.D. Offenberg, STX, Dec, 1991
	 Updated to use ASTROMETRY structures.  J.D.Offenberg, HSTX, Jan 1993
	 Updated for new ASTROMETRY structures   W. Landsman Jan 1994

(See /host/bluemoon/usr2/idllib/uit/pro/darkspot.pro)


DATATYPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
    DATATYPE
 PURPOSE: 
     Returns data type as a string.  Makes it easier to do
     data type dependent operations.
 CALLING SEQUENCE: 
     TYP = DATATYPE(VAR, [FLAG])
 INPUTS: 
     VAR = a variable.
     [FLAG] = Output format flag: 0 (def) gives 3 char type, else
              type is spelled out.
 OUTPUTS: 
    TYP = a string indicating the data type of VAR.
    TYP is 3 char upper case: UND, STR, BYT, INT, FLO, LON, DOU, COM, STC
    unless FLAG = 1 (non-zero).
 Procedure: 
    Uses the SIZE function to determine the datatype.
 MODIFICATION HISTORY: 
       Written by R. Sterner, 29 June, 1988.
	Johns Hopkins University Applied Physics Laboratory.
       Modified for version 2 IDL B. PFarr, STX, 27 Jan, 1990.
	Added case for variable to be a structure J.D. Offenberg, STX  Dec 1991

(See /host/bluemoon/usr2/idllib/uit/pro/datatype.pro)


DATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DATE
 PURPOSE:
	DATE converts day-of-year to ordinary Gregorian date;
	works on cumulative day from 1-JAN-1979 (for instance),
	as well as more well-mannered days-of-year.
 CALLING SEQUENCE:
       D_STRING = DATE(Year,day)
 INPUTS:
	Year - Years after 1900 may either be written out in full
	(e.g. 1986) or with just the last two digits (e.g. 86)
       Day - number of days after Jan 1 of the specified year
 OUTPUTS:
	D_STRING - String giving date in format '13-MAR-1986'
 RESTRICTIONS:
	Will only work for years after 1900.
 MODIFICATION HISTORY:
       D.M. fecit  24 October,1983

(See /host/bluemoon/usr2/idllib/uit/pro/date.pro)


DATE2EURO

[Previous Routine] [Next Routine] [List of Routines]
 PROCEDURE
  DATE2EURO

 CALLING SEQUENCE
   DATE2EURO,HDR

 PURPOSE 
  CHANGE FORMAT OF DATE-0BS PARAMETER IN A FITS HEADER FROM
  'DD-MON-YYYY' TO 'DD/MM/YY'. 

 INPUT/OUTPUT
  HDR  - HEADER TO BE FIXED

 REVISION HISTORY
  WRITTEN BY N. COLLINS, HUGHES/STX, 30-JAN-1992

(See /host/bluemoon/usr2/idllib/uit/pro/date2euro.pro)


DATE_CONV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    DATE_CONV
 PURPOSE:
    Procedure to perform conversion of dates to one of three possible
    formats.

	format 1: real*8 scalar encoded as:
	    (year-1900)*1000 + day + hour/24. + min/24./60 + sec/24./60/60
		where day is the day of year (1 to 366)
	format 2: Vector encoded as:
		date(0) = year (eg. 1987 or just 87)
		date(1) = day of year (1 to 366)
		date(2) = hour
		date(3) = minute
		date(4) = second
	format 3: string (ascii text) encoded as
		DD-MON-YEAR HH:MM:SS.SS
		(eg.  14-JUL-1987 15:25:44.23)
	format 4: three element vector giving spacecraft time words
		from ST telemetry packet.
 CALLING SEQUENCE
	results = DATE_CONV(DATE,TYPE)
 INPUTS:
	DATE - input date in one of the three possible formats.
	TYPE - type of output format desired.  If not supplied then
		format 3 (real*8 scalar) is used.
		valid values:
			'REAL'	- format 1
			'VECTOR' - format 2
			'STRING' - format 3
               TYPE can be abbreviated to the single character strings 'R',
               'V', and 'S'.
		Nobody wants to convert TO spacecraft time (I hope!)
 OUTPUTS:
	The converted date is returned as the function value.
 HISTORY:
	version 1  D. Lindler  July, 1987
       adapted for IDL version 2  J. Isensee  May, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/date_conv.pro)


DAYCNV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       DAYCNV
 PURPOSE:
       Converts julian dates to gregorian calendar dates
 CALLING SEQUENCE:
       DAYCNV,XJD,YR,MN,DAY,HR
 INPUTS:
       XJD = Julian date, double precision scalar or vector
 OUTPUTS:
       YR = Year (Integer)
       MN = Month (Integer)
       DAY = Day (Integer)
       HR = Hours and fractional hours (Real).   If XJD is a vector,
            then YR,MN,DAY and HR will be vectors of the same length.
 EXAMPLE:
       DAYCNV,2440000.,YR,MN,DAY,HR
       yields YR = 1968, MN =5, DAY = 23, HR =12.
 REVISION HISTORY:
       Converted to IDL from Yeoman's Comet Ephemeris Generator, 
       B. Pfarr, STX, 6/16/88

(See /host/bluemoon/usr2/idllib/uit/pro/daycnv.pro)


DBBUILD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBBUILD
 PURPOSE:
	Build a database by appending new values for every item.  The database
	must be opened for update (with DBOPEN) before calling DBBUILD.

 CALLING SEQUENCE:
	dbbuild, [ v1, v2, v3, v4......v25, NOINDEX = ]

 INPUTS:
	v1,v2....v25 - vectors containing values for all items in the database.
         V1 contains values for the first item, V2 for the second, etc.
         The number of vectors supplied must equal the number of items
         (excluding entry number) in the database.  The number of elements 
         in each vector should be the same.   A multiple valued item
         should be dimensioned NVALUE by NENTRY, where NVALUE is the number
         of values, and NENTRY is the number of entries.

 OPTIONAL KEYWORD:
	NOINDEX - If this keyword is supplied and non-zero then DBBUILD will
             *not* create an indexed file.    Useful to save time if
             DBBUILD is to be called several times and the indexed file need
             only be created on the last call

	STATUS - Returns a status code denoting whether the operation was
	      successful (1) or unsuccessful (0).  Useful when DBBUILD is
	      called from within other applications.

 EXAMPLE:
	Suppose a database named STARS contains the four items NAME,RA,DEC, and 
	FLUX.   Assume that one already has the four vectors containing the
	values, and that the database definition (.DBD) file already exists.

	IDL> !PRIV=2                  ;Writing to database requires !PRIV=2
	IDL> dbcreate,'stars',1,1   ;Create database (.DBF) & index (.DBX) file
	IDL> dbopen,'stars',1         ;Open database for update
	IDL> dbbuild,name,ra,dec,flux ;Write 4 vectors into the database

 NOTES:
	Do not call DBCREATE before DBBUILD if you want to append entries to
	an existing database

	DBBUILD checks that each value vector matches the idl type given in the
	database definition (.DBD) file, and that character strings are the 
	proper length. 
 REVISION HISTORY:
	Written          W. Landsman           March, 1989
	Added /NOINDEX keyword           W. Landsman        November, 1992
	User no longer need supply all items   W. Landsman  December, 1992 
	Added STATUS keyword, William Thompson, GSFC, 1 April 1994

(See /host/bluemoon/usr2/idllib/uit/pro/dbbuild.pro)


DBCIRCLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBCIRCLE
 PURPOSE:
	Find sources in a database within a specified radius of a specified
	center.  Database should include RA and DEC items and should previously
	be opened with DBOPEN

 CALLING SEQUENCE:
	list = DBCIRCLE( ra_cen, dec_cen, [radius, dis, sublist, /SILENT] )   

 INPUTS:
	RA_CEN - Right ascension of the search center in decimal HOURS, scalar
	DEC_CEN - Declination of the search center in decimal DEGREES, scalar
		RA_CEN and DEC_CEN should be in the same equinox as the 
		currently opened catalog.

 OPTIONAL INPUT:
	RADIUS - Radius of the search field in arc minutes, scalar.
		DBCIRCLE prompts for RADIUS if not supplied.
	SUBLIST - Vector giving entry numbers in currently opened database
		to be searched.  Default is to search all entries

 OUTPUTS:
     LIST - Vector giving entry numbers in the currently opened catalog
            which have positions within the specified search circle
            LIST is set to -1 if no sources fall within the search circle
            !ERR is set to the number sources found.

 OPTIONAL OUTPUT
	DIS -  The distance in arcminutes of each entry specified by LIST
		to the search center (given by RA_CEN and DEC_CEN)

 OPTIONAL KEYWORD INPUT:
	SILENT - If this keyword is set, then DBCIRCLE will not print the 
		number of entries found at the terminal
	TO_J2000 - If this keyword is set, then the entered coordinates are
		assumed to be in equinox B1950, and will be converted to
		J2000 before searching the database
	TO_B1950 - If this keyword is set, then the entered coordinates are
		assumed to be in equinox J2000, and will be converted to
		B1950 before searching the database
		NOTE: The user must determine on his own whether the database
		is in B1950 or J2000 coordinates.

 METHOD:
	A DBFIND search is first performed on a square area of given radius.
	The list is the restricted to a circular area by using GCIRC to 
	compute the distance of each object to the field center.

 EXAMPLE:
	Find all SAO stars within 40' of the nucleus of M33
	(at 1h 31m 1.67s 30d 24' 15'')

	IDL> dbopen,'sao'
	IDL> list = dbcircle( ten(1,31,1.67), ten(30,24,15), 40)

 REVISION HISTORY:
      Written W. Landsman     STX           January 1990
      Fixed search when crossing 0h         July 1990
      Spiffed up code a bit     October, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/dbcircle.pro)


DBCLOSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBCLOSE
 PURPOSE:
	procedure to close a data base file

 CALLING SEQUENCE:  
	dbclose

 INPUTS:
	None

 OUTPUTS
	None

 SIDE EFFECTS:
 	the data base files currently opened are  closed

 HISTORY:
	version 2  D. Lindler  Oct. 1987
	For IDL version 2      August 1990

(See /host/bluemoon/usr2/idllib/uit/pro/dbclose.pro)


DBCREATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBCREATE
 PURPOSE:
	Create new data base file or modify description.  A database
	definition file (.dbd) file must already exist.
	The default directory must be a ZDBASE: directory.

 CALLING SEQUENCE:
	dbcreate, name,[ newindex, newdb, maxitems]

 INPUT:
	name- name of the data base (with no qualifier), scalar string. 
		The description will be read from the file "NAME".dbd 

 OPTIONAL INPUTS:
	newindex - if non-zero then a new index file is created,
		otherwise it is assumed that changes do not affect the
		index file. (default=0)
	newdb - if non-zero then a new data base file (.dbf) will
		be created. Otherwise changes are assumed not to affect
		the file's present format.
	maxitems - maximum number of items in data base.
		If not supplied then the number of items is
		limited to 200.
 OUTPUTS:
	none

 SIDE EFFECTS:
	data base description file ZDBASE:name.dbc is created
	and optionally ZDBASE:name.dbf (data file) and
	ZDBASE.dbx (index file) if it is a new data base.

 RESTRICTIONS:
	If newdb=0 is not specified, the changes to the .dbd file can
	not alter the length of the records in the data base file.
	and may not alter positions of current fields in the file.
	permissible changes are:
		1) utilization of spares to create a item or field
		2) change in field name(s)
		3) respecification of index items
		4) changes in default print formats
		5) change in data base title
		6) changes in pointer specification to other data
			data bases

	!priv must be 2 or greater to execute this routine.

 HISTORY:
	version 2  D. Lindler  OCT, 1987
	Modified to work under IDL version 2.  M. Greason, STX, June 1990.
	Modified to work under Unix  D. Neill, ACC, Feb 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/dbcreate.pro)


DBDELETE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBDELETE
 PURPOSE
	Deletes specified entries from data base

 CALLING SEQUENCE:
	DBDELETE, list, [ name ]   

 INPUTS:
	list - list of entries to be deleted, scalar or vector
	name - optional name of data base, scalar string.  If not specified
		then the data base file must be previously opened for update 
               by DBOPEN.

 OPERATIONAL NOTES:
	!PRIV must be at least 3 to execute.

 SIDE EFFECTS:
	The data base file (ZDBASE:name.DBF) is modified by removing the
	specified entries and reordering the remaining entry numbers
       accordingly (ie. if you delete entry 100, it will be replaced
       by entry 101 and the database will contain 1 less entry.

 EXAMPLE:
        Delete entries in a database STARS where RA=DEC = 0.0

        IDL> !PRIV= 3                           ;Set privileges
        IDL> dbopen,'STARS',1                   ;Open for update
        IDL> list = dbfind('ra=0.0,dec=0.0')    ;Obtain LIST vector
        IDL> dbdelete, list             ;Delete specified entries from db

 NOTES:
       The procedure is rather slow because the entire database is re-
       created with the specified entries deleted.
 SYSTEM VARIABLES:
        Set the non-standard system variable !DEBUG = 2 to obtain 
        additional diagnostics   
 COMMON BLOCKS:
	DBCOM
 HISTORY
	Version 2  D. Lindler  July, 1989
       Updated documentation   W. Landsman    December 1992

(See /host/bluemoon/usr2/idllib/uit/pro/dbdelete.pro)


DBEDIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBEDIT

 PURPOSE:
	Interactively edit specified fields in a database.  The
	value of each field is displayed, and the user has the option
	of changing or keeping the value.  Widgets will be used if they
	are available.

 CALLING SEQUENCE:
	dbedit, list, [ items ]

 INPUTS:
	list - scalar or vector of database entry numberss.  Set list = 0 to 
	interactively add a new entry to a database.  Set list = -1 to edit 
	all entries.

 OPTIONAL INPUTS:
	items - list of items to be edited.  If omitted, all fields can be 
	edited. 

 COMMON BLOCKS:
 	DB_COM -- contains information about the opened database.
  	DBW_C -- contains information intrinsic to this program.

 SIDE EFFECTS:
  	Will update the database files.

 RESTRICTIIONS:
  	Database must be opened for update prior to running
  	this program.  User must be running DBEDIT from an 
  	account that has write privileges to the databases.  

	If one is editing an indexed item, then after all edits are complete,
	DBINDEX will be called to reindex the entire item.    This may
	be time consuming.
 EXAMPLE:
	Suppose one wanted to edit all of the previously unknown moon angles 
	(assigned a value of -999) the database FRAMES

	IDL> !priv=2			
	IDL> dbopen, 'frames', 1
	IDL> list = dbfind( 'moonang = -999.0')
	IDL> dbedit, list, 'moonang'

 PROCEDURE:
	(1) Use the cursor and point to the value you want to edit.   
	(2) Type the new field value over the old field value.
	(3) When you are done changing all of the field values for each entry
	save the entry to the databases by pressing 'SAVE ENTRY TO DATABASES'.
	Here all of the values will be checked to see if they are the correct
	data type.  If a field value is not of the correct data type, it will
	not be saved.  

	Use the buttons "PREV ENTRY" and "NEXT ENTRY" to move between entry 
	numbers.  You must save each entry before going on to another entry in 
	order for your changes to be saved.

	Pressing "RESET THIS ENTRY" will remove any unsaved changes to the 
	current entry.

REVISION HISTORY:
	Adapted from Landsman's DBEDIT
	added widgets,  Melissa Marsh, HSTX, August 1993
	do not need to press return after entering each entry,
			fixed layout problem on SUN,
			Melissa Marsh, HSTX, January 1994
	Only updates the fields which are changed. Joel Offenberg, HSTX, Mar 94

(See /host/bluemoon/usr2/idllib/uit/pro/dbedit.pro)


DBEDIT_BASIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	DBEDIT_BASIC
 PURPOSE:
	Interactively edit specified fields in a database.  The
	value of each field is displayed, and the user has the option
	of changing or keeping the value.

 CALLING SEQUENCE:
	dbedit_basic, list, [ items ]

 INPUTS:
	list - scalar or vector of database entry numbers.  Set LIST=0
		to interactively add a new entry to a database.

 OPTIONAL INPUTS
	items - list of items to be edited.  If not supplied, then the
		value of every field will be displayed.

 NOTES:
	(1) Database must be opened for update (dbopen,,1) before
	calling DBEDIT_BASIC.  User must have write privileges on the database
	files.
	(2) User gets a second chance to look at edited values, before
	they are actually written to the database

 PROMPTS:
	The item values for each entry to be edited are first displayed
	User is the asked "EDIT VALUES IN THIS ENTRY (Y(es), N(o), or Q(uit))?
	If user answers 'Y' or hits RETURN, then each item is displayed
	with its current value, which the user can update.  If user answered
	'N' then DBEDIT_BASIC skips to the next  entry.   If user answers 'Q'
	then DBEDIT will exit, saving all previous changes.

 EXAMPLE:
	Suppose V magnitudes (V_MAG) in a database STARS with unknown values 
	were assigned a value of 99.9.  Once the true values become known, the
	database can be edited

	IDL> !PRIV=2 & dbopen,'STARS',1         ;Open database for update
	IDL> list =  dbfind('V_MAG=99.9')       ;Get list of bad V_MAG values
	IDL> dbedit,list,'V_MAG'       ;Interactively insert good V_MAG values

 REVISION HISTORY:
	Written  W. Landsman     STX        April, 1989
	Rename DBEDIT_BASIC from DBEDIT            July, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/dbedit_basic.pro)


DBEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBEXT
 PURPOSE:
	Procedure to extract values of up to 12 items from
	data base file, and place into IDL variables

 CALLING SEQUECE:
	dbext,list,items,v1,[v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12]

 INPUTS:
	list - list of entry numbers to be printed, vector or scalar
		If list = -1, then all entries will be extracted.
		list may be converted to a vector by DBEXT 
	items - standard item list specification.  See DBPRINT for 
		the 6 different ways that items may be specified. 

 OUTPUTS:
	v1...v12 - the vectors of values for up to 12 items.

 EXAMPLE:
	Extract all RA and DEC values from the currently opened database, and
	place into the IDL vectors, IDLRA and IDLDEC.

		IDL> DBEXT,-1,'RA,DEC',idlra,idldec

 HISTORY
	version 2  D. Lindler  NOV. 1987
	check for INDEXED items   W. Landsman   Feb. 1989

(See /host/bluemoon/usr2/idllib/uit/pro/dbext.pro)


DBEXT_DBF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBEXT_DBF
 PURPOSE:
	Procedure to extract values of up to 12 items from a data base file. 
	This is a subroutine of DBEXT, which is the routine a user should 
	normally use.

 CALLING SEQUECE:
	dbext_dbf,list,dbno,sbyte,nbytes,idltype,nval,v1,v2,v3,v4,v5,v6,v7,
					v8,v9,v10,v11,v12

 INPUTS:
	list - list of entry numbers to extract desired items.   It is the 
		entry numbers in the primary data base unless dbno is greater 
		than or equal to -1.  In that case it is the entry number in 
		the specified data base.
	dbno - number of the opened db file
		if set to -1 then all data bases are included
	sbyte - starting byte in the entry.  If single data base then it must 
		be the starting byte for that data base only and not the 
		concatenation of db records 
	nbytes - number of bytes in the entry
	idltype - idl data type of each item to be extracted
	nval - number of values per entry of each item to be extracted

 OUTPUTS:
	v1...v12 - the vectors of values for up to 12 items

 HISTORY
	version 1  D. Lindler  Nov. 1987
	Extract multiple valued entries    W. Landsman   May 1989

(See /host/bluemoon/usr2/idllib/uit/pro/dbext_dbf.pro)


DBEXT_IND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBEXT_IND
 PURPOSE:
	routine to read a indexed item values from index file

 CALLING SEQUENCE:  
	dbext_ind,list,item,dbno,values

 INPUTS:
	list - list of entry numbers to extract values for
		(if it is a scalar, values for all entries are extracted)
	item - item to extract
	dbno - number of the opened data base

 OUTPUT:
	values - vector of values returned as function value
 HISTORY:
	version 1  D. Lindler  Feb 88
	Faster processing of string values    W. Landsman   April, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/dbext_ind.pro)


DBFIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBFIND 
 PURPOSE:
	Function to search data base for entries with specified
	search characteristics.

 CALLING SEQUENCE:
	result = dbfind(spar,[ listin, /SILENT, /FULLSTRING])

 INPUTS:
	spar - search_parameters (string)...each search parameter 
		is of the form:

		option 1) min_val < item_name < max_val
		option 2) item_name = value
		option 3) item_name = [value_1, value_10]
			Note: option 3 is also the slowest.
		option 4) item_name > value
		option 5) item_name < value
		option 6) item_name = value(tolerance) ;eg. temp=25.0(5.2)
		option 7) item_name			;must be non-zero

 		Multiple search parameters are separated by a comma.
		eg.     'cam_no=2,14 is interpreted as greater than or equal.
	
		RA and DEC keyfields are stored as floating point numbers 
		in the data base may be entered as HH:MM:SEC and
		DEG:MIN:SEC. Where:

			HH:MM:SEC   equals  HH + MM/60.0  + SEC/3600.
			DEG:MIN:SEC equals DEG + MIN/60.0 + SEC/3600.
			
		For example:
			40:34:10.5 < dec < 43:25:19 , 8:22:1.0 < ra < 8:23:23.0

		Specially encoded date/time in the data base may
		be entered by  YY/DAY:hr:min:sec which is
		interpreted as  
			YY*1000+DAY+hr/24.0+min/24.0/60.+sec/24.0/3600.

		For example
			85/201:10:35:30

(See /host/bluemoon/usr2/idllib/uit/pro/dbfind.pro)


DBFIND_ENTRY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBFIND_ENTRY
 PURPOSE:
	This is a subroutine of dbfind and is not a standalone procedure
	It performs a entry number search.

 CALLING SEQUENCE:
	dbfind_entry, type, svals, nentries, values

 INPUTS: 
	type - type of search (output from dbfparse)
	svals - search values (output from dbfparse)
	values - array of values to search
 OUTPUT:
	good - indices of good values
	!err is set to number of good values

 REVISION HISTORY:
	D. Lindler  July,1987

(See /host/bluemoon/usr2/idllib/uit/pro/dbfind_entry.pro)


DBFIND_SORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBFIND_SORT   
 PURPOSE:
	This is a subroutine of dbfind and is not a standalone procedure
	It is used to limit the search using sorted values

 CALLING SEQUENCE:
	dbfind_sort, it, type, svals, list

 INPUT: 
	it - item number, scalar
	type - type of search (output from dbfparse)
	svals - search values (output from dbfparse)

 INPUT/OUTPUT:
	list - found entries
	!err is set to number of good values
	!ERR = -2 for an invalid search

 REVISION HISTORY:
	D. Lindler  July,1987

(See /host/bluemoon/usr2/idllib/uit/pro/dbfind_sort.pro)


DBFPARSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBFPARSE
 PURPOSE
	Parse the search string supplied to DBFIND.   Not a standalone routine

 CALLING SEQUENCE:
	DBFPARSE, [ spar, items, stype, values ]

 INPUTS:
	spar - search parameter specification, scalar string

 OUTPUTS:
	items - list of items to search on
	stype - search type, numeric scalar
		0    item=values(j,0)
		-1   item>values(j,0)
		-2   item

(See /host/bluemoon/usr2/idllib/uit/pro/dbfparse.pro)


DBGET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBGET
 PURPOSE:
	Find entry number of fields which contain specified values in
	a specified item.   DBGET is an altnerative to DBFIND when the
	desired search values are not easily expressed as a string.  

 CALLING SEQUENCE:
	list = dbget( item, values, [ listin ], SILENT = )

 INPUTS:
	item - Item name or number
	values -  scalar or vector containing item values to search for.

 OPTIONAL INPUTS:
	listin - list of entries to be searched.  If not supplied, or
		set to -1, then all entries are searched

 OUTPUT:
	list - vector giving the entry number of entries containing desired
		item values.  The number of elements in  LIST may be different 
		from that of VALUE, since a value might be located zero, once, 
		or many times in the database.  Use the function DBMATCH if a 
		one to one correspondence is desired between VALUES and LIST. 
 KEYWORDS:
	SILENT - If this keyword is supplied, then DBGET will not display
		the number of entries found
 EXAMPLE:
	Get info on selected HD stars in Bright Star catalogue

	IDL> dbopen, 'YALE_BS' 
	IDL> hdno = [1141,2363,3574,4128,6192,6314,6668]    ;Desired HD numbers
	IDL> list = dbget( 'HD', hdno )        ;Get corresponding entry numbers

 SYSTEM VARIABLES:
	!ERR is set to the number of entries found
 REVISION HISTORY:
	Written,    W. Landsman      STX     February, 1989

(See /host/bluemoon/usr2/idllib/uit/pro/dbget.pro)


DBHELP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBHELP
 PURPOSE:
	Procedure to either list available databases (if no database is 
	currently open) or the items in the currently open database.

 CALLING SEQUENCE:  
	dbhelp, [ flag , TEXTOUT = ]

 INPUT:
	flag - (optional) if set to nonzero then item or database
		descriptions are also printed
		default=0
		If flag is a string, then it is interpreted as the
		name of a data base (if no data base is opened) or a name 
		of an item in the opened data base.   In this case, help
		is displayed only for the particular item or database

 OUTPUTS:
	None
 OPTIONAL INPUT KEYWORDS:
	textout   Used to determine output device.  If not present, the
		value of !TEXTOUT system variable is used (see TEXTOPEN )
		textout=1	Terminal with /MORE
		textout=2	Terminal without /MORE
		textout=3	.PRT
		textout=4	LASER PRINTER
		textout=5      USER MUST OPEN FILE;            
 METHOD:
	If no data base is opened then a list of data bases are
	printed, otherwise the items in the open data base are printed.

	If a string is supplied for flag and a data base is opened
	flag is assumed to be an item name.  The information for that
	item is printed along with contents in a optional file
	zdbase:dbname_itemname.hlp
	if a string is supplied for flag and no data base is opened,
	then string is assumed to be the name of a data base file.
	only information for that file is printed along with an
	optional file zdbase:dbname.hlp.

 HISTORY
	Version 2  D. Lindler  Nov 1987 (new db format)
	Faster printing of title desc. W. Landsman  May 1989 
	Keyword textout added, J. Isensee, July, 1990
	Modified to work on Unix, D. Neill, ACC, Feb 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/dbhelp.pro)


DBINDEX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBINDEX
 PURPOSE:
	Procedure to create index file for data base

 CALLING SEQUENCE:	
	dbindex, [ items ]

 OPTIONAL INPUT:
	items - names or numbers of items to be index -- if not supplied,
		then all indexed fields will be processed.  

 OUTPUT:
	Index file .dbx is created on disk location ZDBASE:

 OPERATIONAL NOTES:
	Data base must have been previously opened for update
	by DBOPEN 

 HISTORY:
	version 2  D. Lindler  Nov 1987 (new db format)
	W. Landsman    added optional items parameter Feb 1989 
	M. Greason     converted to IDL version 2.  June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/dbindex.pro)


DBINDEX_BLK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBINDEX_BLK
 PURPOSE:
	To set up an associated variable of the correct data-type and offset
	into the file by some amount in preparation for writing to the file.
 CALLING SEQUENCE:
	res = dbindex_blk(unit, nb, bsz, ofb, dtype)
 INPUTS:
	unit   The unit number assigned to the file.
	nb     The number of blocks to offset into the file.
	bsz    The size of each block, in bytes, to offset into the file.
	ofb    The offset into the block, in bytes.
	dtype  The IDL datatype as defined in the SIZE function
 OUTPUTS:
	res    The returned variable.  This is an associated variable.
 RESTRICTIONS:
	The file must have been previously opened.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 14 June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/dbindex_blk.pro)


DBMATCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBMATCH
 PURPOSE:
	Find one entry number in a database for each element in a vector of
	item values.   DBMATCH is especially useful for finding a one-to-one 
	correspondence between entries in different databases, and thus to 
	create the vector needed for database pointers.

 CALLING SEQUENCE:
	list = DBMATCH( item, values, [ listin ] )

 INPUTS:
	ITEM - Item name or number, scalar
	VALUES -  scalar or vector containing item values to search for.

 OPTIONAL INPUTS:
	LISTIN - list of entries to be searched.  If not supplied, or
		set to -1, then all entries are searched
 OUTPUT:
	LIST - vector of entry numbers with the same number of elements as 
		VALUES.  Contains a value of 0 wherever the corresponding item
		value was not found.
 NOTES:
	DBMATCH is meant to be used for items which do not have duplicate values
	in a database (e.g. catalog numbers).  If more than one entry is found
	for a particular item value, then only the first one is stored in LIST.

 EXAMPLE:
	Make a vector which points from entries in the Yale Bright Star catalog
	to those in the SAO catalog, using the HD number

	IDL> dbopen, 'yale_bs'            ;Open the Yale Bright star catalog
	IDL> dbext, -1, 'HD', hd          ;Get the HD numbers
	IDL> dbopen, 'sao'                ;Open the SAO catalog
	IDL> list = dbmatch( 'HD', HD)    ;Get entries in SAO catalog 
					  ;corresponding to each HD number.

 REVISION HISTORY:
	Written,    W. Landsman      STX     February, 1990
	Fixed error when list in parameter used May, 1992
	Faster algorithm with sorted item when listin parameter supplied 
	Nov 1992

(See /host/bluemoon/usr2/idllib/uit/pro/dbmatch.pro)


DBOPEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   DBOPEN
 PURPOSE:
    Routine to open data base files.
 CALLING SEQUENCE:
	dbopen,name,update
 INPUTS:
	name - (Optional) name or names of the data base files to open.
		It has one of the following forms:

		'name'		-open single data base file
		'name1,name2,...,nameN' - open N files which are
				connected via pointers.
		'name,*'	-Open the data base with all data
				bases connected via pointers
		''		-Interactively allow selection of
				the data base files.

		If not supplied then '' is assumed.
		name may optionally be a string array with one name
		per element.

	update - (Optional) Integer flag specifing openning for update.
		0 	- Open for read only
		1	- Open for update
		2	- Open index file for update only
		!PRIV must be 2 or greater to open a file for update.
		If a file is opened for update only a single data base
		can be specified.
 OUTPUTS:
	none
 KEYWORDS:
	UNAVAIL - If present, a "database doesn't exit" flag is returned
	          through it.  0 = the database exists and was opened (if
	          no other errors arose).  1 = the database doesn't exist.
	          Also if present, the error message for non-existant databases
	          is suppressed.  The action, however, remains the same.  If
	          specifiying this, be sure that the variable passed exists
	          before the call to DBOPEN.
 SIDE EFFECTS:
 	This .DBF and .dbx files are opened using unit numbers obtained by
 	GET_LUN.  Descriptions of the files are placed in the common block
 	DB_COM.
 HISTORY:
	Version 2, D. Lindler, Nov. 1987
       For IDL Version 2  W. Landsman May 1990 -- Will require further 
           modfication once SCREEN_SELECT is working
	Modified to work under Unix, D. Neill, ACC, Feb 1991.
	UNAVAIL keyword added.  M. Greason, Hughes STX, Feb 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/dbopen.pro)


DBPRINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     DBPRINT
 PURPOSE:
	Procedure to print specified items from a list of database entries

 CALLING SEQUENCE:	
	dbprint, list, [items, FORMS= , TEXTOUT= , NOHeader = ]  

 INPUTS:
	list  - list of entry numbers to be printed, vector or scalar 
		if list = -1, then all entries will be printed.
		An error message is returned if any entry number is larger
		than the number of entries in the database

 OPTIONAL INPUT-OUTPUT:
	items - items to be printed, specified in any of the following ways:

		form 1  scalar string giving item(s) as list of names
			separated by commas
		form 2  string array giving list of item names
		form 3	string of form '$filename' giving name
			of text file containing items (one item per
			line)
		form 4  integer scalar giving single item number or
			  integer vector list of item numbers
		form 5  Null string specifying interactive selection.   This
                       is the default if 'items' is not supplied
		form 6	'*'	select all items, printout will be in
                       table format. 

            If items was undefined or a null string on input, then
            on output it will contain the items interactively selected.

 OPTIONAL INPUT KEYWORDS:
	FORMS     The number of printed lines per page. If forms is not 
		present, output assumed to be in PORTRAIT form, and 
		a heading and 47 lines are printed on each page, with
		a page eject between each page.  For LANDSCAPE form with
		headings on each page, and a page eject between pages, set 
		forms = 34.  For a heading only on the first page, and no
		page eject, set forms = 0.   This is the default for output
		to the terminal

	TEXTOUT   Used to determine output device.  If not present, the
		value of !TEXTOUT system variable is used.
		textout=1	Terminal with /MORE
		textout=2	Terminal without /MORE
		textout=3     	.prt    
		textout=4	laser.tmp
		textout=5      user must open file          
		textout = filename (default extension of .prt)

	NOHEADER - If this keyword is set, then the column headers will not
		be printed

 SYSTEM VARIABLES:
	Output device controlled by non-standard system varaible !TEXTOUT, if 
	TEXTOUT keyword is not used.    

 NOTES:
	Users may want to adjust the default lines_per_page value given at
	the beginning of the program for their own particular printer.

 HISTORY:
	version 2  D. Lindler  Nov. 1987 (new db format)
	Extra space added at end of printout  W. Landsman Nov. 1990
	Test if user pressed 'Q' in response to /MORE W. Landsman  Sep 1991
	Apply STRTRIM to free form output        W. Landsman   Dec 1992
	Test for string value of TEXTOUT         W. Landsman   Feb 1994

(See /host/bluemoon/usr2/idllib/uit/pro/dbprint.pro)


DBPUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBPUT
 PURPOSE:
	Procedure to place a new value for a specified item into
	a data base file entry.

 CALLING SEQUENCE:	
	dbput, item, val, entry

 INPUTS:
	item - item name or number
	val - item value(s)

 INPUT/OUTPUT:
	entry - entry (byte array) or scalar entry number.
	        if entry is a scalar entry number then the data
	        base file will be updated.  Otherwise the change
	        will be only made to the entry array which must
	        be written latter using DBWRT.

 OPERATIONAL NOTES:
	If entry is a scalar entry number or the input file name
	is supplied, the entry in the data base will be updated
	instead of a supplied entry variable.  In this case, !priv
	must be greater than 1.
 HISTORY:
	version 2  D. Lindler  Feb 1988 (new db formats)
	modified to convert blanks into zeros correctly D. Neill Jan 1991

(See /host/bluemoon/usr2/idllib/uit/pro/dbput.pro)


DBRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBRD
 PURPOSE:
	procedure to read an entry from a data base file or from
	linked multiple databases.

 CALLING SEQUENCE:
	dbrd, enum, entry, [available, dbno]

 INPUTS:
	enum - entry number to read, integer scalar

 OUTPUT:
	entry - byte array containing the entry

 OPTIONAL OUTPUT:
	available - byte array with length equal to number of data
		bases opened.  available(i) eq 1 if an entry (pointed
		to) is available.  It always equals 1 for the first 
		data base, otherwise it is an error condition.

 OPTIONAL  INPUT:
	dbno - specification of the data base number to return.  If
		supplied, only the record for the requested data base
		number is returned in entry.  Normally this input should
		not be supplied.  dbno is numbered for 0 to n-1 and gives
		the number of the data base opened.  The data bases are 
		numbered in the order supplied to dbopen.  If dbno is supplied 
		then the entry number refers to that data base and not the
		primary or first data base. If set to -1, then it means all
		data bases opened (same as not supplying it)
 OPERATIONAL NOTES:
	If multiple data base files are opened, the records are
	concatenated with each other
 HISTORY
	version 2  D. Lindler  Nov. 1987

(See /host/bluemoon/usr2/idllib/uit/pro/dbrd.pro)


DBSEARCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBSEARCH
 PURPOSE:
	Search a vector for specified values
	This is a subroutine of dbfind and is not a standalone procedure

 CALLING SEQUENCE:
	dbsearch, type, svals, values, good, FULLSTRING = fullstring

 INPUT: 
	type - type of search (output from dbfparse)
	svals - search values (output from dbfparse)
	values - array of values to search

 OUTPUT:
	good - indices of good values
	!err is set to number of good values

 OPTIONAL INPUT KEYWORD:
	FULLSTRING - By default, one has a match if a search string is 
		included in any part of a database value (substring match).   
		But if /FULLSTRING is set, then all characters in the database
		value must match the search string (excluding leading and 
		trailing blanks).    Both types of string searches are case
		insensitive.
 REVISION HISTORY:
	D. Lindler  July,1987

(See /host/bluemoon/usr2/idllib/uit/pro/dbsearch.pro)


DBSORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBSORT
 PURPOSE:
	Routine to sort list of entries in data base

 CALLING SEQUENCE: 
	result = dbsort( list, items , [ REVERSE = ])

 INPUTS:
	list - list of entry numbers to sort
		-1 to sort all entries
	items - list of items to sort (up to 9 items)

 OUTPUT:
	result - numeric vector giving input list sorted by items

 OPTIONAL KEYWORD INPUT:
	REVERSE - scalar or vector with the same number of elements as the
	  the number of items to sort.  If the corresponding element of REVERSE 
	  is non-zero then that item is sorted in descending rather than 
	  ascending order.

 EXAMPLE:
	Sort an astronomical catalog with RA as primary sort, and declination
	as secondary sort (used when RA values are equal)

	   IDL> NEWLIST = DBSORT( -1, 'RA,DEC' )

	If for some reason, one wanted the DEC sorted in descending order, but
	the RA in ascending order

	   IDL> NEWLIST = DBSORT( -1, 'RA,DEC', REV = [ 0, 1 ] )

 METHOD:
	The list is sorted such that each item is sorted into
	asscending order starting with the last item.
 COMMON BLOCKS:
	DBCOM
 PROCEDURES USED:
	ZPARCHECK, BSORT, DB_ITEM
 HISTORY
	VERSION 1  D. Lindler  Oct. 86
       Added REVERSE keyword   W. Landsman        August, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/dbsort.pro)


DBTITLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	DBTITLE
 PURPOSE:
	function to create title line for routine dbprint

 CALLING SEQUENCE:
	result = dbtitle( c, f )

 INPUTS:
	c = string array of titles for each item
	f = field length of each item

 OUTPUT:
	header string returned as function value

 OPERATIONAL NOTES:
	this is a subroutine of DBPRINT.

 HISTORY:
	version 1  D. Lindler  Sept 86

(See /host/bluemoon/usr2/idllib/uit/pro/dbtitle.pro)


DBUPDATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBUPDATE
 PURPOSE:
	Update columns of data in a database  -- inverse of DBEXT
	Database must be open for update before calling DBUPDATE

 CALLING SEQUENCE:
	dbupdate, list, items, v1, [ v2, v3, v4......v14 ]

 INPUTS:
	list - entries in database to be updated, scalar or vector
		If list=-1 then all entries will be updated
	items -standard list of items that will be updated.  
	v1,v2....v14 - vectors containing values for specified items.  The
		number of vectors supplied must equal the number of items
		specified.   The number of elements in each vector should be
		the same.

 EXAMPLES:
	A database STAR contains RA and DEC in radians, convert to degrees

	IDL> !PRIV=2 & dbopen,'STAR',1          ;Open database for update
	IDL> dbext,-1,'RA,DEC',ra,dec          ;Extract RA and DEC, all entries 
	IDL> ra = ra*!RADEG & dec=dec*!RADEG    ;Convert to degrees
	IDL> dbupdate,-1,'RA,DEC',ra,dec        ;Update database with new values

 NOTES:
	It is quicker to update several items simultaneously rather than use
	repeated calls to DBUPDATE.  
 
	It is possible to update multiple valued items.  In this case, the
	input vector should be of dimension (NVAL,NLIST) where NVAL is the
	number of values per item, and NLIST is the number of entries to be
	updated.  This vector will be temporarily transposed by DBUPDATE but
	will be restored before DBUPDATE exits.

 REVISION HISTORY
	Written W. Landsman      STX       March, 1989
	Work for multiple valued items     May, 1991
	String arrays no longer need to be fixed length      December 1992
	Transpose multiple array items back on output        December 1993

(See /host/bluemoon/usr2/idllib/uit/pro/dbupdate.pro)


DBVAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBVAL
 PURPOSE:
	procedure to extract value(s) of the specified item from
	a data base file entry.

 CALLING SEQUENCE:
	result = dbval( entry, item )

 INPUTS:
	entry - byte array containing the entry, or a scalar entry number
	item - name (string) or number (integer) of the item

 OUTPUT:
	the value(s) will be returned as the function value

 EXAMPLE:
	Extract a flux vector from entry 28 of the database FARUV
	==> flux = dbval(28,'FLUX')

 HISTORY:
   version 2  D. Lindler Nov, 1987	(new db format)

(See /host/bluemoon/usr2/idllib/uit/pro/dbval.pro)


DBWIDGETS

[Previous Routine] [Next Routine] [List of Routines]
PROGRAM:
	dbwidgets
PURPOSE:
	Interactive OBprogram that can open databases, close databases, 
	provide information and help about databases, extract information from 
	databases, and draw boxes around sources in an image found in a 
	specified database.  
CALLING SEQUENCE:
	dbwidgets
	Because of the use of widgets, many common blocks are used.  A common 
	block is then used to return data to main.
RESTRICTIONS:
	Widgets must be available to run this program.
COMMENTS:
	Use DB_CONV to convert the data that can be extracted.
	Documentation exists on how to run DBWIDGETS and DB_CONV.
MODIFICATION HISTORY:
	Written by Melissa Marsh, Hughes STX, August 1992

	SORT option added.  Common blocks are now all defined the same
	for each call, eliminating the need for the "Main" level declarations.
			Joel D. Offenberg, HSTX, 29 Oct, 1992
 	
	Modified calls to Xmenu so that it uses multiple columns if needed
			JDO, HSTX, 17 Nov, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/dbwidgets.pro)


DBWRT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBWRT
 PURPOSE:
	procedure to update or add a new entry to a data base

 CALLING SEQUENCE:
	dbwrt, entry, [ index, append ]

 INPUTS:
	entry - entry record to be updated or added if first
		item (entry number=0)

 OPTIONAL INPUTS:
	index - optional integer flag,  if set to non zero then index
		file is  updated. (default=0, do not update index file)
		(Updating the index file is time-consuming, and should
		normally be done after all changes have been made.
	append - optional integer flag, if set to non-zero the record
		is appended as a new entry, regardless of what the
		entry number in the record is.  The entry number will
		be reset to the next entry number in the file.
 OUTPUTS:
	data base file is updated.                    
	If index is non-zero then the index file is updated.
 OPERATIONAL NOTES:
	!PRIV must be greater than 1 to execute
 HISTORY:
	version 2  D. Lindler  Feb. 1988 (new db format)
	converted to IDL Version 2.  M. Greason, STX, June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/dbwrt.pro)


DBXPUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   DBXPUT
 PURPOSE:
   routine to replace value of an item in a data base entry
 CALLING SEQENCE:	
   dbxput,val,entry,idltype,sbyte,nbytes
 INPUT:
	val - value(s) to be placed into entry, string values might be
             truncated to fit number of allowed bytes in item
	entry - entry to be updated
	idltype - idl data type for item
	sbyte - starting byte in record
	nbytes - total number of bytes in value added
 OUTPUT:
	entry - (updated)
 OPERATIONAL NOTES:
       This routine assumes that the calling procedure or user
       knows what he or she is doing.  No validity checks are made
 HISTORY:
	version 1, D. Lindler   Aug, 1986
	converted to IDL Version 2.  M. Greason, STX, June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/dbxput.pro)


DBXVAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DBXVAL
 PURPOSE:
	procedure to quickly return a value of the specified item number
	from the entry

 CALLING SEQUENCE:
	result = dbxval( entry, idltype, nvalues, sbyte, nbytes )

 INPUTS:
	entry - entry from data base (bytarr)
	idltype - idl data type (obtained with db_item_info)
	nvalues - number of values to return (obtained with db_item)
	sbyte - starting byte in the entry (obtained with db_item)
	nbytes - number of bytes (needed only for string type)
			(obtained with db_item)

 OUTPUT:
	function value is value of the specified item in entry

 OPERATIONAL NOTES:
	To increase speed the routine assumes that entry and item are
	valid and that the data base is already opened using dbopen.

 HISTORY:
	version 2  D. Lindler Nov. 1987  (for new db format)

(See /host/bluemoon/usr2/idllib/uit/pro/dbxval.pro)


DB_CONV

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	DB_CONV
PURPOSE:
	To take the data generated from "Dbwidgets.pro" and convert it 	
	into usable form.
CALLING SEQUENCE:
	db_conv,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,$
	V17,V18,V19,V20,V21,V23,V24,V25,V26,V27,V28,V29,V30,V31,V32,V33,$
       V34,V36,V37,V38,V39,V40,V41,V42,V44,V45,V46,V47,V48,V49,V50,V51,$
       V52,V53,V54,V55,V56,V57,V58,V59,V60,V61,V62,V63,V64,V65

OUTPUTS:
	V1,V2,V3..V13 - properly formatted arrays of values.  
COMMENTS:
	   DBWIDGETS must have been used previous to running this program 
	to extract the data.
	   Up to 65 variables may be converted.
	   Documentation exists on how to run DBWIDGETS on DB_CONV.
REVISION HISTORY:
	Written by Melissa C. Marsh, Hughes STX, August 1992

(See /host/bluemoon/usr2/idllib/uit/pro/db_conv.pro)


DB_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    DB_INFO
 PURPOSE:
    Function to obtain information on opened data base file(s)
 CALLING SEQUENCES:
	1)  result = db_info(request)
	2)  result = db_info(request,dbname)
 INPUTS (calling sequence 1):

	request - string specifying requested value(s)
		   value of request	  value returned in result
			'open'		Flag set to 1 if data base(s) are opened
			'number'	Number of data base files opened
			'items'		Total number of items (all db's opened)
			'update'	update flag (1 if opened for update)
			'unit_dbf'	Unit number of the .dbf files
			'unit_dbx'	Unit number of the .dbx files
			'entries'	Number of entries in the db's
			'length'	Record lengths for the db's

 INPUTS (calling sequence 2):

	request - string specifying requested value(s)
		   value of request	  value returned in result
			'name'		Name of the data base
			'number'	Sequential number of the db
			'items'		Number of items for this db
			'item1'		Position of item1 for this db
					in item list for all db's
			'item2'		Position of last item for this db.
			'pointer'	Number of the item which points
					to this db. 0 for first or primary
					db.  -1 if link file pointers.
			'length'	Record length for this db.
			'title'		Title of the data base
			'unit_dbf'	Unit number of the .dbf file
			'unit_dbx'	Unit number of the .dbx file
	    		'entries'	Number of entries in the db
			'seqnum'	Last sequence number used
			'alloc'		Allocated space (# entries)
			'update'	1 if data base opened for update

	dbname - data base name or number
 OUTPUTS:
	Requested value(s) are returned as the function value.
 HISTORY:
	version 1  D. Lindler    Oct. 1987
       changed type from 1 to 7 for IDLV2, J. Isensee, Nov., 1990

(See /host/bluemoon/usr2/idllib/uit/pro/db_info.pro)


DB_ITEM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DB_ITEM
 PURPOSE:
	procedure to return the item numbers and other information
	of a specified item name

 CALLING SEQUENCE:
	db_item, items, itnum, ivalnum, idltype, sbyte, numvals, nbytes

 INPUTS:
	items - item name or number
		form 1  scalar string giving item(s) as list of names
			separated by commas
		form 2  string array giving list of item names
		form 3	string of form '$filename' giving name
			of text file containing items (one item per
			line)
		form 4  integer scalar giving single item number or
			  integer vector list of item numbers
		form 5  Null string specifying interactive selection
                       Upon return items will contain selected items
                       in form 1
		form 6	'*'	select all items

 OUTPUTS:
	itnum - item number
	ivalnum - value(s) number from multiple valued item
	idltype - data type(s) (1=string,2=byte,4=i*4,...)
	sbyte - starting byte(s) in entry
	numvals - number of data values for item(s)
		It is the full length of a vector item unless
		a subscript was supplied
	nbytes - number of bytes for each value
    All outputs are vectors even if a single item is requested

 HISTORY:
	version 2  D. Lindler   Oct. 1987
       Return selected items in form 5   W. Landsman    Jan. 1987

(See /host/bluemoon/usr2/idllib/uit/pro/db_item.pro)


DB_ITEM_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   DB_ITEM_INFO
 PURPOSE:
   routine to return information on selected item(s) in the opened
   data bases.
 CALLING SEQUENCE:
	result = db_item_info(request,itnums)
 INPUTS:
	request - string giving the requested information.
		'name'		- item names
		'idltype'	- IDL data type (integers)
				  see documentation of intrinsic SIZE funtion
		'nvalues'	- vector item length (1 for scalar)
		'sbyte'		- starting byte in .dbf record (use bytepos
				  to get starting byte in record returned by
				  dbrd)
		'nbytes'	- bytes per data value
		'index'		- index types
		'description'	- description of the item
		'pflag'		- pointer item flags
		'pointer'	- data bases the items point to
		'format'	- print formats
		'flen'		- print field length
		'headers'	- print headers
		'bytepos'	- starting byte in dbrd record for the items
		'dbnumber'	- number of the opened data base
		'pnumber'	- number of db it points to (if the db is
					opened)
		'itemnumber'	- item number in the file

	itnums -(optional) Item numbers.  If not supplied info on all items
		are returned.
 OUTPUT:
	Requested information is returned as a vector.  Its type depends
	on the item requested.
 HISTORY:
	version 1  D. Lindler  Nov. 1987

(See /host/bluemoon/usr2/idllib/uit/pro/db_item_info.pro)


DB_OR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     DB_OR
 PURPOSE:
     Combine two vectors of entry numbers, removing duplicate values.
     DB_OR can also be used to remove duplicate values from any longword 
     vector

 CALLING SEQUENCE:
     LIST = DB_OR( LIST1 )          ;Remove duplicate values from LIST1
        or
     LIST = DB_OR( LIST1, LIST2 )   ;Concatenate LIST1 and LIST2, remove dups

 INPUTS:
     LIST1, LIST2 - Vectors containing entry numbers, must be non-negative
                    integers or longwords.
 OUTPUT:
     LIST - Vector containing entry numbers in either LIST1 or LIST2
  
 METHOD
     DB_OR returns where the histogram of the entry vectors is non-zero
 PROCEDURE CALLS
     ZPARCHECK - checks parameters  
 REVISION HISTORY:
   Written,     W. Landsman             February, 1989
   Check for degenerate values  W.L.    February, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/db_or.pro)


DB_TITLES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DB_TITLES
 PURPOSE:
	Print database name and title.  Called by DBHELP
 CALLING SEQUENCE:
	db_titles,fnames,titles
 INPUT:
	fnames - string array of data base names
 SIDE EFFECT:
	Database name is printed along with the description in the .DBC file
 HISTORY:
	version 2  W. Landsman May, 1989
	modified to work under Unix, D. Neill, ACC, Feb 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/db_titles.pro)


DEC2DMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DEC2DMS
 PURPOSE:
	To convert a value from decimal degrees to deg:min:sec.
 CALLING SEQUENCE:
	dec2dms, dec, deg, min, sec
 INPUTS:
	dec     - The decimal number of transform.
 OUTPUTS:
	deg     - The degrees portion of the transformation.
	min     - The minutes portion of the transformation.
	sec     - The seconds portion of the transformation.
 KEYWORDS:
	REVERSE - If present and non-zero, the reverse transformation
	          takes place:  a deg:min:sec combination is converted
	          to decimal deg.  In this case, the INPUTS become
	          the outputs, and the OUTPUTS become the INPUTS.
 NOTE:
	This procedure will work with hr:min:sec conversions with no
	modifications.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 25 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/dec2dms.pro)


DEFINE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    DEFINE
 PURPOSE:
    Use the SETLOG procedure of VMS IDL to emulate the DCL DEFINE 
    command, or use the SETENV procedure of UNIX IDL to set an environment 
    variable.

 CALLING SEQUENCE:
    DEFINE                    ;Prompt for ENVIRONMENT and equivalence names
    DEFINE, Environment_name, Equivalence_name 

 OPTIONAL INPUTS:
    Environment_name - scalar string giving the ENVIRONMENT name to be defined
    Equivalence_name - scalar or vector string giving equivalence name(s) to 
            the ENVIRONMENT.  If multiple names are to assigned to the 
            ENVIRONMENT they can be supplied in either as a string vector or 
            in a single string with the names delineated by commas.

   DEFINE will prompt for ENVIRONMENT_NAME and EQUIVALENCE_NAME if they are
   not supplied.

 EXAMPLE (VMS):
   Define the the logical name ZDBASE to point to the directories 
   UIT$USER1:[JONES] and UIT$USER2:[SMITH]

   DEFINE, 'ZDBASE', 'UIT$USER1:[JONES],UIT$USER2:[SMITH]'
 REVISION HISTORY:
   Written     W. Landsman           June 1990
   Modified for use on Unix  M. Greason, STX, August 1990.
   Combined VAX and Unix versions for use on both machines,
                                 N. Collins, STX, Nov. 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/define.pro)


DEMO

[Previous Routine] [Next Routine] [List of Routines]
 Return the file name string of a file in the IDL directory tree.
 Directory = sub_directory name or null string for main level.
 name = file name.

(See /host/bluemoon/usr2/idllib/uit/pro/demo.pro)


DEREDD

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	DEREDD

  PURPOSE:
	Deredden then Stromgren parameters given for a value of E(b-y)
	See the procedure UVBYBETA for more info.

  CALLING SEQUENCE:
	deredd, eby, by, m1, c1, ub, by0, m0, c0, ub0

  INPUTS:
	Eby - color index E(b-y),scalar
	by - b-y color (observed)
	m1 - Stromgren line blanketing parameter (observed)
	c1 - Stromgren Balmer discontinuity parameter (observed)
	ub - u-b color (observed)

  OUTPUTS:
	by0 - b-y color (dereddened)
	m0 - Line blanketing index (dereddened)
	c0 - Balmer discontinuity parameter (dereddened)
	ub0 - u-b color (dereddened)

  REVISION HISTORY:
    Adapted from FORTRAN routine DEREDD by T.T. Moon 
    W. Landsman          STX Co.        April, 1988

(See /host/bluemoon/usr2/idllib/uit/pro/deredd.pro)


DETABIFY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DETABIFY
 PURPOSE:
	Replaces tabs in character strings with the appropriate number of
	spaces.  The number of space characters inserted is calculated to space
	out to the next effective tab stop, each of which is eight characters
	apart.
 CALLING SEQUENCE:
	Result = DETABIFY(CHAR_STR)
 INPUT PARAMETERS:
	CHAR_STR = Character string variable (or array) to remove tabs from.
 OUTPUT:
	Result of function is CHAR_STR with tabs replaced by spaces.
 OPTIONAL KEYWORD PARAMETERS:
	None.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	CHAR_STR must be a character string variable.
 PROCEDURE:
	Straightforward.
 MODIFICATION HISTORY:
	William Thompson, Feb. 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/detabify.pro)


DFITSRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DFITSRD
 PURPOSE:
	Convert true disk FITS formatted file(s) into STSDAS formatted file(s).
	Disk FITS refers to files (that can be created by IRAF or AIPS) that
	keep the exact format (e.g. 2880 byte record length) of a FITS tape.  
	STSDAS files have a detached header and 512 byte record length. 

 CALLING SEQUNCE: 
	DFITSRD, infile, outname, [ /NOPROMPT ]

 INPUTS:
	INFILE = input FITS file name (default extension .DAT), scalar string
	OUTNAME = output file name (ALWAYS has extensions .hhh for header and 
		.hhd for data; user supplied extensions are ignored.   Scalar
		string

 INTERACTIVE INPUT:
	User will be prompted if INFILE or OUTNAME are undefined or integers.

 NOTES:
	Output files are always created with the extensions .hhh (header) and 
	.hhd (data).     DFITSRD is a shell for the procedure DFITSREAD which
	does the actual processing of the FITS file.

 INPUT KEYWORD PARAMETERS:
	NOPROMPT - If this keyword is set then DFITSRD will not prompt for 
		another file name to be processed.  This keyword is useful 
		when DFITSRD is called from a driver procedure.

 SIDE EFFECTS:
	For each FITS disk file STSDAS disk files will be created
	with names:
		name.hhh and name.hhd
	Fits extension files will have names:
		name_x.HHH and name_x.HHD
	where x runs from 1 to the number of extensions.

 EXAMPLES:
	(1) Prompt for input and output file names
		IDL> dfitsrd,1
  
	(2) Write FITS image, ngc598.fits to an STSDAS files m33.hhh/d 
		IDL> dfitsrd,'ngc598.fits','m33'

 PROCEDURES USED:
	dfitsread, fdecomp, datatype

 MODIFICATION HISTORY:
	B. Pfarr - adapted from FITSRD, modified to read from disk 8/88
	W. Lansdman - display calling sequence if no params suplied Sep. 92

(See /host/bluemoon/usr2/idllib/uit/pro/dfitsrd.pro)


DFITSREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DFITSREAD
 PURPOSE:
	Procedure will read a disk FITS file and write to a STSDAS disk file.
	The header is placed in .HHH and the data is placed in the file 
	.HHD.  This procedure is called by DFITSRD which is the procedure
	that an interactive user would normally use.

 CALLING SEQUENCE: 
	dfitsread, unit, name, [ EXTEN= , NBTYES = ]

 INPUTs:
	unit - unit number of opened input file
	name - file name (without an extension)

 OPTIONAL OUTPUT KEYWORDS:
	EXTEN = This keyword is set to 1 if the FITS header contains the 
		keyword EXTEND = T,  otherwise, exten = 0
		NOTE: exten = 1 does NOT gaurantee extensions are present
	NBYTES - Contains the number of bytes written to disk, integer scalar

 OUTPUT:
	name - name of file if input keyword parameter is supplied
 SIDE EFFECTS:
	files name.hhh and name.hhd are created
 HISTORY:                               
	B. Pfarr - adapted from FITSREAD to handle disk files
	Converted to Version 2 IDL,  K. Bhagat,  August 1990
	Added call to IEEE_TO_HOST, single I/O calls, W. Landsman   Jan, 1992
	Force SIMPLE = 'F' in STSDAS file    W. Landsman Aug 1993

(See /host/bluemoon/usr2/idllib/uit/pro/dfitsread.pro)


DFITSWRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:   
     DFITSWRITE
 PURPOSE:
   Procedure will write an internal SDAS file to a FITS file on disk.
   Note: Called by DFITSWRT
 CALLING SEQUENCE:
   DFITSWRITE, unit,file [, KEYWORD]
 INPUTS:
   unit - IDL logical unit number
   file - internal FITS file name without extension (extension
          is assumed to be .HHH and .HHD)
 OPTIONAL INPUT:
    keyword - FITS keyword to place file name into.  if not supplied
              or equals '' then the file name is not put into the
              header before writing it to disk.
 SIDE EFFECT:
	A FITS file is written to disk.
 PROCEDURE CALLS:
    remchar, sxhread, sxpar, fdecomp, sxaddpar, host_to_ieee
 HISTORY:
    version 3  D. Lindler   Nov. 1986                
    version 5  B. Pfarr  modified from FITSWRITE
    Added HOST_TO_IEEE call W. Landsman            January, 1992
    Remove dummy SDAS group parameters             February, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/dfitswrite.pro)


DFITSWRT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:	
   DFITSWRT
 PURPOSE: 
   Convert ST/SDAS formatted files to true disk FITS formatted file(s).
   D(isk) fits: refers to files (that can be created by IRAF or AIPS) that
   	 keep the exact format (e.g. 2880 byte record length) of a FITS tape.  
   ST/SDAS files: has detached header and 512 byte record length. 
 CALLING SEQUENCE:
   DFITSWRT , iname, oname, [ EXTEND =  ]
 INPUT:
   iname  - name of existing ST/SDAS formatted file to be converted.
           if iname is set to 1, then user will be prompted for file names.
   oname - output file name for to disk FITS file [default DFITS]
           note: user may also specify extension for filename...default
                 is .FITS (i.e. DFITS.FITS).
 KEYWORD:
  extend  - Set this keyword nonzero if you want DFITSWRT to include 
            any SDAS table extensions files into the disk FITS output.
            The table extensions must be of the form iname_extnumber 
            (see example).  
 EXAMPLES:
   (1)   Run DFITSWRT interactively

           IDL> dfitswrt,1

   (2)    You have files SDAS.HHH and SDAS.HHD plus additional SDAS tables 
          or other groups:

           DFITSWRT,'SDAS','SDAS',/EXTEND
           Note: as the disk FITS file is created, it will look for
              the SDAS group (or tables) named:
                  sdas_1.hhh  and sdas_1.hhd
                  sdas_2.hhh  and sdas_2.hhd
                             .
                             :
           Note: the number of group(or table) files depends on the
               number of existing SDAS group(or table) input files.
           The output file will be named SDAS.FITS
 NOTES:
      DFITSWRT does not do any validity checking on the FITS header
      In particular, be sure that the FITS header has EXTEND = 'T'
      if extensions are included.     
 MODIFICATION HISTORY:
	version 3  D. Lindler  Nov 86
       Fixed use of /EXTEND keyword, cleaned up documentation 
                                      W. Landsman  ST Systems  October 91

(See /host/bluemoon/usr2/idllib/uit/pro/dfitswrt.pro)


DIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DIR
 PURPOSE:
	Emulates the DCL command DIRECTORY or 
	the UNIX command ls in its simplest (brief) form.
 CALLING SEQUENCE:
	DIR  [, FILENAME ]
 OPTIONAL INPUT PARAMETERS:
	FILENAME - Filename specification.  Can be of any form that DCL or
                  UNIX recognizes, with some provisos listed below.
                  If omitted, then "." is assumed if on a Sparc Station, or
                  "*.*;*" is assumed if on a VAX.  No parsing of 
                  the filename is performed on the Sparc Station.
                                         
	The following conventions should be used:

	Use DIR,'*.FOR' instead of DIR,'.FOR' to list all files with the 
	extension ".FOR".
       
	Use DIR,'IDL$SYSPROG:' instead of DIR,'IDL$SYSPROG' to list all 
	files in the directory IDL$SYSPROG on a VAX.

 OUTPUTS:
	None.

 SPARC STATION PROCEDURE:
	The filename specification is formed, if necessary, and a command is
	spawned to the operating system to list the directory.
 VAX PROCEDURE:
	The filename specification is formed, and FINDFILE is used to find the
	filenames.  These are then parsed to produce output at the terminal.

 MODIFICATION HISTORY:
	William Thompson	Applied Research Corporation
	September, 1987		8201 Corporate Drive
				Landover, MD  20785
	Changed for use on a SUN workstation from the VMS version.  
		M. Greason, STX, August 1990.
       Combined VAX and SUN versions, N. Collins, Nov 1990.
	Initial 1X in format changed to T1.  RSH, HSTX, 22-May-1992.

(See /host/bluemoon/usr2/idllib/uit/pro/dir.pro)


DISP_ENTRY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DISP_ENTRY
 PURPOSE:
	Write the photometry information to the screen or to a file.

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	disp_entry, tmp [, /APPEND, FILE=filenam, TXTWDGT=outtext]
 INPUTS:
	tmp     - A structure to contain position/magnitude information
	          for the selected star.  It contains:
			XI     - The x coordinate of the star in the image.
			YI     - The y coordinate of the star in the image.
			XT     - The x coordinate of the star in the table.
			YT     - The y coordinate of the star in the table.
			RA     - The right ascension of the star, in degrees.
			DEC    - The declination of the star, in degrees.
			EQNX   - The equinix of the celestial coordinates.
			MAG1   - The first aperture magnitude of the star.
			ERR1   - The first aperture magnitude error.
			MAG2   - The second aperture magnitude of the star.
			ERR2   - The second aperture magnitude error.
			MAG3   - The third aperture magnitude of the star.
			ERR3   - The third aperture magnitude error.
			MAGPSF - The PSF magnitude of the star.
			ERRPSF - The PSF magnitude error.
			SKY    - The sky flux.
			ERRSKY - The sky error.
			IND    - The index in the table of the star.
			FILTER - The table's filter.
			COLOR  - A structure containing the UV color of the
			         star.  This structure contains the color, and
			         two strings indicating the filters used.
 KEYWORDS:
	APPEND  - If present and non-zero, and if FILE has been specified,
	          the information is appended to the end of the file.  
	          Otherwise, a new file is created (overwriting the old one,
	          if necessary).
	FILE    - If present and not a null string, the information is written
	          to a file with this name instead of to the screen.
	TXTWDGT - If present and non-negative, and if FILE has not been specified,
	          the output is written to this widget instead of the standard
	          output.
 COMMON BLOCKS:
	Table_Bk2  The second FITS table block.  See TAB_INIT for details.
 SIDE EFFECTS:
	If FILE has been specified, the file is overwritten (unless APPEND has
	also been specified).
 PROCEDURE:
	If a file name has been specified, the data is written to disk.
	Otherwise it is written to the screen or to the widget.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 24 April 1992.
	Widget support added.  MRG, Hughes STX, 27 April 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/disp_entry.pro)


DISP_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DISP_IMAGE
 PURPOSE:
	To display the image loaded in the Image_Blk COMMON block.

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	disp_image [, /CONTRAST, CHANNEL=chn, TITLE='', XSIZE=xsz, YSIZE=ysz]
 KEYWORDS:
	CHANNEL    The IDL graphics window to display the image in.  If not
	           specified, the current window is used.
	CONTRAST   If present and non-zero, the CONTRAST procedure is called
	           after the image has been displayed.
	REDISPLAY  If present and non-zero, the window channel and size
	           info is determined from a previously displayed image
	           instead of being determined anew.  This keyword overrides
	           all the other keywords except CONTRAST.
	XSIZE      If present and non-zero, this keyword supplies the 
	           horizontal size of the image display.  Defaults to 512.
	YSIZE      If present and non-zero, this keyword supplies the 
	           vertical size of the image display.  Defaults to 512.
	TITLE      A string used as the title of the window.
 COMMON BLOCKS:
	Image_Blk  The image common block, consisting of:
			sclx  The x (horizontal) scale factor.
			scly  The y (vertical) scale factor.
			cn    The channel the image is displayed in.
			im    An array containing the image.
			hd    The image header.
	           The scale factors are computed by dividing the image size
	           by the display size.  Therefore, multiply a display coord.
	           by the scale factors to get the image coord.
 PROCEDURE:
	The image is scaled to the appropriate size and displayed.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 29 April 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/disp_image.pro)


DISTWARP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DISTWARP
 PURPOSE:
	To warp an image using the UIT image distortion models, either
	removing the distortion from an image or putting the distortion
	back into an undistorted image.

 CALLING SEQUENCE:
	distwarp, cam, imin [, imout]

 INPUTS:
	cam      The UIT camera the image was taken with (either A or B).  If
	         neither, nothing is done to the image.
	imin     The image to transform.

 OUTPUTS:
	imout    The transformed image.  If not specified, the it is returned 
	         through "imin."

 KEYWORDS:
	FAST     If present and non-zero, a nearest-neighbor transformation
	         is used.  Otherwise a bilinear transformation is used.
	MISSING  If present, this value is used for points in the transformed
	         image which fall outside the original image are assigned this
	         value.  If this keyword is not specified, those points are
	         extrapolated from the nearest original pixel.
	REVERSE  If present and non-zero, the reverse transformation (from
	         undistorted to distorted) is performed.
	CUBIC:	If set, uses "Cubic convolution" interpolation.  A more
		accurate, but more time-consuming, form of interpolation.

 SIDE EFFECTS:
	If the output image array is not specified, the converted image
	is returned through the input array.

 PROCEDURE:
	POLY_2D is used to perform the resampling.  This procedure simply sets
	up that call.

 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 4 January 1993.
	Added /CUBIC keyword Wayne Landsman Hughes STX  December 1993

(See /host/bluemoon/usr2/idllib/uit/pro/distwarp.pro)


DIST_CIRCLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:	
	DIST_CIRCLE
 PURPOSE:	
	Form a square array in which the value of each element is its
	distance to a specified center.   Useful for circular aperture
	photometry.

 CALLING SEQUENCE:
	DIST_CIRCLE, IM, N, XCEN, YCEN

 INPUTS:
	N = size of result, scalar.   Output array will have dimensions N x N
	XCEN,YCEN = Scalars designating the X,Y pixel center.  These need
		not be integers, and need not be located within the
		output image

 OUTPUTS:
	IM  - N by N floating array in which  the value of each pixel is 
		equal to its distance to XCEN,YCEN

 EXAMPLE:
	Total the flux in a circular aperture within 3' of a specified RA
	and DEC on an 512 x 512 image IM, with a header H.

	IDL> adxy, H, RA, DEC, x, y       ;Convert RA and DEC to X,Y
	IDL> getrot, H, rot, cdelt        ;CDELT gives plate scale deg/pixel
	IDL> cdelt = cdelt*3600.          ;Convert to arc sec/pixel
	IDL> dist_circle, circle, 512, x, y  ;Create a distance circle image
	IDL> circle = circle*abs(cdelt(0))   ;Distances now given in arcseconds
	IDL> good = where(circle LT 180)  ;Within 3 arc minutes
	IDL> print,total( IM(good) )      ;Total pixel values within 3'

 RESTRICTIONS:
	The speed of DIST_CIRCLE decreases and the the demands on virtual
	increase as the square of the output dimensions.   Users should
	dimension the output array as small as possible, and re-use the
	array rather than re-calling DIST_CIRCLE

 MODIFICATION HISTORY:
	Adapted from DIST    W. Landsman            March 1991

(See /host/bluemoon/usr2/idllib/uit/pro/dist_circle.pro)


DIST_COORD_CONV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DIST_COORD_CONV
 PURPOSE:
	To apply the image distortion coordinate transformation equations
	upon a set of coordinates.
 CALLING SEQUENCE:
	dist_coord_conv [, cam [, xi, yi [, xo, yo]]]
 INPUTS:
	cam      Indicates which camera the coordinates came from, either
	         'A' or 'B'.  If it isn't 'A' or 'B', nothing is done to
	         the coordinates.
	xi       A scalar or vector containing the x-axis coordinates to
	         convert.
	yi       A scalar or vector containing the y-axis coordinates to
	         convert.
 OUTPUTS:
	xo       A scalar or vector containing the converted x-axis
	         coordinates.  If not present, these are returned in xi.
	yo       A scalar or vector containing the converted y-axis
	         coordinates.  If not present, these are returned in yi.
 KEYWORDS:
	HEADER   If present (and non-null), the coordinates are assumed to
	         be from a "Geom'ed" image (north-up) and are converted back
	         to the original image before correcting for distortion.  The
	         transformed coordinates are then translated back to the 
	         north-up frame of reference.  The SV... FITS keywords are
	         used to extract the original plate solution from the header;
	         if these aren't found, the headers database is used (a proc.
	         called svextast is used to extract this info).  If the 
	         necessary info cannot be extracted from the header, the
	         transformation without rotation is performed.
	OFFSET	 Additive scale factor between current origin and original 
		 AFTER scaling.  If a scalar is supplied, the same offset is 
		 applied to both axes.  If a vector is supplied, the first 
		 element is the X-axis offset and the second is the 
		 Y-axis offset.
	QUIET    If present and ZERO, the results of the conversion are
	         written to the screen.
	REVERSE  If present and non-zero, the reverse transformation is
	         computed (convert an undistorted coordinate to a 
	         distorted one).
	SCALE    Multiplicative scale factor between current pixel size and 
		 original (e.g. 4.0 for 512x512 compressed UIT image).  If a 
		 scalar is supplied, the same scale size is applied to both 
		 axes.  If a vector is supplied, the first is the X-axis scale,
		 the second the Y-axis scale.
	SUBSTEP  If present and non-zero, the coordinates are assumed to be
	         from a full substepped UIT image (4096x4096 instead of
	         2048x2048).  The coordinates are, therefore, divided by
	         two before processing, and multiplied by two after processing.
	         These positions will not be entirely accurate due to 
	         "resolution" effects.  Any other scaling (from SCALE, OFFSET,
	         and HEADER) takes place before the SUBSTEP scaling is engaged---
	         SCALE, OFFSET and HEADER apply to the original coordinate 
	         system, not the 2048x2048 system.
 SIDE EFFECTS:
	If the output variables are not specified, the converted coordinates
	are returned through the input variables.
 PROCEDURE:
	If not present, cam, xi and yi are requested from the user.  The cam
	and REVERSE parameters are used to select the appropriate set of
	coefficients (which are hard-coded in this procedure).  These
	coefficients are then used to perform the conversion, using matrix
	multiplication.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 10 June 1992.
	Camera B distortion equations added.  MRG, HSTX, 22 June 1992.
	HEADER keyword added.  MRG, HSTX, 6 July 1992.
	Distortion coefficients supplied through DIST_MODEL_COEF.  MRG, HSTX,
		4 January 1993.
	Converted to new, distortion-related, astrometry scheme.  MRG, HSTX,
	 	6 January 1993.
	Added SCALE and OFFSET keywords.	Joel D. Offenberg, Hughes STX,
		12 January 1993.		
	Results printed to screen if the input coordinates are prompted for.
		MRG, HSTX, 16 February 1993.
	SUBSTEP added.  MRG, HSTX, 9 April 1993.
	Change EXTAST call to UIT_EXTAST       W. Landsman  Jan. 1994

(See /host/bluemoon/usr2/idllib/uit/pro/dist_coord_conv.pro)


DIST_ELLIPSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DIST_ELLIPSE
 PURPOSE:
	Form a square array in which the value of each element is equal to the
	semi-major axis of the ellipse of specified center, axial ratio, and 
	position  angle, which passes through that element.  Useful for 
	elliptical aperture photometry.

 CALLING SEQUENCE:
	DIST_ELLIPSE, IM, N, XC, YC, RATIO, POS_ANG

 INPUTS:
	N = size of result, scalar.   Output array will have dimensions N x N
	XC,YC - Scalars giving the position of the ellipse center.   This does
		not necessarily have to be within the image
	RATIO - Scalar giving the ratio of the major to minor axis.   This 
		should be greater than 1 for postion angle to have its 
		standard meaning.

 OPTIONAL INPUTS:
	POS_ANG - Position angle of the major axis, measured counter-clockwise
		from the Y axis.  For an image in standard orientation 
		(North up, East left) this is the astronomical position angle.

 OUTPUT:
	IM - REAL*4 elliptical mask array, of size N x N.  THe value of each 
		pixel is equal to the semi-major axis of the ellipse of center
		 XC,YC, axial ratio RATIO, and position angle POS_ANG, which 
		passes through the pixel.

 EXAMPLE:
	Total the flux in a elliptical aperture with a major axis of 3', an
	axial ratio of 2.3, and a position angle of 25 degrees centered on 
	a specified RA and DEC.   The image array, IM is 200 x 200, and has 
	an associated FITS header H.

	ADXY, H, RA, DEC, X, Y       ;Get X and Y corresponding to RA and Dec
	GETROT, H, ROT, CDELT        ;CDELT gives plate scale degrees/pixel
	CDELT = ABS( CDELT)*3600.    ;CDELT now in arc seconds/pixel
	DIST_ELLIPSE, ELL, 200, X, Y, 2.3, 25  ;Create a elliptical image mask
	ELL = ELL*CDELT(0)           ;Distances now given in arcseconds
	GOOD = WHERE( ELL LT 180 )   ;Within 3 arc minutes
	PRINT,TOTAL( IM(GOOD) )      ;Total pixel values within 3'

 RESTRICTIONS:
	The speed of DIST_ELLIPSE decreases and the the demands on virtual
	increase as the square of the output dimensions.   Users should
	dimension the output array as small as possible, and re-use the
	array rather than re-calling DIST_ELLIPSE

 REVISION HISTORY:
	Written    W. Landsman             April, 1991
	Somewhat faster algorithm          August, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/dist_ellipse.pro)


DIST_MODEL_COEF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DIST_MODEL_COEF
 PURPOSE:
	To return the image distortion model coefficients for a camera.
 CALLING SEQUENCE:
	dist_model_coef, cam, cf_x, cf_y
 INPUTS:
	cam      Indicates which camera to fetch the coefficients for, either
	         'A' or 'B'.  'A' is the default -- if 'B' is not specified,
	         then 'A' is assumed.  Only the first character of this string 
	         is examined.  Further, any preceding white space is first
	         removed; therefore, passing this procedure an UIT filter id
	         is sufficient for camera selection.
 OUTPUTS:
	cf_x     The x-axis coefficients.
	cf_y     The y-axis coefficients.
 KEYWORDS:
	REVERSE  If present and non-zero, the reverse transformation is
	         returned (convert an undistorted coordinate to a 
	         distorted one).
 PROCEDURE:
	A straightforward look-up process.  The coefficients returned are in
	the format:

	z = c0 + c1*x + c2*y + c3*x^2 + c4*x*y + c5*y^2 + c6*x^3 + c7*x^2*y +
	    c8*x*y^2 + c9*y^3

	where z is the transformed coordinate.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 4 January 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/dist_model_coef.pro)


DST_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   DST_INFO
 PURPOSE:  
   To read in the next section of the header in a DAOPHOT image file.
 CALLING SEQUENCE:
   PRO DST_INFO, PT,IPT,LPT, BHDR,IHDR,LHDR,FHDR, NAME,VALUE, DIMS, STYPE,TYPE
 PARAMETERS:  
   From what I can gather the PT variables are positions in the
   HDR variables which hold the header data.  The `B' prefix (BPT, BHDR), 
   indicates the variables are in BYTE type, and `I', `L', `F' indicate 
   INTEGER, LONG, and FLOATING respectively.
           pt  +  9        size of object name (1 - 15)
           pt  + 10 - 24   string of object name
           pt  + 25        type of object
           pt  + 26 - 40   string of type      
           pt  + 61...     value(s) of byte object (+4 for each)
           pt  + 64...     string for char object
           ipt + 31...     value(s) of short or int  object (+2 for each)
           lpt +  1        size of object description (data added at end)
           lpt +  2        pointer back to start of structure (4 byte groups)
                           always less than or equal to 0
           lpt + 12        pointer to start of next object (4 byte groups)
           lpt + 13        number data values in this object
           lpt + 16...     value(s) of long, int, or float  object 
                           or size of string for char object
    The NAME parameter is the name of the header field and VALUE is its value.
  NOTES:  
     See notes for READ_DST procedure.
  PROCEDURE:  
      This procedure dissects the header information passed to it
      in the HDR parameters.  Most of it is done by black magic.
   REVISION HISTORY:  
       03 AUG 87  Written by Michael E. Van Steenberg
       17 OCT 89 toyed with by Joel Parker (cleaned and added comment
                                  & prolog)
       25 MAY 90 Strtrim added to make it work in IDL version 2.  Should be
                 still compatible with IDL version 1.  Robert S. Hill

(See /host/bluemoon/usr2/idllib/uit/pro/dst_info.pro)


DS_STARFIT

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE
 	crude fit for star gaussian psf
 CALLING SEQUENCE
	DS_STARFIT, array, XPOS, YPOS [,xfit, ax, yfit, ay, fwhm]
 RESTRICTIONS:
	This routine is intended to be called by other routines rather than 
	interactively.  To use this routine interactively, use STARFIT.PRO
	by W. Landsman & R. Cornett, HSTX.
 INPUTS
      array is the image being looked at
 OUTPUTS
      xfit is the output fit in the x-direction, y in y-dir
      ax and ay are fit parameters of gaussian in x and y directions
      a(0): height of gaussian      
      a(1): ctr posn of gaussian     
      a(2): sigma of gaussian      
      a(3): constant background term      
      a(4): linear background term      
      a(5): quadratic background term
   PROCEDURE
 fit gaussians in two dimensions to 'collapsed' arrays:
   sum subarray over x, fit gaussian and quadratic bkgd in y
   sum subarray over y, fit gaussian and quadratic bkgd in x

   WBL, RHC summer 1991
   Modified to run in batch mode from DualSearch & name changed to DS_STARFIT.
	Jessica Banks & Joel Offenberg, HSTX, August 1992

(See /host/bluemoon/usr2/idllib/uit/pro/ds_starfit.pro)


DUALSEARCH

[Previous Routine] [Next Routine] [List of Routines]
   DualSearch
PURPOSE:
  Simultaneously display subimages from a far-UV image array and the 
  corresponding near-UV image array to enable a user to visually detect
  and investigate objects that appear brighter in the FUV than in the NUV. 
  The output gathered on the object(S) will be stored in a file unless
  otherwise specified.              
CALLING SEQUENCE:
  DualSearch,NAME1, NAME2       		;Prompt for OUTPUT FILE NAME 
  DualSearch,NAME1, NAME2,OUTFILENAME
INPUTS:
  NAME1  -  Character string giving the name of the FAR-UV SDAS file
                to be read.  Must have astrometry in the header
  NAME2  -  Character string giving the name of the NEAR-UV SDAS file
                to be read.  Must have same astrometry as FAR-UV file.
                If file names are not string data type or if the FUV file
                name is not entered first, an error message will request
                that the calling sequence be adjusted.
OPTIONAL INPUT:
  OUTFILENAME  -  Character string giving the name of the OUTPUT FILE.
		 If omitted, then program will prompt for the
                file name.  (Default = FAR-UV file name + '.DAT')  
		 If the file already exists, all new output will update 
		 the contents of the most recently input record instead 
		 of creating a new record.
OUTPUTS:
  (automatically printed to OUTPUT FILE)
  RA         -  Right ascension of the investigated object (in degrees)
  DEC        -  Declination of the investigated object (in degrees)             
  X          -  X pixel coordinate on the full resolution image of the 
                investigated object
  Y          -  Y pixel coordinate on the full resolution image of the
                investigated object
  FWHM       -  Full width half max of the investigated object calculated by
                DS_STARFIT.
  MAGS1(2)   -  Magnitude for each object within a photometry aperture radius
                of 4 pixels.  This is computed by UIT_APER using the BSCALE
                obtained from the FUV(NUV) image header.
  ERRAP1(2)  -  Error in magnitude of FUV(NUV) object from UIT_APER
  SKY1(2)    -  Sky value for each FUV(NUV) object from UIT_APER
  SKYERR1(2) -  Error in FUV(NUV) sky values
  COLOR      -  Color of object calculated by MAGS1-MAGS2
  CLRERR     -  Error in color calculated by ERRAP1+ERRAP2
OPTIONAL OUTPUTS:
  INDBASE    -  Name of database that contains sources within a radius of
                0.167 arc minutes of the investigated object's RA and DEC
  COMMENTS   -  User's comments on the investigated object
USAGE: 
  Once the subimages have been displayed, compared in a blink window, and 
  a far-UV object has been selected with the mouse, a menu will appear which
  gives the user such options as:  checking databases, blinking the displays 
  (BLINK), loading (LOADCT) and adjusting (CONTRAST) a color table, adjusting
  the intensity curve (ITT), displaying intensities (CURVAL) and pixel values
  (IMLIST), zooming portions of the displays (CZOOM), and making comments.
  Other options include clearing the displays, discarding previous object from
  the output to be printed to a file, picking a new object, progressing to
  the next subimage, and quitting the program. 
SIDE EFFECTS:  
  Windows #0 and #2 are created containing the compressed images and then the 
  subimages.  Other windows are created when displays are blinked or zoomed.  
  A box is drawn around the selected object in the FUV display and its 
  corresponding coordinates in the NUV display.     
OPERATIONAL NOTES:
  The user must be in WIDL in order to use the program.  NAME1 and
  NAME2 must contain images with astrometry in the headers and the same
  orientation.
MODIFICATION HISTORY:
  Written by Jessica Banks, August, 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/dualsearch.pro)


EDT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		
       EDT
 PURPOSE:	
       Call the EDT editor to edit a file.
 CALLING SEQUENCE:
       EDT                ;Prompt for filename
       EDT, File
 INPUTS:
       File = Name of file to edit.
 OUTPUTS:
       None.
 COMMON BLOCKS:
       LASTFILE -- Contains the single variable FILENAME.
 PROCEDURE:
       The CALL_EXTERNAL procedure is used to call EDT$EDIT in
       the sharable image SYS$SHARE:EDTSHR.EXE.  This is MUCH
       faster than using the SPAWN or $EDT.  FINDFILE and OPENR
       are first used to check the file status, because it is possible
       otherwise to screw-up the CALL_EXTERNAL facility.
 MODIFICATION HISTORY:
	DMS, Nov, 1988.

(See /host/bluemoon/usr2/idllib/uit/pro/edt.pro)


EMACS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		
       EMACS
 PURPOSE:	
       Call the EMACS editor to edit a file.
 CALLING SEQUENCE:
       EMACS                ;Prompt for filename
	EMACS, File
 INPUTS:
	File = Name of file to edit, scalar string
 OUTPUTS:
	None.
 COMMON BLOCKS:
	LASTFILE -- Contains the single variable FILENAME.
 PROCEDURE:
	A command is spawned out to the operating system to start the
	editor.
 RESTRICTIONS:
	None.
 MODIFICATION HISTORY:
	Adapted from EVE.  Michael R. Greason, STX, 1 August 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/emacs.pro)


EULER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	EULER
 PURPOSE:
	Transform between galactic, celestial, and ecliptic coordinates.
	Use the procedure ASTRO to use this routine interactively

 CALLING SEQUENCE:
	EULER, AI, BI, AO, BO, [ SELECT ] 

 INPUTS:
	AI - Input Longitude in DEGREES, scalar or vector.  If only two 
		parameters are supplied, then  AI and BI will be modified to 
		contain the output longitude and latitude.
	BI - Input Latitude in DEGREES

 OPTIONAL INPUT:
	SELECT - Integer (1-6) specifying type of coordinate transformation.  

	SELECT     From          To       |   SELECT      From            To
	1     RA-DEC(1950)   GAL.(ii)   |     4       ECLIPTIC       RA-DEC    
	2     GAL.(ii)       RA-DEC     |     5       ECLIPTIC       GAL.(ii)  
	3     RA-DEC         ECLIPTIC   |     6       GAL.(ii)       ECLIPTIC  

	If omitted, program will prompt for the value of SELECT

 OUTPUTS:
	AO - Output Longitude in DEGREES
	BO - Output Latitude in DEGREES

 REVISION HISTORY:
	Written W. Landsman,  February 1987
	Adapted from Fortran by Daryl Yentis NRL

(See /host/bluemoon/usr2/idllib/uit/pro/euler.pro)


EVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		
       EVE
 PURPOSE:	
       Call the EVE editor to edit a file.
 CALLING SEQUENCE:
       EVE                ;Prompt for filename
	EVE, File
 INPUTS:
	File = Name of file to edit, scalar string
 OUTPUTS:
	None.
 COMMON BLOCKS:
	LASTFILE -- Contains the single variable FILENAME.
 PROCEDURE:
	The CALL_EXTERNAL function is used to call TPU$TPU in
	the sharable image SYS$SHARE:TPUSHR.EXE.  This is faster
	than using the SPAWN or $EVE.
 NOTES:
       This program assumes the standard section file EVEANDEDT.  You can 
	override this in one of two ways:
		1.  Define the logical name TPU$SECTION to select the section 
		    file (preferred method).
		2.  Include the modifier /SECTION=section-file-name as part
		    of the file name to be editted.
 RESTRICTIONS:
       VMS IDL only - call the VMS EVE editor.
       Typing CONTROL_C while the EVE editor  is loading the file appears
       to screw up the CALL_EXTERNAL facility and corrupt the IDL session.
       This behaviour has been found in IDL version 2.0.8
 MODIFICATION HISTORY:
	Wayne Landsman       STX       November, 1988
       Bob Hill             STX       September, 1989

(See /host/bluemoon/usr2/idllib/uit/pro/eve.pro)


EXTAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	EXTAST
 PURPOSE:
	Extract astrometry parameters from a FITS image header.
	The astrometry in the header can be in either CD (Coordinate
	description) format, or CROTA and CDELT (AIPS-type) format.
	However, the output astrometry will always be in CD format.

 CALLING SEQUENCE:
	EXTAST, hdr, [ astr, noparams ]   

 INPUT:
	HDR - variable containing the FITS header (string array)

 OUTPUTS:
	ASTR - Anonymous structure containing astrometry info from the FITS 
		header ASTR always contains the following tags (even though 
		some projections do not require all the parameters)
   	 .CD   -  2 x 2 array containing the astrometry parameters CD1_1 CD1_2
		in DEGREES/PIXEL                                   CD2_1 CD2_2
	 .CDELT - 2 element vector giving physical increment at reference pixel
	 .CRPIX - 2 element vector giving X and Y coordinates of reference pixel
		(def = NAXIS/2)
	 .CRVAL - 2 element double precision vector giving R.A. and DEC of 
		reference pixel in DEGREES
	 .CTYPE - 2 element string vector giving projection types, default
		['RA---TAN','DEC--TAN']
	 .LONGPOLE - scalar longitude of north pole (default = 180) 
        .PROJP1 - Scalar parameter needed in some projections
	 .PROJP2 - Scalar parameter needed in some projections

	NOPARAMS -  Scalar indicating the results of EXTAST
		-1 = Failure - Header missing astrometry parameters
		0 = Success - Header contains CD00n00m + CDELT* astrometry
		1 = Success - Header contains CROTA + CDELT (AIPS-type) astrometry
		2 = Success - Header contains CDn_m astrometry

 PROCEDURE
	EXTAST checks for astrometry parameters in the following order:
	(1) the CD matrix CD1_1,CD1_2... plus CRPIX and CRVAL.   
	(2) the CD matrix CD001001,CD001002...plus CRPIX and CRVAL
	(3) CROTA2 (or CROTA1) and CDELT plus CRPIX and CRVAL.
	See the Memo: Representations of Celestial Coordinates in FITS by
		Griesen and Calabretta, available at fits.cv.nrao.edu

 NOTES:
	(1) An anonymous structure is created to avoid structure definition
		conflicts.    This is needed because some projection systems
		require additional dimensions (i.e. spherical cube
		projections require a specification of the cube face).

 PROCEDURES CALLED:
	ZPARCHECK, SXPAR
 REVISION HISTORY
	Written by B. Boothman 4/15/86
	Accept CD001001 keywords               1-3-88
	Accept CD1_1, CD2_1... keywords    W. Landsman    Nov. 92

(See /host/bluemoon/usr2/idllib/uit/pro/extast.pro)


EXT_PHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	EXT_PHOT
 PURPOSE:
	Extracts position and photometric information for a specific entry
	in a UITPHOT FITS table.

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	flg = ext_phot(ind, xi, yi, wdth, slnt, tmp)
 INPUTS:
	ind       - The star's (or entry's) index in the table.
	xi        - The x-axis coordinate of the star in the image (not table).
	yi        - The y-axis coordinate of the star in the image.
	wdth      - The width of the box used to search for matches.  Used
	            when searching the second table when computing colors.
	slnt      - If non-zero, the search of the second table produces no
	            screen output.  Ignored.
 OUTPUTS:
	tmp       - A structure to contain position/magnitude information
	            for the selected star.  It contains:
			XI     - The x coordinate of the star in the image.
			YI     - The y coordinate of the star in the image.
			XT     - The x coordinate of the star in the table.
			YT     - The y coordinate of the star in the table.
			RA     - The right ascension of the star, in degrees.
			DEC    - The declination of the star, in degrees.
			EQNX   - The equinix of the celestial coordinates.
			MAG1   - The first aperture magnitude of the star.
			ERR1   - The first aperture magnitude error.
			MAG2   - The second aperture magnitude of the star.
			ERR2   - The second aperture magnitude error.
			MAG3   - The third aperture magnitude of the star.
			ERR3   - The third aperture magnitude error.
			MAGPSF - The PSF magnitude of the star.
			ERRPSF - The PSF magnitude error.
			SKY    - The sky flux.
			ERRSKY - The sky error.
			IND    - The index in the table of the star.
			FILTER - The table's filter.
			COLOR  - A structure containing the UV color of the
			         star.  This structure contains the color, and
			         two strings indicating the filters used.
	returned  - A success flag.  Set to 1 on success, 0 on error.  Note
	            that not finding a parameter in the table is not considered
	            an error.
 COMMON BLOCKS:
	Table_Bk1  The first FITS table block.  See TAB_INIT for details.
	Table_Bk2  The second FITS table block.  See TAB_INIT for details.
 RESTRICTIONS:
	The FITS table MUST be the result of UITPHOT (or have the
	identical composition).

	The FITS tables must have been read into the common blocks.
 PROCEDURE:
	The magnitude information is extracted from the first FITS table
	and stored in the output structure.  Then the second FITS table
	is searched for the same star.  If found, the magnitude is found
	and the color computed.  The results of the first aperture (MAG AP1)
	are used when computing color.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes-STX, 24 April 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/ext_phot.pro)


FBTAPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FBTAPE
 PURPOSE:
	Read in a fixed-block ASCII text tape file.

 CALLING SEQUENCE:
	fbtape, [ tunit, tfile, lrecl, outname ]

 OPTIONAL INPUT PARAMETERS:
	FBTAPE will prompt for the following parameters if not supplied.

	tunit - scalar, magnetic tape unit number
	tfile - scalar, file number on tape to read.   If the /NOREWIND keyword
		is set then TFILE gives the file number from the current 
		position, otherwise the tape is rewinded, and TFILE-1 files 
		are skipped.
	lrecl - scalar, the logical record length on the tape
	outname - scalar string, giving the output file name

 OUTPUT PARAMETERS:
	none

 OPTIONAL INPUT KEYWORDS:
	NOREWIND - If this keyword is non-zero, the tape will not be rewound 
		before processing.  Normally the tape is first rewound
	SILENT - If non-zero, then FBTAPE will not display a message each time
		it reads a tape block.
	FIXED -  If non-zero, the tape is written to a fixed record length file.
		Normally, the data is written to a variable length ASCII file.

 SIDE EFFECTS:
	May reposition magnetic tape.

 PROCEDURE:
	Reads tape a block at a time and writes out records to disk

 RESTRICTIONS:
	(1)  Unfortunately IDL Version 2 signals both an EOF and an Tape Read 
	error with a negative value of !ERR.   Thus, this procedure may not be
	 very informative in case of a tape read error.  The value of 
	!SYSERR_STRING could be checked if the user suspects problems

	(2)  VMS only!  (uses TAPRD function and optionally writes fixed
		record-length files).

 MODIFICATION HISTORY:
	Written by R. S. Hill, ST Sys. Corp., 28 Oct. 1987
	Revised for IDL Version 2, W. Landsman      November 1990
	Fixed some typos to work non-interactively   W. Landsman  August, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/fbtape.pro)


FDECOMP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FDECOMP
 PURPOSE:
	Routine to decompose file name.   On VMS machines the decomposition is
		disk + directory + name + qualifier + version   
	On non-VMS machines the decomposition is
		       directory + name + qualifier

 CALLING SEQENCE:
	fdecomp, filename, disk, dir, name, qual, version

 INPUT:
	filename - string file name, scalar

 OUTPUTS:
	All the output parameters are scalar strings
	disk - disk name, always '' on a non-VMS machine, scalar string
	dir - directory name, scalar string
	name - file name, scalar string
	qual - qualifier, set equal to the characters beyond the last "."
	version - version number, always '' on a non-VMS machine, scalar string

 NOTE:
	On a Vax the filenames "MOTD" and "MOTD." are distinguished by the fact
	that qual = '' for the former and qual = ' ' for the latter.

 ROUTINES CALLED:
	Function GETTOK
 HISTORY
	version 1  D. Lindler  Oct 1986
	converted to SUN IDL.  M. Greason, STX, 30 July 1990.
	Include VMS DECNET machine name in disk    W. Landsman  HSTX  Feb. 94
  Converted to Mac IDL, I. Freedman HSTX March 1994
          

(See /host/bluemoon/usr2/idllib/uit/pro/fdecomp.pro)


FETCHFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FETCHFILE
 PURPOSE:
	To transfer a file from a VAX computer to a SUN workstation or 
	from a SUN workstation to a VAX computer.
 CALLING SEQUENCE:
	fetchfile [,dest,node,devdir,filen,ext,userid,passwd,/confirm,
			/debug,/binary]
 INPUTS:
	dest    The destination directory for the file.  If the destination is a
		SUN, this string should not be terminated in a '/'.  If copying
		to the current SUN directory, issue a '.'.  If copying from the 
		SUN to the current VAX directory, issue a null character.
	node    The node of the remote machine.
	devdir  The directory from where the original file is coming.
	filen   The name of the original file.
	ext     The extension of the original file.  If it doesn't have
	        one, issue a null character.
	userid  The user name to use on the remote node.
	passwd  The password to use for the remote node account.
 KEYWORDS:
	CONFIRM If confirm=1 is used the user's directory will be checked for
	        the filename with option of renaming or deleting file before
	        a copy attempt is made.
	DEBUG 	If present and non-zero, the FTP file in NOT executed, nor is
		it deleted.
	BINARY  If present and non-zero, the FTP file transfer is binary.
 OUTPUTS:
	None.
 SIDE EFFECTS:
	A temporary file is created and destroyed in the home directory
	of the account doing the transfer.

	When called from a VAX, the actual file transfer generates a great
	deal of text on the screen.
 RESTRICTIONS:
	The account performing the transfer must have write permission in
	the destination directory.

	The copied file always has the same name as its foreign counterpart.
 PROCEDURE:
	Any input parameters not supplied are asked for.  

	A temporary file of FTP commands is created to perform the file 
	transfers.  FTP commands are performed, using the SPAWN procedure.  
	Then, the temporary command file is deleted.
 
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 29 August 1990.
	Userid and password added.  MRG, STX, 3 January 1991.
	Password printing suppressed.  MRG, STX, 8 January 1991.
       Confirm keyword added.  Joan Isensee, STX, 14 January 1991.
	Proxy and Debug keywords added.  Confirm keyword debugged.  MRG, STX, 
		11 April 1991.
	DAP command converted to system variable.  MRG, STX, 20 August 1991.
	DAP command execution moved to separate proc.  MRG, STX, 21 August 1991.
	Binary keyword added.  MRG, STX, 28 August 1991.
	Modified to allow file transfers through VAX, DAP command replaced 
		by FTP commands, Proxy keyword removed, 
		Melissa Marsh, HSTX, 4 January 1994.
	

(See /host/bluemoon/usr2/idllib/uit/pro/fetchfile.pro)


FETCHIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FETCHIMAGE
 PURPOSE:
	To transfer an image from a VAX to a SUN workstation or from a SUN
	workstation to a VAX.  The image is BYTESWAPPED by this procedure to 
	account for differences in system architechures unless the NOSWAP 
	keyword is present and non-zero.
 CALLING SEQUENCE:
	fetchimage [, dest, node, devdir, imgnm, userid, passwd]
 INPUTS:
	 dest   The destination directory for the file.  If the destination is
 		a SUN, this string should not be terminated in a '/'.  If 
		copying from the SUN to the current VAX directory, issue a 
		null character.
	node    The node of the remote machine.
	devdir  The directory specification of the file on the remote
	        machine.
	imgnm   The name of the original file.
	userid  The user name to use on the remote node.
	passwd  The password to use for the remote node account.
 KEYWORDS:
	NOSWAP  If present and non-zero, the image is not byteswapped.
	CONFIRM If confirm=1 is used the user's directory will be checked for
	        the filename with option of renaming or deleting file before
	        a copy attempt is made.  This keyword is not used by this
	        procedure; it is passed to the FETCHFILE procedure.
       DEBUG   If present and non-zero, the FTP file is not executed, nor is
		it deleted.
	TABLE   If present and non-zero, the image is assumed to be a SDAS
	        table "image".  In this case, nothing is byteswapped and three
	        files are fetched instead of two.
 OUTPUTS:
	None.
 SIDE EFFECTS:
	When called from a VAX, the actual file transfer generates a great
	deal of text on the screen.
 RESTRICTIONS:
	The account performing the transfer must have write permission in
	the destination directory.

	The copied image always has the same name as its foreign counterpart.
 PROCEDURE:
	Any input parameters not supplied are asked for.

	The FETCHFILE procedure is used to do the actual file transfer.  The
	image is then read in and byteswapped, if necessary, and written back
	out.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 29 August 1990.
	Userid and password added.  MRG, STX, 3 January 1991.
	Password printing suppressed.  MRG, STX, 8 January 1991.
	Confirm, Proxy, and Debug keywords added.  MRG, STX, 11 April 1991.
	Table keyword added.  MRG, STX, 7 October 1991.
	Modified to allow image transfers through VAX, FETCHFILE rewritten
		removing DAP command file, Proxy keyword removed, 
		Melissa C. Marsh, HSTX, 4 Jan 1994.

(See /host/bluemoon/usr2/idllib/uit/pro/fetchimage.pro)


FFVAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FFVAR
 PURPOSE:
	Returns the variance of an array of 20 micron pixels as a 
	function of the relative intensity of those pixels,
	for UIT, using the final preflight characteristic curve
	and flat fields.  Lab data for this calculation comes from 
	the FUV (B) camera.    It interpolates linearly on flatfielded 
	lab flatfield exposures.   Input and output are in H units.

 CALLING SEQUENCE:
	Result = FFVAR( xarray, HDCURVE = )  
 INPUTS:
	XARRAY - input scalar or vector 20 micron intensity value (0-32767)

 OUTPUT:
	Result - Variance of the input intensity

 OPTIONAL INPUT KEYWORD:
	HDCURVE - scalar string specifying the HD curve to use.   Set
		HDCURVE = 'CALIB2' to obtain the old HD curve appropiate
		to the CALIB2 BDR stream.

 EXAMPLE:
	Plot the relative error for one UIT pixel for intensities between
		10 and 1000
	x = findgen(9990)+10                ;Create intensity array
	plot,x,sqrt(ffvar(x))/x             ;Plot relative intensities

 REVISION HISTORY: 
	Early version             R. Cornett (STX) 2/9/88
	Use QUICK13 curve         W. Landsman (STX)  February 1991

(See /host/bluemoon/usr2/idllib/uit/pro/ffvar.pro)


FIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FIND
 PURPOSE:
	Find positive brightness perturbations (i.e stars) in a 
	2 dimensional image and compute centroids, and shape parameters,
	Adapted from 1986 STSDAS version of DAOPHOT.

 CALLING SEQUENCE:
	find, image, [ x, y, flux, sharp, round, hmin, fwhm, roundlim, sharplim 
		TEXTOUT = , /SILENT ]

 INPUTS:
	image - 2 dimensional image array (integer or real) for which one
		wishes to identify the stars present

 OPTIONAL INPUTS:
	FIND will prompt for these parameters if not supplied

	hmin -  Threshold intensity for a point source - should generally 
		be 3 or 4 sigma above background
	fwhm  - FWHM to be used in the convolve filter
	sharplim - 2 element vector giving low and high cutoff for the
		sharpness statistic (Default: [0.2,1.0] )
	roundlim - 2 element vector giving low and high cutoff for the
		roundness statistic (Default: [-1.0,1.0] )

 OPTIONAL INPUT KEYWORDS:
	SILENT - Normally, FIND will write out each star that meets all
		selection criteria.   If the SILENT keyword is set and 
		non-zero, then this printout is suppressed.
	TEXTOUT - Controls output device (see the procedure TEXTOPEN)
		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)

 OPTIONAL OUTPUTS:
	x - vector containing x position of all stars identified by FIND
	y-  vector containing y position of all stars identified by FIND
	flux - vector containing flux of identified stars as determined
		by a gaussian fit.  Fluxes are NOT converted to magnitudes.
	sharp - vector containing sharpness statistic for identified stars
	round - vector containing roundness statistic for identified stars

 SYSTEM VARIABLES:
	The non-standard system variable TEXTOUT determines the output device
	if the keyword TEXTOUT is not supplied.   See TEXTOPEN for more info.

 REVISION HISTORY:
	Written W. Landsman, STX  February, 1987
	Keyword textout added, J. Isensee, July, 1990
	ROUND now an internal function in V3.1   W. Landsman July 1993

(See /host/bluemoon/usr2/idllib/uit/pro/find.pro)


FINDSCRATCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME 
	FINDSCRATCH
 PURPOSE:
	Automatically identify scratches in images and remove by replacing 
	scratch with interpolation of nearest neighbors.  
 NOTES:
	This routine does not remove all scratches- some will have to be removed
	with the interactive SCRATCH routine.  Depending on MINLEN and 
	SCRATCHLEN values, some non-scratches in the background may be removed.
 RUNNING TIME:
	Running time varies with MINLEN, SCRATCHLEN and the number of "Mini-
	Scratches" found in the image.  This is, however, a long routine. 
 CALLING SEQUENCE:
	FINDSCRATCH, IM, Header [, Xstart, Ystart, Length,MINLEN = Minlen,
		     SCRATCHLEN = Scratchlen, MAXGAP = Maxgap,/NOSave,
		     SaveFile =SaveFileName, /QUICK,/SILENT]
 INPUTS:
	IM - Image to have scratches removed.
	Header - FITS header of IM.  You MUST supply the header.
 KEYWORD INPUTS:
	MinLen - Minimum length of scratch to keep beyond first filter pass.
		Default is 22 pixels.
	ScratchLen - Minimum length of scratch to keep beyond second pass.
		Default is 30 pixels.
	Maxgap - Maximum gap within a scratch allowed.  Default is 3 pixels.
	Width - Width of scratches.  Default is 3 pixels.  
	      MUST BE AN ODD INTEGER
	Interpolate - If present and non-zero, an interpolation over the removed
	      scratch will be made instead of the nearest neighbor averages.  
	      If Greater than 1, interpolation will include N nearest neighbors
	      from each side.  Default is Zero (No interpolation).
	NOSave - If present and non-zero, no save file will be made
	SAVEFILE- If present, the save file will be given that name.
	      Default is the name of the image from the FITS header and is saved
	      in the current default directory.  (e.g. 'NUV0236.SCR')  
	      Unix users, please note the CAPS.
	QUICK - If present and non-zero, search for not-quite-vertical 
	      scratches is skipped.
	SILENT - No messages, etc, are printed out to screen.
 OUTPUTS:
	IM - Image is modified.
	Header - A HISTORY comment is added to HEADER.
       A record of scratches is made in the SaveFile.
; SAVE FILE:
	Save File includes information on values set in the routine call,
	followed by a list of Xstart, Ystart, Length (Xstart, Ystart are the 
	starting points of the scratch in the final image, Length is the number
	of pixels the scratch extended from the starting point.)  
 SIDE EFFECTS:
	None
 COMMON BLOCKS:
	None
 RESTRICTIONS:
	The user must supply a 2-D image and a matching FITS header.
	The user MUST have WRITE access to the default directory (unless NOSAVE
	is present and non-zero)
 PROCEDURE:
	An account is made of all points which are greater than either of its
	immediate neighbors.  This file is then rotated to a UIT-up (PDS-up) 
	orientation (if image has been GEOMed), and searched for sequences of 
	points in the account in which are vertically elongated past the MINLEN
       parameter.  These "Mini-Scratches" are then compared to one another to 
	find sequences of length greater than the SCRATCHLEN keyword parameter 
	(Default = 30 pixels).  All scratches longer than SCRATCHLEN and 
	sufficiently close to vertical (or GEOM angle) are then "Removed" by 
	by replacing the scratch with the average of the nearest neighbors 
	or a linear interpolation (if specified).
 HISTORY:
	Written by W. Landsman, STX		Aug, 1991
	Routines to deal with non-straight scratches added  J. D. Offenberg
	Book-keeping for GEOMed images added 	J. D. Offenberg	Nov, 1991
	Interpolation, SaveFile, Width added 	J. D. Offenberg Nov, 1991
	Default width changed, /SILENT added	J. D. Offenberg	Jan, 1992
	Updated to use ASTROMETRY structures.    J. D. Offenberg Jan, 1993
	Fixed minor bug introduced when GETROT was changed.  JDO, Apr 1994

(See /host/bluemoon/usr2/idllib/uit/pro/findscratch.pro)


FITEXY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	fitexy
 PURPOSE:
	Linear Least-squares approximation in one-dimension (y = a + b*x),
		when both x and y data have errors (e.g. Gaussian noise).

 CALLING EXAMPLE:
	fitexy, x, y, A, B, X_SIG=sigx, Y_SIG=sigy, [sigma_A_B, chi_sq, q ]

 INPUTS:
	x = array of values for independent variable.
	y = array of data values assumed to be linearly dependent on x.

 REQUIRED INPUT KEYWORDS:
	X_SIGMA = scalar or array specifying the standard deviation of x data.
	Y_SIGMA = scalar or array specifying the standard deviation of y data.

 OPTIONAL INPUT KEYWORD:
	TOLERANCE = desired accuracy of minimum & zero location, default=1.e-3.

 OUTPUTS:
	A_intercept = constant parameter result of linear fit,
	B_slope = slope parameter, so that:
			( A_intercept + B_slope * x ) approximates the y data.
 OPTIONAL OUTPUT:
	sigma_A_B = two element array giving standard deviation of 
		 A_intercept and B_slope parameters, respectively.
                The standard deviations are not meaningful if (i) the
                fit is poor (see parameter q), or (ii) b is so large that
                the data are consistent with a vertical (infinite b) line.
                If the data are consistent with *all* values of b, then
                sigma_A_B = [1e33,e33]  
	chi_sq = resulting minimum Chi-Square of Linear fit, scalar
       q - chi-sq probability, scalar (0-1) giving the probability that
              a correct model would give a value equal or larger than the
              observed chi squared.   A small value of q indicates a poor
              fit, perhaps because the errors are underestimated.

 COMMON:
	common fitexy, communicates the data for computation of chi-square.

 CALLS:
	function chisq_fitexy
	pro minf_bracket
	pro minf_parabolic
	function zbrent
       function chi_sqr1   (from Statistics library)
 PROCEDURE:
	From "Numerical Recipes" column by Press and Teukolsky: 
       in "Computer in Physics",  May, 1992 Vol.6 No.3
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC  September 1992.
       Now returns q rather than 1-q   W. Landsman  December 1992

(See /host/bluemoon/usr2/idllib/uit/pro/fitexy.pro)


FITS2X

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   FITS2X
 PURPOSE:
   Read FITS file from tape directly into an IDL image array and FITS
   header array.   One can optionally provide a compression factor to
   compress the image before writing into the IDL arrays.   The procedure
   is useful for quickly checking the FITS images on a tape
 CALLING SEQUENCE: 
   fits2x,unit,outbuf,header,oheader,[nr,nfile,nbox]
 INPUTs:
       unit  - tape unit number, scalar
 	nr    - number of FITS records [2880 bytes] in one block,
	        blocking factor, integer 1 - 10
	        Default: nr = 1
	nfile - file number on tape, integer.  Default: nfile = 1
       nbox  - compression factor: skip every nbox pixels, nbox lines,
	        integer.  Default is no compression, nbox = 1
 OUTPUT:
	outbuf - data array
       header - header array, after compression of data
       oheader - original header array from tape (before compression)
 LIMITATIONS:
   Will not handle files with groups or parameter blocks.
   Will only handle BYTE, I*2 (16 bit), or I*4 (32 bit) data.
   Will only handle one or two-dimensional arrays
 HISTORY:
 version 1  by B. Pfarr, STX, 4/28/87 from FITSREAD
 version 6  added use of FITSTAPE, data types, K. Bhagat, STX, 7/90

(See /host/bluemoon/usr2/idllib/uit/pro/fits2x.pro)


FITSBYTE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSBYTE
 CALLING SEQUENCE:
	fitsbyte, im [, host=conversion_flag]
 PURPOSE:
	To convert an image array from FITS byte ordering to the ordering
	used by the computer.
 INPUT/OUTPUT:
	im  The image array (both input and output).
 OPTIONAL KEYWORDS:
 	HOST  If present and non-zero, the image is converted to "host" 
	      form.  Otherwise, it is converted to "network", or FITS,
	      form.
 COMMON BLOCKS:
	None
 PROCEDURE:
	The byteorder procedure is used to perform the conversion.  The
	form of this conversion depends upon the datatype of the array.
	If it is of I*2 format, a short integer swap is performed.  If it 
	is of I*4 format, a long integer swap is performed.  Otherwise, 
	nothing is done.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 21 August 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/fitsbyte.pro)


FITSDIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      FITSDIR 
 PURPOSE:
      Provide a brief description of the FITS  files on a disk.   The values
      of the FITS keywords NAXISi, OBS-DATE, TELESCOPE, OBJECT, EXPTIME are
      displayed.    All of these are commonly used FITS keywords and all
      except EXPTIME are officially reserved FITS keywords.

 CALLING SEQUENCE:
      FITSDIR , [ directory, TEXTOUT =, NoTelescope = ] 

 OPTIONAL INPUT PARAMETERS:
      DIRECTORY - Scalar string giving file name, disk or directory to be 
          searched.   Wildcard file names are allowed.    Examples of 
          valid VMS or Unix names include '*.fit' or 'tape*'.    An example
          of a valid VMS name is  'UIT$USER2:[JONES]*.FIT' while a valid 
          Unix string is 'iraf/*.fits'.

          If not given, FITSDIR searches *.fits files in the default 
          directory.

 OPTIONAL KEYWORD INPUT PARAMETER
      NOTELESCOPE - If this keyword is set and non-zero then the value of 
           the (usually less important) TELESCOPE keyword is not displayed, 
            and more space is available to display the other keyword values
                                                                    
     TEXTOUT - Controls output device as described in TEXTOUT procedure
	       textout=1      TERMINAL using /more option
	       textout=2      TERMINAL without /more option
	       textout=3      .prt
	       textout=4      laser.tmp
	       textout=5      user must open file
              textout = filename (default extension of .prt)

 OUTPUT PARAMETERS:
     None.

 RESTRICTIONS:
     (1)   Field values may be truncated if their length exceeds the default
           format.

           File name    NAXISi    OBS-DATE    TELESCOPE    OBJECT    EXPTIME
            A18           A11       A10          A10        A20        F7.1
            A20           A12       A10                     A29        F7.1

     (2)   Only reads the primary FITS headers.    FITS files containing
           only extensions (binary or ASCII tables) may have little
           information in their primary header.    

     (3)   Users may wish to modify the program to display other FITS 
           keywords of particular interest to them
 EXAMPLES:  
      IDL> fitsdir          ;Print info on all '*.fit' files in current 
                             directory.     
     IDL> fitsdir ,'*.fits'   ;Lists all '*.fits' files in current directory 
     IDL> fitsdir ,'tape*'   ;Print info on all tape* files in current 
                             ;directory.    Files meeting the wildcard name
                             ;that are not FITS files are ignored

     Write info on all *.fits files in the Unix directory /usr2/smith, to a 
     file 'smith.txt' and don't display the value of the TELESCOPE keyword

     IDL> fitsdir ,'/usr2/smith/*.fits',t='smith.txt', /NoTel 

 PROCEDURE:
     FINDFILE is used to find the specified FITS files.   The header of
     each file is read, and rejected if the file is not FITS.    Each header 
     searched for the parameters NAXISi, TELESCOP, OBJECT, DATE-OBS and 
     EXPTIME.  

 SYSTEM VARIABLES:
     If textout keyword is not used to select an output device, then the 
     non-standard system variable !TEXTOUT  will be the default.

 PROCEDURES USED:
     ZPARCHECK, FDECOMP,  SPEC_DIR, TEXTOPEN, TEXTCLOSE
 MODIFICATION HISTORY:
     Written, W. Landsman,  HSTX    February, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/fitsdir.pro)


FITSLIST

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	FITSLIST
  PURPOSE:
	Procedure will read FITS files from a tape on the specified
	tape unit.  The headers are placed in file NAME, with the
	default extension of .LIS.  Headers are also displayed at the
       terminal.   FOR VMS IDL ONLY!
  CALLING SEQUENCE:
	FITSLIST            
	FITSLIST,UPDATE_SWITCH
  OPTIONAL INPUT:
	UPDATE_SWITCH - If passed and nonzero, then an existing file is opened,
			and output is appended to the end of this file.  Also,
			the FITS tape is not rewound prior to starting the read.
			This is useful if the tape contains spurious EOF marks.
  OUTPUT:
	None.
  SIDE EFFECTS:
	File NAME or NAME.LIS is created, or if UPDATE_SWITCH is nonzero then
	additional information is appended to the file.
       Headers are displayed at terminal as well as written to file.
  RESTRICTIONS:
       Tape must be mounted before calling FITSLIST.
       FITSLIST uses the IDL tape positioning commands which are only 
       available in VMS IDL.
  PROMPTS:
       Program will prompt for 
       (1)   NAME of output listing file
       (2)   tape unit number
  PROCEDURES CALLED:
       FITSTAPE
  HISTORY:
	William Thompson, 15-May-1986, based on FITSREAD.
	William Thompson, 09-Feb-1990, added file numbers.

(See /host/bluemoon/usr2/idllib/uit/pro/fitslist.pro)


FITSNET

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
     FITSNET 
  PURPOSE:
     Submits a job to the NSESCC IBM 3081 to cause an image to be sent over
     the network.
     This version will work on a null-image header + table extension.
  INPUTS:
     POSITIONAL PARAMETERS:
        vol   volume serial number of tape in Building 28 (string scalar)
        fil   file number on the specified tape (integer or long scalar)
        image image name--will be used with .HHH and .HHD qualifiers
              to build file names for your image on the VAX end
              (string scalar)
     KEYWORD PARAMETERS:
        reel  
              Flag.  If reel eq 0 (default), the specified tape vol is assumed
              to be a 3480 cartridge.  If reel ne 0, a 6250 bpi reel tape.
        destination
              No default.  You are prompted if this is missing.
              A four-element vector of strings, as follows:
              [userid, password, directory, node]
              userid    = userid on selected node
              password  = corresponding password 
              directory = VAX directory to receive the image
              node      = VAX node to receive the image
        table 
              Flag.  Default is 0.  If not 0, you are assumed to be 
              transmitting table data. 
        debug
              Flag.  Default is 0.  If 1, there is no communication
              with the IBM and the JCL file is just printed out.
              !DEBUG system keyword also works for this.
        priority
              Flag.  Default is 0.  If 1, the job is submitted CLASS=N
              on the IBM.
        short
              Flag.  Default is 0.  If 1, the tape is assumed to written
              in short-block FITS format (with 2880 byte records).  Otherwise,
              long-block FITS is assumed.
        netname
              Name for NETWORK() keyword of IBM NFT command.  Default is
              DECNET.  Other possible value is DECNET.
        fits
              Flag.  Default is 0.  If 1, a single FITS file is 
              transmitted, rather than .HHH/.HHD files. 
  OUTPUTS:
     none
  COMMON BLOCKS:
     none
  SIDE EFFECTS:
     A file of IBM Job Control Language is generated and submitted to the
     MVS operating system on the IBM 3081.  When the job has run there
     (a process over which the user has no further control), SDAS-
     format image files will have appeared on the user's disk.  The
     IBM jobname is ZMRSHVAX.  It costs our IBM budget 32 CPU sec.
     and 1900 EXCPs, so UIT USERS ONLY, PLEASE!
  RESTRICTIONS:
     No images larger than 2048 x 2048 16-bit pixels.  No groups, no 
     extensions.
  HISTORY:                                
     Written by R. Hill - STX - 1 May 87
     VAX password blanked out.  RSH - STX - 6 May 87
     Format of TSO commands changed to accomodate longer VAX filenames
        - RSH - STX - 28 May 87
     Data transfer log updated.  RSH - STX - 28 May 87
     Name change to FITXNET:
        For tables on tape.  RSH - STX - 22 Sep 87
        JCL corrections.  RSH - STX - 1 Oct 87
     Back to FITSNET:
        For either tables or images.  RSH, STX, 27 Oct. '87.
     Corrected to byte-swap images.  RSH, STX, 14 March 1988.
     Reel tape argument added.  Default changed to 3480 cartridges.
        RSH, STX, 8-May-1990
     Prompt/Parameter option added.   K. Bhagat, STX, 6/16/90
     Converted to use keyword parameters.  RSH - STX - 16 Aug 90
     Some info put into JCL comments.  RSH - STX - 1/7/91
     Short keyword added.  M. R. Greason, STX, 12 February 1991.
     /noconf added to scratch file delete.  R. S. Hill - STX - 21 May 91
     Set up to have byte swap done at IBM, not in transfer.  Lets
        carriage control=none files be written at VAX using
        TRANSLATE(BINARY) option on IBM NFT.  R. S. Hill - STX - 26 Sept 91
     Short keyword implementation changed so that all JCL in one
        directory.  R. S. Hill, Hughes STX, 14-Nov-1991
     IBMNET changed to DECNET to reflect system change.  R. S. Hill,
        Hughes STX, 6-Dec-1991
     NETNAME keyword added.  RSH, H_STX, 9-Dec-1991
     NETNAME default changed.  RSH, H_STX, 16-Mar-1992
     MVS/ESA version.  RSH, H_STX, 31-Mar-1992
     NETNAME default changed.  RSH, H_STX, 14-Apr-1992
     FITS keyword added.  RSH, H_STX, 8-Jan-1992

(See /host/bluemoon/usr2/idllib/uit/pro/fitsnet.pro)


FITSRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSRD
 PURPOSE:
	Interactive procedure to read FITS tape files into
	SDAS/FITS disk files.   FOR VMS IDL ONLY.

 CALLING SEQUNCE: 
	FITSRD                      ;Prompt for all parameters
	FITSRD,[UNIT,LIST,KEYWORD,TAPENAME,FNAMES]

 OPTIONAL INPUTS:
	Interactive users will normally just type FITSRD and be
	prompted for all parameters.   However, parameters can
	be passed directly to FITSRD

	UNIT - tape unit number, scalar
	LIST - vector containing list of file numbers to read
	KEYWORD - scalar string giving a FITS keyword which will be
		extracted from the headers on tape and used for file names.
		Set KEYWORD = '', if such a keyword is not to be used.
	TAPENAME - scalar string giving a name for the tape.  Filenames
		will be constructed by concatenating TAPENAME with the
		file number.  TAPENAME is used only if KEYWORD = ''
	FNAME - vector string giving a file name for each file number 
		given in LIST.  FNAME is used only if both KEYWORD = '' and
		TAPENAME = ''.   Spaces are trimmed from names in FNAME. 

 SIDE NOTES:
	FITSRD will always rewind the tape before processing.  Images 
	are NOT converted using BSCALE and BZERO factors in the header.

 SIDE EFFECTS:
	For each tape file SDAS/FITS disk files will be created with names:
			name.HHH and name.HHD
	FITS extension (e.g. tables) files will have names:
		name_x.HHH and name_x.HHD
	where x runs from 1 to the number of extensions.
 EXAMPLES:
	FITSRD                          ;FITSRD will prompt for parameters

	FITSRD,1,INDGEN(5)+1,'IMAGE'  	;Read first 5 files on unit 1
					;Filenames taken from IMAGE keyword

	FITSRD,1,[2,4],'','',['GALAXY','  STAR']  ;Read files 2 and 4 on unit 1
					;Create filenames GALAXY and STAR   

	FITSRD,1,[2,4]        	;Read files 2 and 4, prompt for filenames

 MODIFICATION HISTORY:
	version 2  by D. Lindler	Nov 1986
	added FITS extension and long block tape capability.

(See /host/bluemoon/usr2/idllib/uit/pro/fitsrd.pro)


FITSREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSREAD
 PURPOSE:
	Procedure to read a FITS file from a tape on the specified
	tape unit.  The header is placed in .HHH and the data
	is placed in the file .HHD.   This procedure is called by
	FITSRD which is the interactive procedure for normal use. FOR VMS 
	IDL ONLY 

 CALLING SEQUENCE: 
	fitsread, unit, name, [ keyword ]
 INPUTS:
	unit - tape unit number
	name - file name (without an extension)

 OPTIONAL INPUT:
	keyword - (optional) if supplied and not equal to the null
		string then the file name will be taken from the
		value of the header keyword specified

 OUTPUT:
	name - name of file if input keyword parameter is supplied

 SIDE EFFECTS:
	files name.hhh and name.hhd are created
 NOTES:
	The procedure FITSRD is normally used to read a FITS tape.  
	FITSREAD is a procedure call internal to FITSRD.

 HISTORY:
	version 2  by D. Lindler  NOV, 1986  added keyword input
		added fits extension input capability
	Converted to IDL Version 2.  M. Greason, STX, June 1990.
	Fixed check for 'END     ' keyword   W. Landsman    August 1991

(See /host/bluemoon/usr2/idllib/uit/pro/fitsread.pro)


FITSTAPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSTAPE
 PURPOSE:
	Function to perform FITS tape I/O.  Called by FITSREAD.   
	FOR VMS IDL ONLY!

 CALLING SEQUENCE:  
	status = fitstape( command, unit, bitpix, data )

 INPUTS:
	command - string command from the following choices
		'init' - initialization (must be first call to fitstape)
		'read' - get next 2880 byte data buffer
		'eof'  - check for end of tape file
		'write'- write 2880 byte data buffer
		'woef' - empty buffer and write end-of-file
	unit -   tape unit number
	bitpix - bits/per data element (used to control byte swapping)
		(required for 'read' and 'write')
		(for 'init' command this parameter gives
		the blocking factor, number of 2880 byte
		records per tape record. if not supplied 1 is
		assumed)
	data - 2880 byte data array if 'write' command

 OUTPUTS:
	data - 2880 byte data array if 'read' command
		status is returned as the function value
		with the following meanings.
		'init' = 1
		'read' = !err returned by taprd
		'write' = 1
		'eof'  = 1 if at end of file
			0 if not at end of file
		'weof' = 1

 COMMON BLOCKS
	QFITSTAPE

 HISTORY
	Version 1  D. Lindler  Nov 1986
	Converted to IDL Version 2.  M. Greason, STX, June 1990.
	Recognize BITPIX = -32 and BITPIX = -64   W. Landsman April 1992

(See /host/bluemoon/usr2/idllib/uit/pro/fitstape.pro)


FITSWRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSWRITE
 PURPOSE:
	Procedure will write an internal SDAS file to a FITS tape on the 
	specified tape unit.    Called by FITSWRT

 CALLING SEQUENCE:
	FITSWRITE, UNIT, FILE, [ KEYWORD ]

 INPUTS:
	file - internal FITS file name without extension (extension
		is assumed to be .HHH and .HHD)
	unit - IDL tape unit number

 OPTIONAL INPUT:
	keyword - keyword to place file name into.  if not supplied
		or equals '' then the file name is not put into the
		header before writing it to tape.

 SIDE EFFECT:
	A FITS file is written to tape.

 PROCEDURE CALLS:
	remchar, sxhread, sxpar, fdecomp, sxaddpar, fitstape

 HISTORY:
	version 3  D. Lindler   Nov. 1986                
	version 4  W. Landsman  Oct. 1988 (Changed st*.pro calls to sx*.pro)
	converted to IDL Version 2.  M. Greason, STX, June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/fitswrite.pro)


FITSWRT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSWRT
 PURPOSE:
	Interactive procedure to write internal SDAS file(s) to a FITS tape

 CALLING SEQUENCE: 
	FITSWRT

 INTERACTIVE INPUT:
	User will be prompted for the following
	(1)  tape unit number 
	(2)  blocking factor (1 - 10) = # of 2880 byte records per block 
	(3)  Name of a FITS keyword to put file names into.  This will simplify
		subsequent reading of the FITS tape, since individual filenames
		will not have to be specified.  If you don't want to put the 
		file names into the FITS header, then just hit  [RETURN].
	(4)  Whether FITS extension files (e.g FITS tables) should be auto-
		matically searched for.  If so, these should be of the form 
		name_extnumber
	(5)  file names - these may either be specified individually, or a
		tapename may be specified, and all files in the
		form tapename will be written to tape.

 SIDE EFFECTS:
	Tape is not rewound before files are written.  Tape should be positioned
	with REWIND or SKIPF before calling FITSWRT.  If you want to append
	new FITS files to a tape, then call TINIT (tape init) to position tape 
	between final double EOF.

 PROCEDURE CALLS:
	fitstape, getfiles, gettok, fitswrite

 HISTORY:
	version 3  D. Lindler  Nov 86
	Modified so all file in form tapename are written to tape

(See /host/bluemoon/usr2/idllib/uit/pro/fitswrt.pro)


FITS_CD_FIX

[Previous Routine] [Next Routine] [List of Routines]
  NAME
	FITS_CD_FIX
  PURPOSE:
	Convert from the representation of the CD matrix in a FITS header
	with an underscore (e.g. CDn_m) to that with all integers (e.g.
	CD00n00m).    According to the proposed World Coordinate System
	standard by Griesen and Calabretta, the CD00n00m form is to be
	preferred and does not include the plate scale, so that CDELT* 
	keywords are also needed.     The CD1_1 form (used in IRAF) includes 
	the plate scale (CDELT) factor. 

	Because of past confusion as to which form to use, it will sometimes
	be necessary to convert from one form to the other.

  CALLING SEQUENCE:
	FITS_CD_FIX, Hdr, [/REVERSE]

  INPUT-OUTPUT: 
	HDR - FITS header, 80 x N string array.   If the header does not
           contain the CDn_m keywords then it is left unmodified.  Other-
           wise the CDn_m keywords are removed and the CD00n00m keywords
           inserted (with the same values).
   
  OPTIONAL KEYWORD INPUT
	REVERSE - If this keyword is set and non-zero, then the process is
		reversed, i.e. CD00n00m keywords are removed from the header
		and CDn_m keywords are inserted.

  REVISION HISTORY:
     Written   W. Landsman             Feb 1990
     Major rewrite                     Feb 1994

(See /host/bluemoon/usr2/idllib/uit/pro/fits_cd_fix.pro)


FITS_CONV

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	FITS_CONV
PURPOSE:
	This program will convert the string data computed "showfits.pro" 
	into usable form.
CALLING SEQUENCE:
	user_conv,ans,type,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,$
		V17,V18,V19,V20,V21,V23,V24,V25,V26,V27,V28,V29,V30
INPUTS:
	ans	-string array containing the data extracted from the
		FITS table.  This data is in string format.
	type	-string array containing the format of the data 
		extracted from the FITS table.
OUTPUTS:
	V1,V2,V3..Vn - properly formatted arrays of values.  These variable names
	should be input in the order that they from the "name" array that is 
	extracted from "showfits.pro".  
REVISION HISTORY:
	Written by Melissa C. Marsh, Hughes STX, July 1992

(See /host/bluemoon/usr2/idllib/uit/pro/fits_conv.pro)


FIXCHAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    FIXCHAR
 PURPOSE:
    Repairs an error made in BDR in formatting character strings in
    headers.  Changes
           XXXXXXXX='YYY'
    to
           XXXXXXXX= 'YYY'.
    (The current version of CALFIX also does this along with its other
    tasks.)
 CALLING SEQUENCE:
    FIXCHAR,FILE
 INPUT PARAMETERS:
    file = image name WITHOUT the .HHH or .HHD
 OUTPUT PARAMETERS:
    none
 COMMON BLOCKS:
    none
 SIDE EFFECTS:
    Creates new version of header file.
 PROCEDURE:
    Straightforward.
 MODIFICATION HISTORY:
    Written by R. S. Hill, ST Sys. Corp., 9 April 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/fixchar.pro)


FIXQ13

[Previous Routine] [Next Routine] [List of Routines]
 NAME
   FIXQ13
 PURPOSE:
   Fix the EQUINOX keyword of images from the BDR Quick 13 data stream.
   The EQUINOX keyword in some of these data products was mistakenly set
   to 1950 -- FIXQ13 will set the EQUINOX keyword to 2000.00
 CALLING SEQUENCE:
   FIXQ13              ;Fix all *Q13* files in the current directory
   FIXQ13,FILENAME     ;Fix the header in the image FILENAME
 OPTIONAL INPUTS
   FILENAME - scalar string giving the filename of an image from the
              BDR Quick 13 data stream.   If not supplied, then FIXQ13
              will fix all the Quick 13 files in the current directory.
 METHOD
   The header is read from disk.   The BDRSTREM keyword is checked to make
   sure that it is stream QUICK13.   If the EQUINOX is not 2000. it is 
   reset to 2000.   The header is then written back to disk.
 REVISION HISTORY
    Written    W. Landsman              Sep. 1991

(See /host/bluemoon/usr2/idllib/uit/pro/fixq13.pro)


FLAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   FLAT
 PURPOSE:
   FLAT transforms the image of a galaxy so that the galaxy appears
   face-on.  Either a nearest-neighbor approximations or a bilinear 
   interpolation may  be used.
CALLING SEQUENCE:
   RESULT = FLAT(IMAGE,ANG,INC)           ;Nearest neighbor approximation
   RESULT = FLAT(IMAGE,ANG,INC,CEN,/INTERP)         ;Bilinear Interpolation
 INPUTS:   
   IMAGE  - Image to be transformed
   ANG  - Angle of major axis, counterclockwise from Y-axis, degrees
         For an image in standard orientation (North up, East left)
         this is the Position Angle
   INC - Angle of inclination of galaxy, degrees
 OPTIONAL INPUTS:
   CEN - Two element vector giving the X and Y position of galaxy center
         If not supplied, then the galaxy center is assumed to coincide with
         the image center
 INPUT KEYWORDS:
   INT - If present, and non-zero, then bilinear interpolation will be
         performed.  Otherwise a nearest neighbor approximation  is used.
 OUTPUTS:
   RESULT - the transformed image, same dimensions and type as IMAGE
 METHOD:
   A set of 4 equal spaced control points are corrected for inclination.
   These control points are used by CONGRID to correct the whole image.
 REVISION HISTORY:
   Written by R. S. Hill, SASC Technologies Inc., 4 December 1985

(See /host/bluemoon/usr2/idllib/uit/pro/flat.pro)


FLATDIV

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	FLATDIV
 PURPOSE:
	Divide a image in one file by another (flatfield) image and write to 
	a third file.   Do in 16 steps to save virtual memory.   The numerator
	image and the denominator image must be the same size, INTEGER*2 
	datatype and the dimensions must be an even multiple of 512 x 512 
	(usually 2048 x 2048).

 CALLING SEQUENCE:
	FLATdiv, image1, image2, scale, image3, /FITS

 INPUTS:
	image1 - filename of the INTEGER*2 SDAS numerator image.
	image2 - filename of the INTEGER*2 SDAS denominator image.  
	scale  -  scale factor, scalar: ratio = num*scale/denom 
		Converted to floating point if supplied as integer
	image3 - name of output file to write quotient image.   The division is
		done using REAL*4 arithmetic which is then converted to
		INTEGER*2.

 KEYWORDS
	FITS - If present and nonzero, IM2 is assumed to be in FITS format 
		(flat fields on the Suns are in this format only) 
 NOTES:
	FLATDIV make the following adjustments to the division:
	(1)   FLATDIV will change any 0 pixels in the denominator image to 1, 
		to avoid divide by zero.
	(2)   Any input values of 32766 in the numerator image will be set to 
		32767 in the quotient image
	(3)   Any input values of 32767 in the denominator image will be set to 
		0 in the quotient image

  MODIFICATION HISTORY
	Added FITS keyword to Wayne Landsman's BIGDIV.PRO.
       	Nicholas Collins, Hughes STX,  25 Feb. 1994
	Force BSCALE to be floating point    W. Landsman   March 1994

(See /host/bluemoon/usr2/idllib/uit/pro/flatdiv.pro)


FLUX2MAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FLUX2MAG
 PURPOSE:
	Convert from flux (ergs/s/cm^2/A) to magnitudes.  Use MAG2FLUX for
	the opposite direction.

 CALLING SEQUENCE:
	mag = flux2mag( flux, [ zero_pt ] )

 INPUTS:
	flux - scalar or vector flux vector

 OPTIONAL INPUT:
	zero_pt - scalar giving the zero point level of the magnitude.
		If not supplied then zero_pt = 21.1 (Code et al 1976)

 OUTPUT:
	mag - magnitude vector  (mag = -2.5*alog10(flux) - zero_pt)

 REVISION HISTORY:
	Written    J. Hill        STX Co.       1988

(See /host/bluemoon/usr2/idllib/uit/pro/flux2mag.pro)


FLUXAVG

[Previous Routine] [Next Routine] [List of Routines]
   NAME:
        FLUXAVG
   PURPOSE:
        Integrates spectral energy distribution over filter.
   CALLING SEQUENCE:
        fluxavg,average,w,f,wfilt,sfilt 
   INPUTS:
      w, f = wavelengths, fluxes for spectrum
             (ergs/cm^2/s/A or equivalent)
      wfilt, sfilt = wavelengths, sensitivities
                     defining filter
   OUTPUTS:
      average = flux per unit wavelength (i.e.,
                a level, not an area)
      weff    = effective wavelength of filter for given spectrum
      bw      = bandwidth
   COMMON BLOCKS:
      none
   SIDE EFFECTS:
      none
   PROCEDURE:
      Integrates according to trapezoidal rule by taking
      mean of two results of rectangular rule.
      Data interpolated onto common fine grid. 
   HISTORY:
      Written by R. Hill, STX, 4 April 1988.
      Interpolation of both arrays onto fine grid.  RSH, STX, 6 April 1988.
      Effective wavelength computation added.  RSH, STX, 6 May 1988.
      Flux_zeroes section added.  RSH, STX, 3 August 1988.
      Flux_zeroes now applies to negative values.  RSH, STX, 31 October 1989.
      Flux_zeroes skipped if all good data.  RSH, STX, 12 Sept 1991.
      Bandwidth added.  RSH, Hughes STX, 15 Oct. 1991
      Help added.  RSH, HSTX, 23-Dec-92

(See /host/bluemoon/usr2/idllib/uit/pro/fluxavg.pro)


FOGCNORM

[Previous Routine] [Next Routine] [List of Routines]
	FOGCNORM
 PURPOSE:
	To compute the fog levels in the corners of an image for a normal
	UIT image.
 CALLING SEQUENCE:
	fogcnorm, patfil, im, fog, fogerr [, /DOC]
 INPUTS:
	patfil  The name of the file containing the patch definitions
	        to use in computing the fogs.
	im      The image to process.
 OUTPUTS:
	fog     A four element real array containing the fog in the four
	        corners.  The fogs are located in the array as follows:
		0 : lower left corner
		1 : lower right corner
		2 : upper left corner
		3 : upper right corner
	        This parameter is purely an input.
	fogerr  The error in the computed fog levels.
 KEYWORDS:
	DOC     If present and non-zero, status information concerning the
	        processing of the image is displayed as the image is processed.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	The image must be two-dimensional.
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 26 September 1991.
       Initialization of patch arrays is now based on input image size, 
          (different sizes for 20 micron (2048x2048) scans and 
              10 micron (4096x4096) scans).
          Nicholas Collins, Hughes STX, 24 Feb. 1994

(See /host/bluemoon/usr2/idllib/uit/pro/fogcnorm.pro)


FOGCOMP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FOGCOMP
 PURPOSE:
	To compute the fog levels in the corners of an image.
 CALLING SEQUENCE:
	fogcomp, patfil, im, hd, fog, fogerr [, /DOC]
 INPUTS:
	patfil  The file containing the patches to use.  Used only if the
	        image is not of the substepped variety.
	im      The image to process.
	hd      The image's header.
 OUTPUTS:
	fog     A four element real array containing the fog in the four
	        corners.  The fogs are located in the array as follows:
		0 : lower left corner
		1 : lower right corner
		2 : upper left corner
		3 : upper right corner
	        This parameter is purely an input.
	fogerr  The error in the computed fog levels.
 KEYWORDS:
	DOC     If present and non-zero, status information concerning the
	        processing of the image is displayed as the image is processed.
 SIDE EFFECTS:
	A file may be opened and closed.
 RESTRICTIONS:
	The image must be two-dimensional.
 PROCEDURE:
	The header is examined to determine which process to perform
	(substepped or not).  In each case, execution is then passed to
	another procedure.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 26 September 1991.
       Call fogcsub.pro only for substepped images with scan
        size (4096x2048). Nicholas Collins, Hughes STX, 24 Feb. 1994
               

(See /host/bluemoon/usr2/idllib/uit/pro/fogcomp.pro)


FOGCSUB

[Previous Routine] [Next Routine] [List of Routines]
	FOGCSUB
 PURPOSE:
	To compute the fog levels in the corners of an image for a 
	substepped UIT image.
 CALLING SEQUENCE:
	fogcsub, im, fog, fogerr [, /DOC]
 INPUTS:
	im      The image to process.
 OUTPUTS:
	fog     A four element real array containing the fog in the four
	        corners.  The fogs are located in the array as follows:
		0 : lower left corner
		1 : lower right corner
		2 : upper left corner
		3 : upper right corner
	        This parameter is purely an input.
	fogerr  The error in the computed fog levels.
 KEYWORDS:
	DOC     If present and non-zero, status information concerning the
	        processing of the image is displayed as the image is processed.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	The image must be two-dimensional.
 PROCEDURE:
	Patches along the two sides of the image are extracted (near the
	corners).  From these patches, a set of limits (low and high) are
	determined by computing a mean and sigma for all the patches (one
	mean for all four); the limits are set to 2.5 sigma from the mean.
	Then the mean for each patch is computed, throwing away any elements
	outside the limits.  These means are the fog levels.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 26 September 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/fogcsub.pro)


FOGINTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FOGINTER
 PURPOSE:
	To adjust an image for fog using a bilinear interpolation of the
	fog in the four corners.
 CALLING SEQUENCE:
	foginter, im, fog [, /DOC, BASEFOG=basefog]
 INPUTS/OUTPUTS:
	im   The image array to process.  This serves both as an input
	     and an output.
	fog  A four element real array containing the fog in the four
	     corners.  The fogs are located in the array as follows:
		0 : lower left corner
		1 : lower right corner
		2 : upper left corner
		3 : upper right corner
	     This parameter is purely an input.
 KEYWORDS:
	DOC      If present and non-zero, status information is printed as
	         the image is processed.
	BASEFOG  If present, this value is what the fog level of the image is
	         adjusted to.  Else, 200 is used.
       VERBOSE  If present and non-zero, the line currently being processed
                is displayed.
 SIDE EFFECTS:
	The image array is changed by this procedure.
 RESTRICTIONS:
	The image must be two-dimensional.
 PROCEDURE:
	Two arrays are computed, representing the fog along each side of
	the image.  They are linear interpolations determined from the
	fogs of the corresponding corners.  Then, for each row, the fogs
	for the sides are determined from these two arrays and another
	array of fogs is linearly interpolated from them.  This last array
	is used to adjust the fog level of the image to the base fog level 
	(adding it to the image row and subtracting the corresponding element 
	from the fog array).
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 26 September 1991.
       BASEFOG added.  MRG, STX, 8 October 1991.
       No longer indicates which line is being processed (better for 
        batch jobs. Nicholas Collins, Hughes STX, 24 Feb 1994

(See /host/bluemoon/usr2/idllib/uit/pro/foginter.pro)


FOGSTAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	FOGSTAT
 PURPOSE:
	Computes the mean and standard deviation from the sum and sum of
	squares of a set of data elements.
 CALLING SEQUENCE:
	fogstat, n, mnsum, sgsum, mean, sig
 INPUTS:
	n      The number of data points used in computing the sums.
	mnsum  The sum of the data.
	sgsum  The sum of squares of the data.
 OUTPUTS:
	mean   The computed mean.
	sig    The computed standard deviation.
 SIDE EFFECTS:
	None.
 PROCEDURE:
	Straightforward.  The standard deviation is computed first, followed
	by the mean.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 2 October 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/fogstat.pro)


FOGSUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FOGSUM
 PURPOSE:
	To compute the sum and sum of squares of an array, using only the
	elements which fall within a set of limits.
 CALLING SEQUENCE:
	fogsum, arr, llim, ulim, mnsum, sgsum, n
 INPUTS:
	arr    The array to compute from.
	llim   The lower element limit.
	ulim   The upper element limit.
 OUTPUTS:
	mnsum  The sum of all the elements in the array which fall within
	       the lower and upper limits.  (A double precision number.)
	sgsum  The sum of the squares of those array elements which fall
	       within the limits. (A double precision number.)
	n      The number of elements used in computing the sums.  (A 
	       long-word number.)
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	The locations where the array falls within the limits is determined.
	The IDL total function is then used to compute the totals, unless no
	elements lie within the limts.  In that case, zeros are returned in
	all the outputs.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 26 September 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/fogsum.pro)


FORPRINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	FORPRINT
 PURPOSE
	Print a set of vectors by looping over each index value.
	If W and F are equal length vectors, then the statement
		IDL> forprint, w, f   
	is equivalent to 
		IDL> for i = 0, N_elements(w)-1 do print,w(i),f(i)    

 CALLING SEQUENCE:
	forprint, v1,[ v2, v3, v4,....v18, FORMAT = , TEXTOUT = ,STARTLINE = ] 

 INPUTS:
	V1,V2,...V18 - Arbitary IDL vectors.  If the vectors are not of
		equal length then the number of rows printed will be equal
		to the length of the smallest vector.   Up to 18 vectors
		can be supplied.

 OPTIONAL KEYWORD INPUTS:

	TEXTOUT - Controls print output device, defaults to !TEXTOUT

		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)

	FORMAT - Scalar format string as in the PRINT procedure.  The use
		of outer parenthesis is optional.   Ex. - format="(F10.3,I7)"
		This program will automatically remove a leading "$" from
		incoming format statments. Ex. - "$(I4)" would become "(I4)".
	STARTLINE - Integer scalar specifying the first line in the arrays
		to print.   Default is STARTLINE = 1, i.e. start at the
		beginning of the arrays.

 OUTPUTS:
	None
 SYSTEM VARIABLES:
	If keyword TEXTOUT is not used, the default is !TEXTOUT.
	Set !TEXTOUT=3 to direct the FORPRINT output to a file FORPRINT.PRT
	If you want to use FORPRINT to write more than once to the same file, 
	or use a different file name then set TEXTOUT=5, and open and close
	then file yourself (see TEXTOPEN).

 EXAMPLE:
	Suppose W,F, and E are the wavelength, flux, and epsilon vectors for
	an IUE spectrum.   Print these values to a file 'output.dat' in a nice 
	format.

	IDL> fmt = '(F10.3,1PE12.2,I7)'
	IDL> forprint, F = fmt, w, f, e, TEXT = 'output.dat'

 PROCEDURES CALLED:
	Function DATATYPE, procedures TEXTOPEN, TEXTCLOSE
 REVISION HISTORY:
	Written    W. Landsman             April, 1989
	Keywords textout and format added, J. Isensee, July, 1990
	Made use of parenthesis in FORMAT optional  W. Landsman  May 1992
	Added STARTLINE keyword W. Landsman    November 1992
	Set up so can handle 18 input vectors. J. Isensee, HSTX Corp. July 1993
	Handle string value of TEXTOUT   W. Landsman, HSTX September 1993

(See /host/bluemoon/usr2/idllib/uit/pro/forprint.pro)


FTADDCOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTADDCOL
 PURPOSE:
	Routine to add a field to a FITS ASCII table

 CALLING SEQUENCE:
 	ftaddcol, h, tab, name, idltype, [ tform, tunit, tscal, tzero, tnull ]

 INPUTS:
	h - FITS table header.  It will be updated as appropriate
	tab - FITS table array.  Number of columns will be increased if
		neccessary.
	name - field name
	idltype - idl data type (as returned by SIZE function) for field,
		For string data (type=7) use minus the string length.

 OPTIONAL INPUTS:
	tform - format specification 'qww.dd' where q = A, I, E, or D
	tunit - string giving physical units for the column.
	tscal - scale factor
	tzero - zero point for field
	tnull - null value for field

	Use '' as the value of tform,tunit,tscal,tzero,tnull if you want
	the default or no specification of them in the table header.

 OUTPUTS:
	h,tab - updated to allow new column of data

 HISTORY:
	version 1  D. Lindler   July, 1987

(See /host/bluemoon/usr2/idllib/uit/pro/ftaddcol.pro)


FTCREATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTCREATE
 PURPOSE:
	Procedure to create a new (blank) FITS ASCII table and header with
	the specified size.

 CALLING SEQUENCE:
	ftcreate, maxcols, maxrows, h, tab

 INPUTS:
	maxcols - number of character columns allocated, integer scalar
	maxrows - maximum number of rows allocated, integer scalar

 OUTPUTS:
	h - FITS header, string array
	tab - empty table, byte array 
 HISTORY:
	version 1  D. Lindler   July. 87

  21-Sep-88:  Because the degenerative dimension is deleted in Sun IDL,
	       this procedure has been modified to create table with at
	       least two rows.  If this isn't done, the other FT routines
	       choke on a table of one row.

  24-Oct-88:  Changed length of header strings from 81 to 80.  This conforms
	       to the latest format for FITS header strings.  The 81 character
	       format was dropped  due to problems it caused when data was
		transferred back to the VAX.

(See /host/bluemoon/usr2/idllib/uit/pro/ftcreate.pro)


FTDELCOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTDELCOL
 PURPOSE:
	Delete a column of data from a FITS table

 CALLING SEQUENCE:
	ftdelcol, h, tab, name

 INPUTS-OUPUTS
	h,tab - FITS table header and data array.  H and TAB will
		be updated with the specified column deleted

 INPUTS:
	name - Either (1) a string giving the name of the column to delete
		or (2) a scalar giving the column number to delete

 EXAMPLE:
	Suppose it has been determined that the F7.2 format used for a field
	FLUX in a FITS table is insufficient.  The old column must first be 
	deleted before a new column can be written with a new format.

	flux = FTGET(h,tab,'FLUX')       ;Save the existing values
	FTDELCOL,h,tab,'FLUX'            ;Delete the existing column            
	FTADDCOL,h,tab,'FLUX',8,'F9.2'   ;Create a new column with larger format
	FTPUT,h,tab,'FLUX',0,flux        ;Put back the original values

 REVISION HISTORY:                                           
	Written   W. Landsman        STX Co.     August, 1988
	Adapted for IDL Version 2, J. Isensee, July, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/ftdelcol.pro)


FTDELROW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTDELROW
 PURPOSE:
	Delete a row of data from a FITS table

 CALLING SEQUENCE:
	ftdelrow, h, tab, rows

 INPUTS-OUPUTS
	h,tab - FITS table header and data array.  H and TAB will
		be updated on output with the specified row(s) deleted.
	rows  -  scalar or vector, specifying the row numbers to delete
		This vector will be sorted and duplicates removed by FTDELROW

 EXAMPLE:
	Compress a table to include only non-negative flux values

	flux = FTGET(h,tab,'FLUX')       ;Obtain original flux vector
	bad = where(flux lt 0)           ;Find negative fluxes
	FTDELROW,h,tab,bad               ;Delete rows with negative fluxes

 PROCEDURE:
	Specified rows are deleted from the data array, TAB.  The NAXIS2
	keyword in the header is updated.

 REVISION HISTORY:                                           
	Written   W. Landsman        STX Co.     August, 1988
	Checked for IDL Version 2, J. Isensee, July, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/ftdelrow.pro)


FTDIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTDIR
 PURPOSE:
	Provide a brief description of the disk FITS ASCII tables on a 
	directory.   The # of columns and rows, and the extension name are
	displayed for each table found.   Use TBDIR to display FITS binary
	tables.

 CALLING SEQUENCE:
	FTDIR, [ directory, TEXTOUT = ]

 INPUT PARAMETERS:
     DIRECTORY - String giving the disk or directory to be searched.
		Wildcard directory values are allowed.
		If not given FTDIR searches the default directory.
	In VMS:   Examples of valid strings include 'LINEAR:',
		'UIT$USER2:', 'S*', or '[...]'.  
	In Unix:  Valid strings must include trailing slash for
		a directory specification. EX: '/tables'

 OUTPUT PARAMETERS:
	The following dev/file is opened for output (see TEXTOPEN for more 
		info).

		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)

 RESTRICTIONS:
	Only files with header extensions *.hhh and with an XTENSION 
	keyword are searched.    

	Fields may be truncated on the output display if they are too long.

 METHOD:
	FINDFILE is used to find all *.HHH files on directory.  Each
	header is searched for the XTENSION keyword and then the values
	of the FITS parameters  NAXIS1, NAXIS2, TFIELDS and EXTNAME are printed

 PROCEDURES USED:
	SXHREAD, TEXTOPEN,TEXTCLOSE
	Also uses non-standard system variables !TEXTUNIT and !TEXTOUT

 MODIFICATION HISTORY:
	Written, W. Landsman, ST Systems Corporation     February 1988
	Rewritten for Unix compatibility, use EXTNAME keyword  
		W. Landsman                      August 1991

(See /host/bluemoon/usr2/idllib/uit/pro/ftdir.pro)


FTGET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTGET 
 PURPOSE:
	function to return value(s) from specified column of a FITS ASCII table

 CALLING SEQUENCE
	values = FTGET( h, tab, field, [ rows, nulls ] )

 INPUTS:
	h - FITS ASCII table header, string array 
	tab - FITS ASCII table array 
	field - field name or number

 OPTIONAL INPUTS:
	rows -  scalar or vector giving row number(s)
		Row numbers start at 0.  If not supplied or set to
		-1 then values for all rows are returned

 OUTPUTS:
	the values for the row are returned as the function value.
	Null values are set to 0 or blanks for strings.

 OPTIONAL OUTPUT:
	nulls - null value flag of same length as the returned data.
		It is set to 1 at null value positions and 0 elsewhere.
		If supplied then the optional input, rows, must also
		be supplied.

 HISTORY:
	coded by D. Lindler  July, 1987
	Always check for null values to prevent conversion errors
	W. Landsman          August 1990

(See /host/bluemoon/usr2/idllib/uit/pro/ftget.pro)


FTHELP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTHELP
 PURPOSE:
	Routine to print a description of a disk ASCII FITS table

 CALLING SEQUENCE:
	FTHELP, H, [ TEXTOUT = ]

 INPUTS:
	H - FITS header for table, string array

 OPTIONAL INPUT KEYWORD
	TEXTOUT - scalar number (1-6) or string (file name) controling 
		output device (see TEXTOPEN).  Default is TEXTOUT=1, output 
		to the user's terminal    

 NOTES:
	FTHELP checks that the keyword XTENSION  equals 'TABLE' in the FITS
		header.

 SYSTEM VARIABLES:
	Uses non-standard system variable !TEXTOUT and !TEXTUNIT

 PROCEDURES USED:
	ZPARCHECK, SXPAR, TEXTOPEN, TEXTCLOSE, REMCHAR

 HISTORY:
	version 1  W. Landsman  Jan. 1988
       Add TEXTOUT option, cleaner format  W. Landsman   September 1991

(See /host/bluemoon/usr2/idllib/uit/pro/fthelp.pro)


FTHMOD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTHMOD
 PURPOSE:
	Procedure to modify header information for a specified field
	in a FITS table.

 CALLING SEQUENCE:
	fthmod, h, field, parameter, value

 INPUT:
	h - FITS header for the table
	field - field name or number
	parameter - string name of the parameter to modify.  Choices
		include:
			TTYPE - field name
			TUNIT - physical units for field (eg. 'ANGSTROMS')
			TNULL - null value (string) for field, (eg. '***')
			TFORM - format specification for the field
			TSCAL - scale factor
			TZERO - zero offset
		User should be aware that the validity of the change is
		not checked.  Unless you really know what you are doing,
		this routine should only be used to change field names,
		units, or another user specified parameter.
	value - new value for the parameter.  Refer to the FITS table
		standards documentation for valid values.

 METHOD:
	The header keyword  is modified
	with the new value.
 HISTORY:
	version 1, D. Lindler  July 1987

(See /host/bluemoon/usr2/idllib/uit/pro/fthmod.pro)


FTINFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTINFO
 PURPOSE:
	Procedure to return information on the specified field 
	in a FITS ASCII table.
 CALLING SEQUENCE:
	ftinfo,h,field,tbcol,width,idltype,tunit,tscal,tzero,tnull,
		tform,ttype

 INPUTS:
	h - FITS ASCII table header
	field - field name or field number (beginning at 1)

 OUTPUTS:
	tbcol - starting column position in bytes
	width - width of the field in bytes
	idltype - idltype of field.
			7 - string, 4- real*4, 3-integer, 5-real*8
	tunit - string unit numbers
	tscal - scale factor
	tzero - zero point for field
	tnull - null value for the field
	tform - format for the field
	ttype - field name

 SIDE EFFECTS:
	!err is set to the field number.  If the specified field is not
	in the table then !err is set to -1.

 HISTORY:
	D. Lindler  July, 1987

(See /host/bluemoon/usr2/idllib/uit/pro/ftinfo.pro)


FTKEEPROW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTKEEPROW
 PURPOSE:
	Subscripts (and reorders) a FITS table.  A companion piece to FTDELROW.

 CALLING SEQUENCE:
	ftkeeprow, h, tab, subs

 INPUT PARAMETERS:
	h    = FITS table header array
	tab  = FITS table data array
	subs = subscript array of FITS table rows.  Works like any other IDL
		subscript array (0 based, of course).

 OUTPUT PARAMETERS:
	h and tab are modified

 MODIFICATION HISTORY:
	Written by R. S. Hill, ST Sys. Corp., 2 May 1991.

(See /host/bluemoon/usr2/idllib/uit/pro/ftkeeprow.pro)


FTPRINT

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
	FTPRINT
  PURPOSE:
	Procedure to print specified columns and rows of a FITS table

 CALLING SEQUENCE:
	ftprint, h, tab, columns, [ rows, TEXTOUT = ]

 INPUTS:
	h - Fits header for table, string array
	tab - table array 
	columns - string giving column names, or vector giving
		column numbers (beginning with 1).  If string 
		supplied then column names should be separated by comma's.
	rows - (optional) vector of row numbers to print.  If
		not supplied or set to scalar, -1, then all rows
		are printed.

 OUTPUTS:
	None

 OPTIONAL INPUT KEYWORDS:
	TEXTOUT controls the output device; see the procedure TEXTOPEN

 SYSTEM VARIABLES:
	Uses nonstandard system variables !TEXTOUT and !TEXTOPEN
	Set !TEXTOUT = 3 to direct output to a disk file.   The system
	variable is overriden by the value of the keyword TEXTOUT

 EXAMPLES:

	ftprint,h,tab,'STAR ID,RA,DEC'    ;print id,ra,dec for all stars
	ftprint,h,tab,[2,3,4],indgen(100) ;print columns 2-4 for 
					  ;first 100 stars
	ftprint,h,tab,text="STARS.DAT"    ;Convert entire FITS table to
                                         ;an ASCII file named STARS.DAT

 PROCEDURES USED:
	TEXTOPEN,TEXTCLOSE,FTSIZE,FTINFO

 RESTRICTIONS: 
	(1) Program does not check whether output length exceeds output
		device capacity (e.g. 80 or 132).
	(2) Column heading may be truncated to fit in space defined by
		the FORMAT specified for the column
	(3) Program does not check for null values

 HISTORY:
	version 1  D. Lindler Feb. 1987

(See /host/bluemoon/usr2/idllib/uit/pro/ftprint.pro)


FTPUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTPUT
 PURPOSE:
	Procedure to add or update a field in an FITS table

 CALLING SEQUENCE:
	ftput, h, tab, field, row, values, [ nulls ]

 INPUTS:
	h - FITS ASCII table header string array
	tab - table array read by FTREAD or created by FTCREATE
	field - string field name or integer field number
	row -  scalar giving starting row to update, or
		vector specifying rows to update
	values - value(s) to add or update.   If row is a vector
		then values must contain the same number of elements.

 OPTIONAL INPUT:
	nulls - null value flag of same length as values.
		It should be set to 1 at null value positions
		and 0 elsewhere.

 OUTPUTS:
	h,tab will be updated as specified.

 PROCEDURES CALLED
	FTADDCOL, FTINFO, FTSIZE
 HISTORY:
	version 1  D. Lindler July, 1987
	Allow E format         W. Landsman          March 1992
	Write in F format if E format will overflow    April 1994

(See /host/bluemoon/usr2/idllib/uit/pro/ftput.pro)


FTREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTREAD
 PURPOSE:
	Procedure to read an internal FITS table file

 CALLING SEQUENCE:
	ftread, name, h, tab, [ unit ]

 INPUTS:
	name - name of table header file (if qualifier not supplied
		then .hhh is assummed)
 OUTPUTS:
	h - FITS ASCII table header, string array
	tab - table array (2-D byte array of ascii characters)

 OPTIONAL INPUTS:
	unit - unit number (1 to 9) to use for I/O (default=1)

 PROCEDURES CALLED:
	ZPARCHECK, SXREAD, SXPAR, SXOPEN

 HISTORY:
	Coded by D. Lindler July 1987

	21-Sep-88:  Because of the deletion of the degenerative dimension in
		    Sun IDL, this program has been modified to allocate a table
		    of greater number of rows than required if only one row is
		    required.

(See /host/bluemoon/usr2/idllib/uit/pro/ftread.pro)


FTSIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTSIZE
 PURPOSE:
	Procedure to return the size of a FITS ASCII table.

 CALLING SEQUENCE:
	ftsize,h,tab,ncols,rows,tfields,ncols_all,nrows_all

 INPUTS:
	h - FITS ASCII table header
	tab - FITS table array

 OUTPUTS:
	ncols - number of characters per row in table
	nrows - number of rows in table
	tfields - number of fields per row
	ncols_all - number of characters/row allocated (size of tab)
	nrows_all - number of rows allocated

 HISTORY
	D. Lindler  July, 1987

(See /host/bluemoon/usr2/idllib/uit/pro/ftsize.pro)


FTSORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTSORT
 PURPOSE:
	Sort a FITS ASCII table according to a specified field

 CALLING SEQUENCE:
	FTSORT,H,TAB,[FIELD]	       ;Sort original table header and array
		or
	FTSORT,H,TAB,HNEW,TABNEW,[FIELD]   ;Create new sorted header

 INPUTS:
	H - FITS header (string array)
	TAB - FITS table (byte array) associated with H.  If less than 4
		parameters are supplied, then H and TAB will be updated to 
		contain the sorted table

 OPTIONAL INPUTS:
	FIELD - Field name used to sort the entire table.  Character fields
		are sorted using the ASCII collating sequence.  If omitted,
		the user will be prompted for the field name.

 OPTIONAL OUTPUTS:
	HNEW,TABNEW - Header and table containing the sorted tables

 RESTRICTIONS:
	FTSORT always sorts in order of increasing magnitude.  To sort
	in decreasing magnitude, type TAB = REVERSE(TAB,2) after running
	FTSORT.

 SIDE EFFECTS:
	A HISTORY record is added to the table header.
 REVISION HISTORY:
	Written W. Landsman                         June, 1988

(See /host/bluemoon/usr2/idllib/uit/pro/ftsort.pro)


FTSRCOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTSRCOR
 PURPOSE:
	Positional source correlation between FITS tables.

 CALLING SEQUENCE:
	ftsrcor,h1,tab1,h2,tab2,dist $
		[ ,h3,tab3 [[ ,h4,tab4 [[[ ,h5,tab5 [ ,h6,tab6 ]]]] [,coords= ]

 INPUT PARAMETERS:
	dist  = critical distance for identifying sources

 OPTIONAL INPUT PARAMETERS:
	coords = string array giving names of columns that contain coordinates
		to be matched.  DEFAULT is coords=['X','Y'].  You could, for
		example, use coords=['RA','DEC'] instead.
	option = 0, 1, or 2.  See 'SRCOR' routine.  In the basic operation,
		(option=0 or missing), the output is a one-to-many mapping from
		h1, tab1 to h2, tab2.  The other option values make this a
		one-to-one mapping.

 OPTIONAL OUTPUT KEYWORDS:
	ind1 = rows of original h1, tab1 that were kept (zero-based)
	ind2 = rows of original h2, tab2, h3, tab3, ... that were kept (zero-
		based)

 MODIFIED PARAMETERS:
	h1    = header array for table 1 (string)
	tab1  = data array for table 1 (2D byte)
	h2    = header array for table 2 (string)
	tab2  = data array for table 2 (2D byte)
	Both these FITS tables are culled and reordered so that only matching
	sources are left, and corresponding table rows match.

 OPTIONAL MODIFIED PARAMETERS:
	h3, tab3 ... h6, tab6 are optional additional FITS tables that are
		carried along with h2, tab2.  They should all have the same
		number of rows as h2, tab2.  They will be culled and reordered
		in whatever way h2, tab2 is.
 OPTIONAL OUTPUT KEYWORD:
	ind1 = indexes saved from first table.  The built table-chaining starts
		from the second table.  This gives you the option of chaining
		to the first table outside the routine.   
 
 PROCEDURE:
	Applies SRCOR program to FITS tables.
 MODIFICATION HISTORY:
	Written by R. S. Hill, ST Sys. Corp., 2 May 1991.
	OPTION keyword added.  RSH, STX, 25 August 1991.
	IND1 keyword added.  RSH, Hughes STX, 21-Nov-1991
	IND2 keyword added.  RSH, Hughes STX, 26-Nov-1991

(See /host/bluemoon/usr2/idllib/uit/pro/ftsrcor.pro)


FTWRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FTWRITE
 PURPOSE:
	Procedure to write an FITS table to disk

 CALLING SEQUENCE:
	ftwrite, name, h, tab, unit

 INPUTS:
	name - file name. If an extension is supplied it must be 3 char.
		ending in H.
	h - FITS ASCII header
	tab - table array

 OPTIONAL INPUT:
	unit - disk unit number (1 to 9). If not supplied 1 is used.

 SIDE EFFECTS:
	Two files are created with the given name and extensions.
	xxH and xxD. If no extension is supplied then .HHH is assumed.

 HISTORY:
	version 1  D. Lindler  July, 1987

(See /host/bluemoon/usr2/idllib/uit/pro/ftwrite.pro)


FXADDPAR

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXADDPAR
 Purpose     : 
	Add or modify a parameter in a FITS header array.
 Explanation : 

 Use         : 
	FXADDPAR, HEADER, NAME, VALUE, COMMENT
 Inputs      : 
	HEADER	= String array containing FITS header.  The maximum string
		  length must be equal to 80.  If not defined, then FXADDPAR
		  will create an empty FITS header array.

	NAME	= Name of parameter.  If NAME is already in the header the
		  value and possibly comment fields are modified. Otherwise a
		  new record is added to the header.  If NAME is equal to
		  either "COMMENT" or "HISTORY" then the value will be added to
		  the record without replacement.  In this case the comment
		  parameter is ignored.

	VALUE	= Value for parameter.  The value expression must be of the
		  correct type, e.g. integer, floating or string.  String
		  values of 'T'	or 'F' are considered logical values.

 Opt. Inputs : 
	COMMENT	= String field.  The '/' is added by this routine.  Added
		  starting in position 31.  If not supplied, or set equal to ''
		  (the null string), then any previous comment field in the
		  header for that keyword is retained (when found).
 Outputs     : 
	HEADER	= Updated header array.
 Opt. Outputs: 
	None.
 Keywords    : 
	BEFORE	= Keyword string name.  The parameter will be placed before the
		  location of this keyword.  For example, if BEFORE='HISTORY'
		  then the parameter will be placed before the first history
		  location.  This applies only when adding a new keyword;
		  keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		  location of this keyword.  This keyword takes precedence over
		  BEFORE.

       FORMAT	= Specifies FORTRAN-like format for parameter, e.g. "F7.3".  A
		  scalar string should be used.  For complex numbers the format
		  should be defined so that it can be applied separately to the
		  real and imaginary parts.
 Calls       : 
	FXPAR, FXPARPOS
 Common      : 
	None.
 Restrictions: 
	Warning -- Parameters and names are not checked against valid FITS
	parameter names, values and types.

	The required FITS keywords SIMPLE (or XTENSION), BITPIX, NAXIS, NAXIS1,
	NAXIS2, etc., must be entered in order.  The actual values of these
	keywords are not checked for legality and consistency, however.

 Side effects: 
	All HISTORY records are inserted in order at the end of the header.

	All COMMENT records are also inserted in order at the end of the
	header, but before the HISTORY records.  The BEFORE and AFTER keywords
	can override this.

	All records with no keyword (blank) are inserted in order at the end of
	the header, but before the COMMENT and HISTORY records.  The BEFORE and
	AFTER keywords can override this.

	All other records are inserted before any of the HISTORY, COMMENT, or
	"blank" records.  The BEFORE and AFTER keywords can override this.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992, from SXADDPAR by D. Lindler and J. Isensee.
	Differences include:

		* LOCATION parameter replaced with keywords BEFORE and AFTER.
		* Support for COMMENT and "blank" FITS keywords.
		* Better support for standard FITS formatting of string and
		  complex values.
		* Built-in knowledge of the proper position of required
		  keywords in FITS (although not necessarily SDAS/Geis) primary
		  headers, and in TABLE and BINTABLE extension headers.

	William Thompson, May 1992, fixed bug when extending length of header,
	and new record is COMMENT, HISTORY, or blank.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/fxaddpar.pro)


FXHREAD

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXHREAD
 Purpose     : 
       Reads a FITS header from an opened disk file.
 Explanation : 
       Reads a FITS header from an opened disk file.
 Use         : 
	FXHREAD, UNIT, HEADER  [, STATUS ]
 Inputs      : 
	UNIT	= Logical unit number.
 Opt. Inputs : 

 Outputs     : 
	HEADER	= String array containing the FITS header.
 Opt. Outputs: 
	STATUS	= Condition code giving the status of the read.  Normally, this
		  is zero, but is set to !ERR if an error occurs, or if the
		  first byte of the header is zero (ASCII null).
 Keywords    : 
	None.
 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	The file must already be positioned at the start of the header.  It
	must be a proper FITS file.
 Side effects: 
	The file ends by being positioned at the end of the FITS header, unless
	an error occurs.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, Feb 1992, from READFITS by J. Woffard and W. Landsman.
	W. Thompson, Aug 1992, added test for SIMPLE keyword.
 Written     : 
	William Thompson, GSFC, February 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/fxhread.pro)


FXPAR

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXPAR()
 Purpose     : 
	Obtain the value of a parameter in a FITS header.
 Explanation : 
	The first 8 chacters of each element of HDR are searched for a match to
	NAME.  If the keyword is one of those allowed to take multiple values
	("HISTORY", "COMMENT", or "        " (blank)), then the value is taken
	as the next 72 characters.  Otherwise, it is assumed that the next
	character is "=", and the value (and optional comment) is then parsed
	from the last 71 characters.  An error occurs if there is no parameter
	with the given name.

	Complex numbers are recognized as two numbers separated by one or more
	space characters.

	If a numeric value has no decimal point (or E or D) it is returned as
	type LONG.  If it contains more than 8 numerals, or contains the
	character 'D', then it is returned as type DOUBLE.  Otherwise it is
	returned as type FLOAT
 Use         : 
	Result = FXPAR( HDR, NAME  [, ABORT ] )

	Result = FXPAR(HEADER,'DATE')		;Finds the value of DATE
	Result = FXPAR(HEADER,'NAXIS*')		;Returns array dimensions as
						;vector
 Inputs      : 
	HDR	= FITS header string array (e.g. as returned by FXREAD).  Each
		  element should have a length of 80 characters
	NAME	= String name of the parameter to return.  If NAME is of the
		  form 'keyword*' then an array is returned containing values
		  of keywordN where N is an integer.  The value of keywordN
		  will be placed in RESULT(N-1).  The data type of RESULT will
		  be the type of the first valid match of keywordN found.
 Opt. Inputs : 
	ABORT	= String specifying that FXPAR should do a RETALL if a
		  parameter is not found.  ABORT should contain a string to be
		  printed if the keyword parameter is not found.  If not
		  supplied, FXPAR will return with a negative !err if a keyword
		  is not found.
 Outputs     : 
	The returned value of the function is the value(s) associated with the
	requested keyword in the header array.

	If the parameter is complex, double precision, floating point, long or
	string, then the result is of that type.  Apostrophes are stripped from
	strings.  If the parameter is logical, 1 is returned for T, and 0 is
	returned for F.

	If NAME was of form 'keyword*' then a vector of values are returned.
 Opt. Outputs: 
	None.
 Keywords    : 
	COUNT	= Optional keyword to return a value equal to the number of
		  parameters found by FXPAR.
	COMMENTS= Array of comments associated with the returned values.
 Calls       : 
	GETTOK, STRNUMBER
 Common      : 
	None.
 Restrictions: 
	None.
 Side effects: 
	Keyword COUNT returns the number of parameters found.

	The system variable !err is set to -1 if parameter not found, 0 for a
	scalar value returned.  If a vector is returned it is set to the number
	of keyword matches found.

	If a keyword occurs more than once in a header, a warning is given,
	and the first occurence is used.  However, if the keyword is "HISTORY",
	"COMMENT", or "        " (blank), then multiple values are returned.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	DMS, May, 1983, Written.
	D. Lindler Jan 90 added ABORT input parameter
	J. Isensee Jul,90 added COUNT keyword
	W. Thompson, Feb. 1992, added support for FITS complex values.
	W. Thompson, Oct. 1992, rewrote to change strategy for extracting
		values to allow for non-standard formats and renamed to FXPAR.
		Added COMMENT keyword.
 Written     : 
	David M. Stern, RSI, May 1983.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/fxpar.pro)


FXPARPOS

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXPARPOS()
 Purpose     : 
	Finds position to insert record into FITS header.
 Explanation : 
	Finds the position to insert a record into a FITS header.  Called from
	FXADDPAR.
 Use         : 
	Result = FXPARPOS(KEYWRD, IEND  [, BEFORE=BEFORE ]  [, AFTER=AFTER ])
 Inputs      : 
	KEYWRD	= Array of eight-character keywords in header.
	IEND	= Position of END keyword.
 Opt. Inputs : 
	None.
 Outputs     : 
	Result of function is position to insert record.
 Opt. Outputs: 
	None.
 Keywords    : 
	BEFORE	= Keyword string name.  The parameter will be placed before the
		  location of this keyword.  For example, if BEFORE='HISTORY'
		  then the parameter will be placed before the first history
		  location.  This applies only when adding a new keyword;
		  keywords already in the header are kept in the same position.

	AFTER	= Same as BEFORE, but the parameter will be placed after the
		  location of this keyword.  This keyword takes precedence over
		  BEFORE.

	If neither BEFORE or AFTER keywords are passed, then IEND is returned.

 Calls       : 
	None.
 Common      : 
	None.
 Restrictions: 
	KEYWRD and IEND must be consistent with the relevant FITS header.
 Side effects: 
	None.
 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	William Thompson, Jan 1992.
 Written     : 
	William Thompson, GSFC, January 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
 Version     : 
	Version 1, 12 April 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/fxparpos.pro)


FXREAD

[Previous Routine] [Next Routine] [List of Routines]
 Project     : SOHO - CDS

 Name        : 
	FXREAD
 Purpose     : 
	Read basic FITS files.
 Explanation : 
	Read the primary array from a disk FITS file.  Optionally allows the
	user to read in only a subarray and/or every Nth pixel.
 Use         : 
	FXREAD, FILENAME, DATA  [, HEADER  [, I1, I2  [, J1, J2 ]]  [, STEP ]]
 Inputs      : 
	FILENAME = String containing the name of the file to be read.
 Opt. Inputs : 
	I1,I2	 = Data range to read in the first dimension.  If passed, then
		   HEADER must also be passed.  If not passed, or set to 0,0
		   then the entire range is read.
	J1,J2	 = Data range to read in the second dimension.  If passed, then
		   HEADER and I1,J2 must also be passed.  If not passed, or set
		   to 0,0 then the entire range is read.
	STEP	 = Step size to use in reading the data.  If passed, then
		   HEADER must also be passed.  Default value is 1.  Ignored if
		   less than 1.
 Outputs     : 
	DATA	 = Data array to be read from the file.
 Opt. Outputs: 
	HEADER	 = String array containing the header for the FITS file.
 Keywords    : 
	NANVALUE = Value signalling data dropout.  All points corresponding to
		   IEEE NaN (not-a-number) are set to this value.  Ignored
		   unless DATA is of type float or double-precision.
	PROMPT	 = If set, then the optional parameters are prompted for at the
		   keyboard.
	AVERAGE	 = If set, then the array size is reduced by averaging pixels
		   together rather than by subselecting pixels.  Ignored unless
		   STEP is nontrivial.  Note:  this is much slower.
	YSTEP	 = If passed, then STEP is the step size in the 1st dimension,
		   and YSTEP is the step size in the 2nd dimension.  Otherwise,
		   STEP applies to both directions.
	NOSCALE	 = If set, then the output data will not be scaled using the
		   optional BSCALE and BZERO keywords in the FITS header.
		   Default is to scale, if and only if BSCALE and BZERO are
		   present and nontrivial.
	NOUPDATE = If set, then the optional BSCALE and BZERO keywords in the
		   optional HEADER array will not be changed.  The default is
		   to reset these keywords to BSCALE=1, BZERO=0.  Ignored if
		   NOSCALE is set.
 Calls       : 
	GET_DATE, IEEE_TO_HOST, FXADDPAR, FXHREAD, FXPAR, WHERENAN
 Common      : 
	None.
 Restrictions: 
	Groups are not supported.

	The optional parameters I1, I2, and STEP only work with one or
	two-dimensional arrays.  J1 and J2 only work with two-dimensional
	arrays.

	Use of the AVERAGE keyword is not compatible with arrays with missing
	pixels.

 Side effects: 
	If the keywords BSCALE and BZERO are present in the FITS header, and
	have non-trivial values, then the returned array DATA is formed by the
	equation

			DATA = BSCALE*original + BZERO

	However, this behavior can overridden by using the /NOSCALE keyword.

	If the data is scaled, then the optional HEADER array is changed so
	that BSCALE=1 and BZERO=0.  This is so that these scaling parameters
	are not applied to the data a second time by another routine.  Also,
	history records are added storing the original values of these
	constants.  Note that only the returned array is modified--the header
	in the FITS file itself is untouched.

	If the /NOUPDATE keyword is set, however, then the BSCALE and BZERO
	keywords are not changed.  It is then the user's responsibility to
	ensure that these parameters are not reapplied to the data.  In
	particular, these keywords should not be present in any header when
	writing another FITS file, unless the user wants their values to be
	applied when the file is read back in.  Otherwise, FITS readers will
	read in the wrong values for the data array.

 Category    : 
	Data Handling, I/O, FITS, Generic.
 Prev. Hist. : 
	W. Thompson, May 1992, based in part on READFITS by W. Landsman, and
			       STSUB by M. Greason and K. Venkatakrishna.
	W. Thompson, Jun 1992, added code to interpret BSCALE and BZERO
			       records, and added NOSCALE and NOUPDATE
			       keywords.
	W. Thompson, Aug 1992, changed to call FXHREAD, and to add history
			       records for BZERO, BSCALE.
 Written     : 
	William Thompson, GSFC, May 1992.
 Modified    : 
	Version 1, William Thompson, GSFC, 12 April 1993.
		Incorporated into CDS library.
	Version 2, William Thompson, GSFC, 17 November 1993.
		Corrected bug with AVERAGE keyword on non-IEEE compatible
		machines.
		Corrected bug with subsampling on VAX machines.
 Version     : 
	Version 2, 17 November 1993.

(See /host/bluemoon/usr2/idllib/uit/pro/fxread.pro)


F_FORMAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	F_FORMAT
 PURPOSE:
	Choose a nice F format for displaying an array of REAL data.
	Called by TVLIST, IMLIST.

 CALLING SEQUENCE:
	fmt = F_FORMAT( minval, maxval, factor, [ length ] )

 INPUTS:
	MINVAL - REAL scalar giving the minimum value of an array of numbers
		for which one desires a nice format.
	MAXVAL - REAL scalar giving maximum value in array of numbers

 OPTIONAL INPUT:
	LENGTH - length of the output F format (default = 5)
		must be an integer scalar > 2

 OUTPUT:
	FMT - an F or I format string, e.g. 'F5.1'
	FACTOR - factor of 10 by which to multiply array of numbers to achieve
		a pretty display using format FMT.

 EXAMPLE:
	Find a nice format to print an array of numbers with a minimum of 5.2e-3
	and a maximum  of 4.2e-2.

		IDL> fmt = F_FORMAT( 5.2e-3, 4.2e-2, factor )
         
	yields fmt = '(F5.2)' and factor = .01, i.e. the array can be displayed
	with a F5.2 format after multiplication by 100.

 REVISION HISTORY:
	Written W. Landsman              December 1988
	Deal with factors < 1.           August 1991
	Deal with factors < 1. *and* a large range    October 1992
	Deal with 

(See /host/bluemoon/usr2/idllib/uit/pro/f_format.pro)


GCIRC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GCIRC
 PURPOSE:
	Computes rigorous great circle arc distances.

 CALLING SEQUENCE:
	GCIRC, U, RA1, DC1, RA2, DC2, DIS

 INPUTS:
	U    -- Describes units of inputs and output:
		0:  everything radians
		1:  RAx in decimal hours, DCx in decimal
			degrees, DIS in arc seconds 
	RA1  -- Right ascension of point 1
	DC1  -- Declination of point 1
	RA2  -- Right ascension of point 2
	DC2  -- Declination of point 2

   OUTPUTS:
	DIS  -- Angular distance on the sky between points 1 and 2
		See U above for units;  double scalar  

   PROCEDURE:
	Ordinary spherical trig formula.

   NOTES:
	Either RA1,DC1 or RA2,DC2 (but not both coordinates) can be vectors.
	In this case DIS is a vector giving the angular distance between
	each of the vector coordinates to the scalar coordinate

   MODIFICATION HISTORY:
	Written in Fortran by R. Hill -- SASC Technologies -- January 3, 1986
	Translated from FORTRAN to IDL, RSH, STX, 2/6/87
	Vector arguments allowed    W. Landsman    April 1989

(See /host/bluemoon/usr2/idllib/uit/pro/gcirc.pro)


GETDEFPAR

[Previous Routine] [Next Routine] [List of Routines]
			getdefpar

 procedure to get default parameters from parameter file

 CALLING SEQUENCE:
	defpar,dfile,names,dpar,descr

 INPUT:
	dfile - default parameter file name without extension
		extension will be .def in derectory zdef:
 OUTPUT:
	names - names of the parameters
	dpar - default values
	descr - descriptions
 METHOD:
	The defualt parameters are read from file ZDEF:dfile.def

 HISTORY:
	version 1  by D. Linder	APR, 1986
	converted to newidl  APRIL 1990  D. Lindler

(See /host/bluemoon/usr2/idllib/uit/pro/getdefpar.pro)


GETFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GETFILE
 DESCRIPTION:
    This function helps the user retrieve a file in IDL.  Better than
    FileView since you can have several disks in your user defined tree
    under FILETREE.DAT in your home (VMS: SYS$LOGIN) directory.  See notes 
    for a detailed description. Best when used with Xwindows (or other 
    devices that support the MENU function,) but it is functional in text 
    mode.
 CALLING SEQUENCE:
    file = GETFILE(SRCHPATH = srchpath,SRCHSPEC = srchspec, TREE = tree)
 OPTIONAL INPUT:
    SRCHPATH  An optional starting search path.  Often handy to keep this
          around and pass it every time so the user always starts where
          he left off in a program.
    SRCHSPEC  An optional search filter to find certain types of files
          (e.g. '*.*', '*.*;', '*.*;*', '*.hhh', '*.%%h', '*.pro', etc.)
    TREE - string array giving a list of directories to be used instead
          of a FILETREE.DAT file.
    Note: All of these keyword parameters may be passed without prior
          definition.  They will be returned with the last directory
          and specification displayed.
 OUTPUT:
  FILE      The name of the returned file.  Set to '+CANCEL' if the
          user canceled the operation.
 NOTES:
    For maximum flexibility, create a file called FILETREE.DAT in your
  login directory.  In it put a list of directories that you use
  frequently and/or your root directory on each disk.  This allows
  trivial hopping between different disks (better than FileView.)  You
  may also include the names of certain files which you will access a lot
  with this function.
HISTORY:
  14-AUG-90 Version 1 written by E. Deutsch
  11-JAN-91 Changed parameters to keywords, added listing of truncated 
   	     files, removed unnecessary options.     K. Bhagat,    STX
  20-AUG-91 Replaced line which was mysteriously removed in 11-JAN-91
    modification which caused GETFILE not to work with FILETREE.DAT. E.Deutsch
  27-Aug-91 Use GETENV("HOME") instead of SYS$LOGIN     W. Landsman

(See /host/bluemoon/usr2/idllib/uit/pro/getfile.pro)


GETFILES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GETFILES
 PURPOSE:
   This procedure allows you to interatively specify a list of
   files by specifying a single file per line or a range of
   files separated by a dash or comma.
 CALLING SEQUENCE:
   getfiles,list
 OUTPUT:
   LIST - integer array containing file numbers
 REVISION HISTORY
   Written D. Lindler November, 1985
   Converted to Version 2 IDL,  August 1990

(See /host/bluemoon/usr2/idllib/uit/pro/getfiles.pro)


GETHD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETHD
 PURPOSE:
	To get the current UIT characteristic curve from an associated
	data file.     As of 5-Dec-1991 the current HD curve is 'CALIB3'.

 CALLING SEQUENCE:
	gethd, hdarray [, HDFILE=, HDENTRY= ]
 INPUTS -- Keywords:
	HDFILE  -- If specified, the H&D curve is extracted from this file.
	           Otherwise, it is gotten from 
	           UIT_DATA:newhd.dat
	HDENTRY -- If specified, the H&D curve is assumed to be this entry
	           in the specified file.  Otherwise, it is assumed to be
	           the first (associated file index 0).

 OUTPUT:
	array   -- The array of integers containing the UIT characteristic
	           (or H&D) curve.

 SIDE EFFECTS:
	Array is created and filled by this procedure.

 PROCEDURE:
	The keywords are processed, setting the filename and file index to the 
	specified values or to the defaults.  The file is then opened, as
	an associated file with each entry containing 4096 integers.  The
	characteristic curve is read from the file, the file is closed, and
	the array is returned.

 MODIFICATION HISTORY:
	Written by Robert Cornett, STX
	Keywords and documentation added.  Michael R. Greason, STX,
		27 March 1991.
	Points to new H&D curve.  MRG, STX, 3 October 1991.
       Points to 'CALIB3' H&D curve.  5-dec-1991.

(See /host/bluemoon/usr2/idllib/uit/pro/gethd.pro)


GETLOG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETLOG
 PURPOSE:
	Returns the correct logical directory for the given operating system.
	E.G. dat: for vms, $DAT/ for unix.

 CALLING SEQUENCE:
	GETLOG,lname

 INPUTS:
	lname	- the base name of the logical (without special characters).

 OUTPUTS:
	Returns appropriate string.

 RESTRICTIONS:
	Assumes that the created directory logical will have meaning to the host
	operating system.
 PROCEDURE:
	The operating system in !version.os is checked. If it equals:

		'vms'		then a ':' is appended.

		else		unix os is assumed and the input string is
				uppercased, a '$' is prepended and a '/' is
				appended.

 MODIFICATION HISTORY:
	Written, JDNeill, May, 1990.
	Modified, JDNeill,Sep, 1990 -- for unix return full path instead of
		just environment variable name.
  Modified, I. Freedman, HSTX April 1994 -- for MacOS return full path
  Bug in CASE statement fixed.	JDO, HSTX, May 2 1994.

(See /host/bluemoon/usr2/idllib/uit/pro/getlog.pro)


GETLUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     GETLUT
 PURPOSE:
     Read a set of color tables from a file 
 CALLING SEQUENCE:
     GETLUT         		;Get color tables, load them into screen.
				;   Ask for filename.
     GETLUT,Red,Green,Blue     ;Put into the variables RED, GREEN, BLUE, and
 				;   into the screen.  Ask for filename.
     GETLUT,Red,Green,Blue,Name;Put into RED, GREEN, BLUE from file NAME. 
				;   Also load into screen.
     GETLUT,Red,Green,Blue,Name,/Noload  ; Same as above but don't load.
 OPTIONAL INPUT PARMETERS:
     Name   - The name of the file containing the color tables.  If not 
              present, ask for it.
     Noload - A keyword which, if present and non-zero, causes the procedure
              to NOT load the just-read color tables into the screen.
 OPTIONAL OUTPUT PARAMETERS:
     Red   - 256 element int array containing the red color table
     Green - 256 element int array containing the green color table
     Blue  - 256 element int array containing the blue color table
 COMMON BLOCKS:
     If loaded into the screen, the just-read color tables are stored in 
     the common block COLORS.
 MODIFICATION HISTORY:
     Written by Michael R. Greason, STX, June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/getlut.pro)


GETOPT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     GETOPT
 PURPOSE:
     Function to convert a string supplied by the user  into a valid
     scalar or vector.  Distinct elements in the string may be
     separated by either a comma or a space.  The output scalar
     or vector can be specified to be  either  integer or floating
     point.   A null string is converted to a zero.   !ERR is set
     to the number of elements supplied.  
 CALLING SEQUENCE:
     option = GETOPT(input)		 ;Floating point output assumed
     option = GETOPT(input,type)        ;Specify output type 
     option = GETOPT(input,type,numopt) ;Truncate output vector to
                                           NUMOPT elements
 INPUTS:
     input   - string that was input by user in response to a prompt
               Arithmetic operations can be included in the string (see
               examples)
 OPTIONAL INPUTS:
     type    - Either an "I" (integer) or an "F" (floating point) specifying 
               the datatype of the output vector 
               Default is floating point
     numopt  - number of values expected by calling procedure
               If less than NUMOPT values are supplied the output
               vector will be padded with zeros.  
 OUTPUTS:
     option  - scalar or vector containing the numeric conversion of
               the fields in the string INPUT.  If NUMOPT is not
               supplied, the number of elements in OPTION will 
               equal the number of distinct fields in INPUT.
 NOTES:
   (1) If an input  is invalid, !ERR is set to -1 and the result is set to 999.
   (2) GETOPT uses the execute function to interpret the user string.   
       Therefore GETOPT itself cannot be called with the EXECUTE function.
   (3) GETOPT has a hard limit of 10 tokens in the input string. 
 EXAMPLES:
    (1)   a = getopt( '3.4,5*4 ', 'I' )    yields   a = [ 3, 20]
    (2)   a = getopt( '5/2.', 'F', 5)      yields   a = [2.5,0.,0.,0.,0.]
    (3)   a = getopt( '2*3,5,6')           yields   a = [6.,5.,6.]
 REVISON HISTORY:
     written by B. Pfarr, STX, 5/6/87
     change value of !ERR W. Landsman   STX,  6/30/88

(See /host/bluemoon/usr2/idllib/uit/pro/getopt.pro)


GETPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	getpar

 PURPOSE:
 HRS parameter processing routine.

 CALLING SEQUENCE
	getpar,parms,dfile,par
 INPUT:
	parms - user parameter
		= 0 		use all defaults
		= 1 		interative
		= array		user supplied values
		= 'name=val,...'  user supplied non-defaults
		= '$filename'	non-default parameter file
	dfile - file name containing defaults
			must be in directory specified by ZDEF:

 OUTPUT:
	par - parameter array (string)

 METHOD:
 HISTORY:
	version 1	D. Lindler	Oct. 1986
	Converted to new idl  Apr 90  D. Lindler

(See /host/bluemoon/usr2/idllib/uit/pro/getpar.pro)


GETPRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETPRO
 PURPOSE:
	Extract a procedure from an IDL Library or directory given in the 
	!PATH  system variable and place it in the current default directory
	(presumably to be edited by the user).  GETPRO can also be used to 
	obtain a copy of the default startup file.

 CALLING SEQUENCE:
    GETPRO, [ proc_name ]          ;Find PROC_NAME in !PATH and copy

 OPTIONAL INPUT:
	proc_name - Character string giving the name of the IDL procedure or 
		function.  Do not give an extension.   If omitted, 
		the program will prompt for PROC_NAME.   Set 
		PROC_NAME = 'STARTUP' to obtain the default startup file.

 OUTPUTS:
	None.

 SIDE EFFECTS:
	A file with the extension .PRO and a name given by PROC_NAME will
	be created on the user's directory.

 PROCEDURE:
	The system variable !PATH is parsed into individual libraries or 
	directories.   Each library or directory is then searched for the
	procedure name.   When found, a SPAWN is used to extract or copy
	the procedure into the user's directory.    If not found in !PATH,
	then the ROUTINES.HELP file is checked to see if it is an intrinsic
	IDL procedure.  This procedure is not used with the Macintosh.

 EXAMPLE:
	Put a copy of the USER library procedure CURVEFIT on the current
	directory

	IDL> getpro, 'CURVEFIT'

 RESTRICTIONS:
	User will be unable to obain source code for a native IDL function
	or procedure, or for a FORTRAN or C routine added with CALL_EXTERNAL.
	User must have write privilege to the current directory

 REVISION HISTORY:
	Written W. Landsman, STX Corp.   June 1990
	Converted to SUN IDL.  M. Greason, STX, August 1990.
	Revised to work on both UNIX and VMS, N. Collins,STX,Nov.1990
	Display the directory where the procedure was found W. Landsman Dec 1990
  Modified for MacOS  I. Freedman April 1994

(See /host/bluemoon/usr2/idllib/uit/pro/getpro.pro)


GETPSF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETPSF
 PURPOSE:
	To generate a point-spread function (PSF) from one or the sum of 
	several stars.  The PSF is represented as a 2-dimensional gaussian
	(integrated over each pixel) and a lookup table of residuals.
	The lookup table and gaussian parameters are output as an STSDAS
	(modified FITS) image file.   The PSF file created by GETPSF can
	be read with the procedure RDPSF.      Adapted from 1986 STSDAS 
	version of DAOPHOT

 CALLING SEQUENCE:
	getpsf, image, xc, yc, apmag, sky, $
		[ronois, phpadu, gauss, psf, idpsf, psfrad, fitrad, psfname]

 INPUTS:
	IMAGE  - input image array
	XC     - input vector of x coordinates (from FIND), these should be
		IDL (first pixel is (0,0)) convention.
	YC     - input vector of y coordinates (from FIND)
	APMAG  - vector of magnitudes (from APER), used for initial estimate
		of gaussian intensity.  If APMAG is multidimensional, (more
		than 1 aperture was used in APER) then the first aperture
		is used.
	SKY    - vector of sky values (from APER)                

 OPTIONAL INPUTS:
	The user will be prompted for the following parameters if not supplied.

	RONOIS - readout noise per pixel, (in electrons, or equivalent photons)
	PHPADU - photons per analog digital unit, used to scale the data
		numbers in IMAGE into photon units
	IDPSF  - vector of star id numbers from the list created by 
		APER which will be used to define the PSF.   Stars whose
		centroid does not fall within PSFRAD of the edge of the frame,
		or for which a gaussian fit requires more than 25 iterations,
		will be ignored when creating the final PSF.
	PSFRAD - the scalar radius, in pixels, of the circular area within
		which the PSF will be defined.   This should be slightly larger
		than the radius of the brightest star that one will be
		interested in.
	FITRAD - the scalar radius, in pixels of the circular area used in the
		least-square star fits.  Stetson suggest that FITRAD should
		approximately equal to the FWHM, slightly less for crowded
		fields.  (FITRAD must be smaller than PSFRAD.)
	PSFNAME- Name of the STSDAS-disk file (modified FITS) that will contain 
		the table of residuals, and the best-fit gaussian parameters.
		This file is subsequently required for use by NSTAR.  

 OPTIONAL OUTPUTS:
	GAUSS  - 5 element vector giving parameters of gaussian fit to the 
		first PSF star
		GAUSS(0) - height of the gaussian (above sky)
		GAUSS(1) - the offset (in pixels) of the best fitting gaussian
			and the original X centroid
		GAUSS(2) - similiar offset from the Y centroid 
		GAUSS(3) - Gaussian sigma in X
		GAUSS(4) - Gaussian sigma in Y
	PSF    - 2-d array of PSF residuals after a gaussian fit.

 PROCEDURE:
	GETPSF fits a Gaussian profile to the core of the first PSF star 
	and generates a look-up table of the residuals of the
	actual image data from the Gaussian fit.  If desired, it will then
	fit this PSF to another star (using PKFIT) to determine its precise 
	centroid, scale the same Gaussian to the new star's core, and add the
	differences between the actual data and the scaled Gaussian to the
	table of residuals.   (In other words, the gaussian fit is performed
	only on the first star.)

 SYSTEM VARIABLES:
	Set !DEBUG = 1 to view each iteration of the least squares fit

 Subroutines called:
	RINTER, PKFIT, MAKE_2D, DAOERF, STRNUMBER, STRN

 REVISON HISTORY:
	Adapted from the 1986 version of DAOPHOT in STSDAS
	IDL Version 2  W Landsman           November 1988

(See /host/bluemoon/usr2/idllib/uit/pro/getpsf.pro)


GETROT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETROT
 PURPOSE:
	Derive the counterclockwise rotation angle, and the X and Y scale
	factors of an image, from a FITS image header.     First parameter 
	may be either an image header or a CD matrix (in radians).

 CALLING SEQUENCE:
	GETROT, Hdr, [ Rot, CDelt ]   
		or 
	GETROT, Astr, Rot, CDelt       

 INPUT PARAMETERS:
	HDR - FITS Image header (string array).  Program will extract the 
		astrometry structure
		or
	ASTR -  ASTROMETRY structure, of the type returned by BUILDAST or 
		EXTAST.   See BUILDAST.PRO or EXTAST.PRO for details.

 OUTPUT PARAMETERS:
	ROT - Scalar giving the counterclockwise rotation of NORTH in DEGREES 
		from the +Y axis of the image.
	CDELT- 2 element vector giving the scale factors in DEGREES/PIXEL in 
		the X and Y directions.  Values correspond to the FITS 
		parameters CDELT1 and CDELT2 

 SYSTEM VARIABLES:
	If the non-standard system variable !DEBUG is set, then procedure 
	will print the rotation for both the X and Y axis when these values 
	are unequal.  If !DEBUG is set to 2, then the output parameter ROT 
	will contain both X and Y rotations.

 PROCEDURE:
 	If the FITS header already contains CDELT (and CD or CROTA) keyword,
	(as suggested by the proposed Greisen & Calabretta FITS standard) 
	then this is used for the scale factor.
	
       If the header contains CD keywords but no CDELT keywords, then 
	
 REVISION HISTORY:
	Written W. Landsman STX January 1987 
	Convert to IDL V2. M. Greason, STX, May 1990
	Option to return both rotations added.  J. D. Offenberg, STX, Aug 1991
	Accept ASTROMETRY structures as well as CD, HDR.  JDO, HSTX, Jan 1993
	Use new astrometry structure   W. Landsman  Mar 1994

(See /host/bluemoon/usr2/idllib/uit/pro/getrot.pro)


GETTOK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETTOK                                    
 PURPOSE:
	Function to retrieve the first part of the string
	until the character char is encountered.

 CALLING SEQUENCE:
	token = gettok( st, char )

 INPUT:
	char - character separating tokens, scalar string

 INPUT-OUTPUT:
	st - (scalar) string to get token from (on output token is removed)

 OUTPUT:
	token - scalar string value is returned 

 EXAMPLE:
	If ST is 'abc=999' then gettok(ST,'=') would return
	'abc' and ST would be left as '999' 

 HISTORY
	version 1  by D. Lindler APR,86
	Remove leading blanks    W. Landsman (from JKF)    Aug. 1991

(See /host/bluemoon/usr2/idllib/uit/pro/gettok.pro)


GETWAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	GETWAVE

 PURPOSE:
	Create a wavelength vector from a FITS header of a spectrum
	The FITS header must contain a CRVAL1 keyword and a CRPIX1 or
	CD1_1 keyword.

 CALLING SEQUENCE:
	GETWAVE, hdr, wave

 INPUTS:
	hdr - FITS header for a 1-d spectrum, string array

 OUTPUTS:
	wave - Wavelength vector.     The number of elements in WAVE is
		given by the value of NAXIS1 in the FITS header.   The
		element is given by CRVAL1 and the wavelength interval is
		taken from CRPIX1 or CD1_1

 PROCEDURES CALLED:
	Procedure: ZPARCHECK
	Function: SXPAR
 REVISION HISTORY:
	Written, W. Landsman   (HSTX)            October, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/getwave.pro)


GETWRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       GETWRD
 PURPOSE:
       Return the n'th word from a text string.
 CATEGORY:
 CALLING SEQUENCE:
       wrd = getwrd(txt, n, [m])
 INPUTS:
       txt = text string to extract from.         in
       n = word number to get (first = 0 = def).  in
       m = optional last word number to get.      in
 KEYWORD PARAMETERS:
       Keywords:
         LOCATION = l.  Return word n string location.
         DELIMITER = d. Set word delimiter (def = space).
         /LAST means n is offset from last word.  So n=0 gives
           last word, n=-1 gives next to last, ...
           If n=-2 and m=0 then last 3 words are returned.
         /NOTRIM suppresses whitespace trimming on ends.
 OUTPUTS:
       wrd = returned word or words.              out
 COMMON BLOCKS:
       getwrd_com
 NOTES:
       Note: If a NULL string is given (txt="") then the last string
             given is used.  This saves finding the words again.
             If m > n wrd will be a string of words from word n to
             word m.  If no m is given wrd will be a single word.
             n<0 returns text starting at word abs(n) to string end
             If n is out of range then a null string is returned.
             See also nwrds.
 MODIFICATION HISTORY:
       Ray Sterner,  6 Jan, 1985.
       R. Sterner, Fall 1989 --- converted to SUN.
       R. Sterner, Jan 1990 --- added delimiter.
       R. Sterner, 18 Mar, 1990 --- added /LAST.
       R. Sterner, 31 Jan, 1991 --- added /NOTRIM.
	R. Sterner, 20 May, 1991 --- Added common and NULL string.
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1985, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /host/bluemoon/usr2/idllib/uit/pro/getwrd.pro)


GET_COORDS

[Previous Routine] [Next Routine] [List of Routines]
*******************************************************************************
 NAME:
   GET_COORDS

 PURPOSE:
   A general purpose routine that takes user input for angular coordinates and
 returns floating-point values.  The user may input as floating point or
 sexigesimal.  If user inputs RA then it is the calling procedure's job to
 convert hours to degrees if needed.
   Since the input string is parsed character-by-character, ANY character that
 is not a digit, minus sign or decimal point may be used as a delimiter.
 i.e. acceptable examples of user input are:
      1:03:55 -10:15:31
      1 3 55.0 -10 15 31
      1*3 55              -10abcd15efghij31
      1.065278  hello   -10.25861

 CALLING SEQUENCE:
   GET_COORDS, Coords, [ PromptString, NumVals ]

 OPTIONAL INPUT:
   PromptString - A string to inform the user what data are to be entered

 OUTPUT:
   Coords - a 2 element floating array containing the coordinates.  The vector
            [-999,-999] is returned if there has been an error.
 OPTIONAL OUTPUT:
   NumVals - the number of separate values entered by the user:  2 if the user
             entered the coordinates as floating point numbers, 6 if the user
             entered the coordinates as sexigesimal numbers.  Some calling
             procedures might find this information useful so output may be in
             the same format as the user's input.

 REVISION HISTORY
    Written by Joel Parker, 5 MAR 90

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

(See /host/bluemoon/usr2/idllib/uit/pro/get_coords.pro)


GET_DATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GET_DATE
 PURPOSE:
   Return the current date in DD/MM/YY format.  This is the format required
   by the DATE and DATE-OBS keywords
 CALLING SEQUENCE:
   GET_DATE, dte
 INPUTS:
   None
 OUTPUTS:
   dte = An eight character scalar string specifying the current day (0-31),
         current month (1-12), and last two digits of the current year
 EXAMPLE:
   Add the current date to the DATE keyword in a FITS header,h
     
      GET_DATE,dte
      sxaddpar,h,'DATE',dte
 REVISION HISTORY:
   Written      W. Landsman          March 1991

(See /host/bluemoon/usr2/idllib/uit/pro/get_date.pro)


GET_EQUINOX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GET_EQUINOX
 PURPOSE:
	Return the equinox value from a FITS header.  Checks for 3 possibilities
	(1)  If the EQUINOX keyword is found and has a numeric value, then this
		value is returned
	(2)  If the EQUINOX keyword has the values 'J2000' or 'B1950', then
		either 2000. or 1950. is returned.
	(3)  If the EQUINOX keyword is not found, then GET_EQUINOX will return
		the EPOCH keyword value.   This usage of EPOCH is disparaged.

 CALLING SEQUENCE:
	Year = GET_EQUINOX( Hdr, [ Code ] )   

 INPUTS:
	Hdr - FITS Header, string array, will be searched for the EQUINOX
		(or EPOCH) keyword.

 OUTPUT:
	Year - Year of equinox in FITS header, numeric scalar
 OPTIONAL OUTPUT:
	Code - Result of header search, scalar
		-1 - EQUINOX or EPOCH keyword not found in header
		0 - EQUINOX found as a numeric value
		1 - EPOCH keyword used for equinox (not recommended)
		2 - EQUINOX found as  'B1950'
		3 - EQUINOX found as  'J2000'

 REVISION HISTORY:                                               
	Written  W. Landsman        STX              March, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/get_equinox.pro)


GET_KUR_WAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GET_KUR_WAVE
 PURPOSE:
   Quickly return the wavelength grid used in the 1992 Kurucz models
 CALLING SEQUENCE:

   GET_KUR_WAVE, W, [ WMIN, WMAX ]

 OPTIONAL INPUTS:
   WMIN, WMAX -  Scalars specifying the minimum and maximum wavelength 
         values (in Angstroms) to return.   If not supplied, then the entire 1221 element
         wavelength grid between 90.9 A and 1600000 A is returned.       
 OUTPUTS:
   W -  Floating point vector wavelength grid, in Angstroms
 EXAMPLE:
   Return the 190 Kurucz wavelength values between 1200 and 3200 A

        IDL> get_kur_wave, w, 1200, 3200
 REVISION HISTORY:
   Written        W. Landsman           September, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/get_kur_wave.pro)


GET_ORBIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GET_ORBIT
 PURPOSE:
	To get the launch, orbit, and acquisition information from the user.
 CALLING SEQUENCE:
	get_orbit, filflg, flglnch_inf, orbit_inf, angl_inf
 OUTPUTS:
	filflg   - A 0 is returned if the Cancel button was pressed; otherwise,
	           the Done button was pressed.
	lnch_inf - A structure containing the launch information:
		    {LNCHINF_ST, day:0.d, mon:0.d, year:0.d, time:0.d, 
		    daysav:0, site_lat:28.5d, site_lon:80.6d}
		day      - The day of the launch.
		mon      - The month of the launch.
		year     - The year of the launch.
		time     - The time of day of the launch, in decimal hours.
		daysav   - The daylight savings time flag.  Set to 1 if the
		           time is daylight savings time; set to 0 if standard
		           time.
		site_lat - The north latitude of the launch site, in degrees.
		site_lon - The west longitude of the launch site, in degrees.
	orbt_inf - A structure containing the orbit information:
		    {ORBITINF_ST, met_ins:0.d, met_an2:0.d, alt:0.d, incl:0.d, 
		     eccen:0.d, del_u:155.d}
		met_ins  - The mission elapsed time (time after launch) of
		           insertion into orbit.
		met_an2  - The mission elapsed time of the second ascending
		           node passage.
		alt      - The altitude (measured from ground level) of the
		           orbit, in meters.
	  	incl     - The inclination of the orbit, in degrees.
		eccen    - The eccentricity of the orbit.
		del_u    - This is a parameter which aids in determining the
	                   longitude of the insertion into orbit.  It depends 
		           upon orbital altitude, inclination, and launch
		           profile.  Note that errors of 10 degrees in this
		           parameter result in an error in the RA of 0.6
		           degrees; therefore, an approximation of this
		           parameter is "good enough."  This parameter should
		           be provided in degrees.
	angl_inf - A structure containing the acquisition and observation
	           angles that define target-rise and target-set.  These
	           angles are in degrees.  Structure format:
		    {ANGLEINF_ST, acq_day:0.d, acq_nite:0.d, obs_day:0.d,
		    obs_nite:0.d}
		acq_day   - The target acquisition angle during orbital day.
		acq_nite  - The target acquisition angle during orbital night.
		obs_day   - The target observation angle during orbital day.
		obs_nite  - The target observation angle during orbital night.
 COMMON BLOCKS:
	get_orb_widg - Contains the widget identifiers of the text widgets
	               in the data form.  Used in extracting the info 
	               when done with the form.
	get_orb_val  - Contains the output structures.  They are filled
	               if the DONE button is selected.
	look_comm    - Contains information that needs to be shared throughout
	               the program:
				fnt - The font to use in displayed text.
 RESTRICTIONS:
	Widget support is mandatory.
 PROCEDURE:
	A widget data-form is created and executed.  This form creates
	and destroys a top-level base widget.

	There are two functions in this file:  get_orb and get_orb_event.
	The first function defines the form, while the second function is 
	the event handler and deals with the actual filling of the form.
 MODIFCATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 23 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/get_orbit.pro)


GET_STRING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GET_STRING
 PURPOSE:
	To get a string from the user.
 CALLING SEQUENCE:
	get_string, strng [, prompt]
 INPUTS:
	prompt - A string to prompt the user with.  If not specified, 
	         "Enter string: " is used.
 OUTPUTS:
	strng  - The string read in from the widget.
 COMMON BLOCKS:
	get_str_widg - Allows communication of the string to/from the
	               event handler.
	look_comm    - Contains information that needs to be shared throughout
	               the program:
				fnt - The font to use in displayed text.
 RESTRICTIONS:
	Widget support is mandatory.
 PROCEDURE:
	A widget data-form is created and executed.  This form creates
	and destroys a top-level base widget.

	There are two functions in this file:  get_string and get_str_event.
	The first function defines the form, while the second function is 
	the event handler and deals with the actual filling of the form.
 MODIFCATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 23 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/get_string.pro)


GET_TARGET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GET_TARGET
 PURPOSE:
	To get from the user the right ascension,declination of the target
	to be processed and the start,stop time range (in MET) to process
	the target over.
 CALLING SEQUENCE:
	get_target, filflg, targ_inf, tstart, tstop [, mtlfil])
 INPUTS:
	mtlfil   - If present, this string provides the name of a file
	           containing MTL/PTL target information.  The file is read and
	           the contents displayed in a list widget for use in selecting
	           a target.  If the filename is not supplied, or if a NULL
	           string is supplied, the list widget is not created.
 OUTPUTS:
	filflg   - A 0 is returned if the Cancel button was pressed; otherwise,
	           the Done button was pressed.
	targ_inf - A structure containing the target information.  The
	           structure format is:
			{TARG_ST, name:"", ra:0.d, dec:0.d}
	tstart   - The start time, in hours, of the range of time over which
	           processing is to take place.
	tstop    - The stop time, in hours, of the range of time over which
	           processing is to take place.
 COMMON BLOCKS:
	get_targ_widg - Passes widget id's to/from the event handler.
	get_targ_data - Passes data to/from the event handler.
	look_comm     - Contains information that needs to be shared throughout
	                the program:
				fnt - The font to use in displayed text.
 RESTRICTIONS:
	Widget support is mandatory.
 PROCEDURE:
	A data form is set up and processed, using widgets.

	There are two procedures in this file:  get_target_event and 
	get_target.  get_target sets up the form and is the entry point
	(the public interface).  get_target_event is the event handler and
	performs the actual form processing.

	When selecting a target from a list (if a list is presented), the
	text widgets representing RA/DEC are filled with the target's 
	coordinates.  The contents of these text widgets are what fills
	the output coordinates.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 24 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/get_target.pro)


GET_UIT_MAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GET_UIT_MAG
 PURPOSE:
	Use Kurucz model atmospheres to compute the flux of a star through a 
	specified UIT filter (or Johnson B or V filter), given its intrinisic 
	bolometric luminosity and effective temperature.   User can optionally 
	specify the stellar distance, reddening E(B-V) and metalicity.    
	Useful for transforming theoretical HR diagrams to an observational 
	UIT diagram.

 CALLING SEQUENCE   
     uit_mag = GET_UIT_MAG( Teff, lbol, filter, [ Z =, EBV = ,Distance = 
                                   LOGg = , UVcurve = , /OLDKurucz  ]

 INPUT PARAMETERS:
	Teff - Effective temperature, scalar or vector
	lbol - log of the bolometric luminosity relative solar, same number of
		elements as Teff
	filter - UIT filter, scalar string e.g. 'A1', or 'B5'.   It is also 
		possible to compute Johnson B or V magnitudes by setting 
		filter = 'B' or 'V'

 OUTPUT:
	uit_mag - magnitude of star through specified filter, same number of
		elements as Teff

 OPTIONAL INPUT KEYWORDS:
	Z - log metalicity of the model atmosphere relative to solar, 
		Valid values are +1.0,+0.5,+0.3,+0.2,+0.1,+0.0,-0.1,-0.2,
		-0.3,-0.5,-1.0,-1.5, -2.0,-2.5,-3.0, or -3.5. 
	LOGg - Log gravity to use in the model atmosphere, default = 4.0
		Should contain same number of elements as Teff
	EBV - numeric scalar giving E(B-V) color excess to be applied to the 
		model atmosphere spectrum,  default is 0., no reddening
	UVCURVE - Number (1-7) specifying type of UV reddening curve for 
		non-zero values of EBV.   See the procedure UNRED for the 
		meaning of the numbers.   Default is 1, Savage and Mathis 
		(1979) curve
	DISTANCE - Stellar distance in pc, used to scale the stellar magnitudes
		If not supplied, then a distance of 10 pc is used which yields
		an absolute magnitude.    Numeric scalar
	OLDKURUCZ - If this keyword is set and non-zero, then the older (1979)
		Kurucz models are used.

 EXAMPLE:
	Determine the solar absolute V magnitude

	IDL> print, get_uit_mag( 5770., 0 , 'V', logg = 4.44)     ;=4.80

 REVISION HISTORY:
	Written   W. Landsman                January, 1992
	B filter capability added.  R. S. Hill, Hughes STX Corp., 26-Feb-1992
	Corrected bug in assignment of proper gravity model   WBL Jan 1993
       Faster version saves stuff in common.  RSH, HSTX, 29-Nov-1993.
       Some computations changed to double.  RSH, HSTX, 17-Feb-1994.

(See /host/bluemoon/usr2/idllib/uit/pro/get_uit_mag.pro)


GET_WINDOW

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
    GET_WINDOW
  PURPOSE:
    Return the index of the next available window
  CALLING SEQUENCE:
    index = GET_WINDOW()
  INPUTS:
    None
  OUTPUTS:
    index = an integer (0-127) giving the index of the next window that
            is not currently open
  REVISION HISTORY:
    Written    W. Landsman          March, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/get_window.pro)


GKER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GKER
 PURPOSE:
	Returns a smooth two-dimensional gaussian of the specified size and
	width.
 INPUTS:
	sigma - The width of the gaussian.  Should be floating point.
	size  - The number of columns and rows in the output array.  Should be
	        both an integer and odd.
 RETURNED:
 	The two-dimensional gaussian array.
 MODIFICATION HISTORY:
	Written by Robert H. Cornett, STX
	Documented by Michael R. Greason, Hughes STX, 23 October 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/gker.pro)


GLACTC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:  
	GLACTC
 PURPOSE:
	Program to convert right ascension (ra) and declination (dec) to
	galactic longitude (gl) and latitude (gb) (j=1) or vice versa (j=2).
 CALLING SEQUENCE: 
	glactc, ra, dec, year, gl, gb, j

 INPUTS: 
	year     equinox of ra and dec       (input)
	j        direction of conversion     (input)
		1:  ra,dec --> gl,gb
		2:  gl,gb  --> ra,dec

 INPUTS OR OUTPUTS ( depending on argument J )
	ra       right ascension, hours
	dec      declination, degrees
	gl       galactic longitude (system II), degrees
	gb       galactic latitude (system II), degrees

	All results forced double precision floating.

 COMMON BLOCKS:   
      gal      See Side Effects.    

 SIDE EFFECTS:
 	Year and galaxy orientation saved in common to make repeated     
	computations more efficient.

 HISTORY: 
	FORTRAN subroutine by T. A. Nagy, 21-MAR-78.
	Conversion to IDL, R. S. Hill, STX, 19-OCT-87.

(See /host/bluemoon/usr2/idllib/uit/pro/glactc.pro)


GRCOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GRCOL
 PURPOSE:
   Assign colors to pixel values of 255 (or specified pixel values) in a 
   X-windows color lookup table.   This emulates the graphics color assignment 
   procedure in the DeAnza and the IVAS.  However, since X-windows systems 
   do not have a graphics overlay, the image will also be affected.  Use
   PIXCOLOR for more general control of the image color table.
 CALLING SEQUENCE:
   grcol            ;Prompt for color assignment
   grcol,color      ;Set pixel values of 255 to specified color.
   grcol,color,pixvalue         ;Set color at specified pixel value
 OPTIONAL INPUT PARMETERS:
   color -    single character string giving specified color values.
              Available options are 'R' (red), 'B' (blue), 'G' (green)
              'Y' (yellow), 'T' (turquoise), 'V' (violet), 'W' (white)
              or 'D' (dark).  If omitted, program will prompt for this 
              parameter.
   pixvalue -  scalar pixel value whose color will be modified.
               Default = 255
 OUTPUTS:
    None
 NOTES:
    Most graphics X-window procedures (e.g. TVBOX, TVCIRCLE) will set
    pixel values to 255.   GRCOL will set these pixel values to the
    specified color
 PROCEDURE:
    TVLCT is used in RGB mode to load the specified pixel values.
 REVISION HISTORY:
    Written, W. Landsman ST Systems Corp.		February, 1987

(See /host/bluemoon/usr2/idllib/uit/pro/grcol.pro)


GROUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GROUP
 PURPOSE:
	Procedure in DAOPHOT sequence to place stars with non-overlapping PSF 
	profiles into distinct groups

 CALLING SEQUENCE:
	GROUP, X, Y, RCRIT, NGROUP
 INPUTS:
	X - vector, giving X coordinates of a set of stars.
	Y - vector, giving Y coordinates of a set of stars.
	RCRIT - scalar, giving minimum distance between stars of two
		distinct groups.  Stars less than this distance from
		each other are always in the same group.    Stetson suggests
		setting the critical distance equal to the PSF radius +
		the Fitting radius.

 OUTPUTS:
	NGROUP - integer vector, same number of elements as X and Y,
		giving a group number for each star position.  Group
		numbering begins with 0.

 METHOD:
	Each position is initially given a unique group number.  The distance
	of each star is computed against every other star.   Those distances
	less than RCRIT are assigned the minimum group number of the set.   A
	check is then made to see if any groups have merged together.

 PROCEDURES USED:
	REM_DUP
 REVISION HISTORY:
   Written W. Landsman  STX                  April, 1988
   Major revision to properly merge groups together  W. Landsman   Sep 1991

(See /host/bluemoon/usr2/idllib/uit/pro/group.pro)


GSSSADXY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GSSSADXY
 PURPOSE:
   This procedure converts RA and DEC to (X,Y) image pixels for a GSSS
   image. The sky coordinates may be printed and/or returned in variables.
 CALLING SEQEUNCE:
   GSSSADXY,GSA,RA,DEC,X,Y,PRFLAG 
 INPUT:
   GSA       The GSSS Astrometry structure created by GSSSEXTAST
   RA        The RA coordinate of the pixel (degrees)
   DEC       The DEC coordinate of the pixel (degrees)
 OPTIONAL INPUT:
   PRFLAG    The flag indicating whether the coordinates should be printed
                or not (0=No,1=Yes) (Default=No)
 OUTPUT:
   X         The X pixel coordinate of the image
   Y         The Y pixel coordinate of the image
 HISTORY:
   10-JUL-90 Version 1 written by Eric W. Deutsch
     Derived from procedures written by Brian McLean
   Vectorized code   W. Landsman        March, 1991
   14-AUG-91 Fixed error which caused returned X and Y to be .5 pixels too
     large.  Now X,Y follows same protocol as ADXY.
   20-AUG-91 Modified to use AstDisp procedure.

(See /host/bluemoon/usr2/idllib/uit/pro/gsssadxy.pro)


GSSSEXTAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
   GSSSEXTAST
 DESCRIPTION:
   This procedure extracts the astrometry information from a header and
   places it in a structure for use with GSSSxyad.
 CALLING SEQUENCE:
   GSSSEXTAST,H,GSA
 INPUT:
   H         The GSSS header
  OUTPUT:
   GSA       The structure containing the GSSS Astrometry information
  HISTORY:
   01-JUL-90 Version 1 written by Eric W. Deutsch
     Code derived from Software by Brian McLean
   20-AUG-91 Modified to Double Precision Variables.  E. Deutsch

(See /host/bluemoon/usr2/idllib/uit/pro/gsssextast.pro)


GSSSXYAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   GSSSXYAD
 DESCRIPTION:
   This procedure converts (X,Y) image coordinates to sky coordinates.
   The sky coordinates may be printed and/or returned in variables.
 CALLING SEQUENCE:
   GSSSxyad,gsa,x,y,ra,dec,prflag
 INPUT:
   GSA       The GSSS Astrometry structure created by GSSSEXTAST
   XIN       The X pixel coordinate(s) of the image
   YIN       The Y pixel coordinate(s) of the image
 OUTPUT:
   RA        The RA coordinate of the given pixel (degrees)
   DEC       The DEC coordinate of the given pixel (degrees)
 OPTIONAL INPUT:
   PRFLAG    The flag indicating whether the coordinates should be printed
               or not (0=No,1=Yes.)  The Default is No.
 HISTORY:
   01-JUL-90 Version 1 written by Eric W. Deutsch
   Vectorized Code   W. Landsman        March, 1991
   14-AUG-91 Fixed error which caused returned RA and DEC to be off by
     -.5 pixels in both X,Y.  Now X,Y follows same protocol as ADXY.
   20-AUG-91 Modified to use AstDisp procedure.

(See /host/bluemoon/usr2/idllib/uit/pro/gsssxyad.pro)


GSSS_STDAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GSSS_STDAST
 DESCRIPTION:
	This procedure takes a header with GSSS astrometry and writes roughly
	equivalent SDAS astrometry into the header.   ***Note that the GSSS
	astrometry will be no longer valid, because GSSS_STDAST modifies the 
	CRPIX values***

 CALLING SEQUENCE:
	GSSS_STDAST,H
 INPUT - OUTPUT:
	H -  FITS header (string array) containing GSSS astrometry.  
	GSSS_STDAST will write the equivalent linear astrometry solution into H.
 PROCEDURES USED:
	STARAST, PUTAST, SXADDHIST
 HISTORY:
	19-JUN-90 Version 1 written
	13-AUG-91 Version 2 written.  Name changed from MAKEASTGSSS to GSSS_StdAst.
	Old version didn't really work.  This version gives a good solution which
	is generally accurate to about .1 pixels on a 1024x1024 GSSS image.
	Updated to use ASTROMETRY structures.  J.D. Offenberg, Hughes STX, Jan 1993

(See /host/bluemoon/usr2/idllib/uit/pro/gsss_stdast.pro)


HASTROM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HASTROM
 PURPOSE:
	Perform a linear transformation (with POLY_2D) on an image so that
	its astrometry is identical with that in a reference header.  This
	procedure can be used to align two images.

 CALLING SEQUENCE:
	HASTROM, oldim, oldhd, newim, newhd, refhd, [MISSING = , INTERP = ]
		or
	HASTROM, oldim, oldhd, refhd, [MISSING = , INTERP =, NGRID =   ]

 INPUTS:
	OLDIM - Image array to be manipulated.  If only 3 parameters are
		supplied then OLDIM and OLDHD will be modified to contain 
		the output image array and header
	OLDHD - FITS header array for OLDIM, containing astrometry parameters
	REFHD - Reference header, containing astrometry parameters.  OLDIM
		will be rotated, shifted, and compressed or expanded until
		its astrometry matches that in REFHD.
 OUTPUTS:
	NEWIM - Image array after linear tranformation has been performed.
		The dimensions of NEWIM will be identical to the NAXIS1 and 
		NAXIS2 keywords specified in REFHD.  Regions on the reference 
		image that do not exist in OLDIM can be assigned a value with
		the MISSING keyword.
	NEWHD - Updated FITS image header associated with NEWIM

 OPTIONAL INPUT KEYWORDS:
	MISSING - Set this keyword to a scalar value which will be assigned
		to pixels in the output image which do not correspond to 
		existing imput images.  If not supplied then linear 
		extrapolation is used.   See the IDL manual on POLY_2D.
	INTERP - Scalar, one of 0, 1, or 2 determining type of interpolation
		0 nearest neighbor, 1 (default) bilinear interpolation, 
		2 cubic interpolation (only available in V3.5.0 or later)
	NGRID -  Integer scalar specifying the number of equally spaced grid 
		points on each axis to use to specify the transformation.   
		Default is GRID = 3 (9 total grid points).     The value of
		GRID must always be greater than DEGREE + 1
	DEGREE - Integer Scalar specify the degree of the transformation.
		See the routine POLYWARP for more info.   Default = 1
		(linear transformation).
 NOTES:
	(1) The 3 parameter calling sequence is less demanding on virtual 
		memory.
	(2) The astrometry in OLDHD will be precessed to match the equinox
		given in REFHD.

 EXAMPLE:
	Suppose one has an image array, IM, and an associated FITS header H.
	One desires to warp the image array so that it is aligned with another
	image with a FITS header, HREF.    Both headers contain astrometry info.
	Set pixel values to 0 where there is no overlap between the input and
	reference image, and use linear interpolation (default)

           IDL> hastrom, IM, H, HREF, MISSING = 0

 PROCEDURES USED:
	zparcheck, check_FITS, sxpar, get_EQUINOX, hprecess, extast,
	sxaddpar, sxaddhist, putast

 REVISION HISTORY:
	Written  W. Landsman, STX Co.              Feb, 1989
	Updated to CHECK_FITS                      Dec, 1991
	New astrometry keywords                    Mar, 1994

(See /host/bluemoon/usr2/idllib/uit/pro/hastrom.pro)


HBOXAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HBOXAVE
 PURPOSE:
	Box average an image array using the function BOXAVE and update the
	FITS header array.   This procedure is recommended for integer images 
	when photometric precision is desired, because it performs intermediate 
	steps using REAL*4 arithmetic.   Otherwise, the procedure HREBIN is much
	faster.

 CALLING SEQUENCE:
	HBOXAVE, Oldim, Oldhd, Newim, Hewhd, box
		or
	HBOXAVE, Oldim, Oldhd, box

 INPUTS:
	Oldim - the original image array
	Oldhd - the original image FITS header, string array

 OPTIONAL INPUTS:
	box - the box size to be used, integer scalar.  If omitted, then
		HBOXAVE will prompt for this parameter.

 OPTIONAL OUTPUTS:
	Newim - the image after boxaveraging
	Newhd - header for newim containing updated astrometry info
		If output parameters are not supplied, the program
		will modify the input parameters OLDIM and OLDHD
		to contain the new array and updated header.
 PROCEDURE:
	The parameters BSCALE, NAXIS1, NAXIS2, CRPIX1, and CRPIX2 and
	the CD (or CDELT) parameters are updated for the new FITS header.

 CALLED PROCEDURES:
	CHECK_FITS - Check that the FITS header is appropriate to the image
	BOXAVE - Performs box averaging of an image
	SXPAR, SXADDPAR - Read and write FITS keyword values

 MODIFICATION HISTORY:
	Written, Aug. 1986 W. Landsman, STI Corp.
	IDLV2 changes, sxaddpar format keyword added, J. Isensee, July,1990
	Fix 0.5 pixel offset in new CRPIX computation W. Landsman, Dec, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/hboxave.pro)


HCONGRID

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HCONGRID
 PURPOSE:
	Expand or contract an image using CONGRID and update the 
	associated FITS header array.

 CALLING SEQUENCE:
	HCONGRID, oldhd                       ;Update FITS header only
	HCONGRID, oldim, oldhd, [ newim, newhd, newx, newy, INTERP=, OUTSIZE =]

 INPUTS:
	OLDIM - the original image array
	OLDHD - the original image FITS header, string array

 OPTIONAL INPUTS:
	NEWX - size of the new image in the X direction
	NEWY - size of the new image in the Y direction
		The OUTSIZE keyword can be used instead of the 
		NEWX, NEWY parameters

 OPTIONAL OUTPUTS:
	NEWIM - the image after expansion or contraction with CONGRID
	NEWHD - header for newim containing updated astrometry info
		If output parameters are not supplied, the program
		will modify the input parameters OLDIM and OLDHD
		to contain the new array and updated header.

 OPTIONAL KEYWORD INPUTS:
	OUTSIZE - Two element integer vector which can be used instead of the
		NEWX and NEWY parameters to specify the output image dimensions
	INTERP   - 0 for nearest neighbor, 1 for bilinear interpolation
		2 for cubic interpolation.   Cubic interpolation requires
		IDL V3.5 or later.
 PROCEDURE:
	Expansion or contraction is done using the CONGRID function.
	neighbor. 
	The parameters BSCALE, NAXIS1, NAXIS2, CRPIX1, and CRPIX2 and
	the CD (or CDELT) parameters are updated for the new header.

 NOTES:
	A FITS header can be supplied as the first parameter without having
	to supply an image array.   The astrometry in the FITS header will be
	updated to be appropriate to the specified image size.

 EXAMPLE:
	Congrid an 512 x 512 image array IM and FITS header H to size 300 x 300
	using cubic interpolation

	IDL> hcongrid, IM ,H, OUT = [300, 300], INTERP = 2

	The variables IM and H will be modified to the new image size.

 MODIFICATION HISTORY:
	Written, Aug. 1986 W. Landsman, STI Corp.
	Added interp keywords, J. Isensee, July, 1990
	Add cubic interpolation W. Landsman HSTX   January 1994

(See /host/bluemoon/usr2/idllib/uit/pro/hcongrid.pro)


HEADERSTRING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HEADERSTRING
 PURPOSE:
	Convert information in FITS header to a one-string summary.
 CALLING SEQUENCE:
	String = HEADERSTRING(Header)
 INPUTS:
	Header = An image header in the FITS format.
 KEYWORD INPUTS:
	None
 OUTPUTS:
	None (other than function result)
 COMMON BLOCKS:
	None
 SIDE EFFECTS:
	None
 PROCEDURE:
	Read specific fields from FITS header and concatenate them into one
	string, which is then returned.
 MODIFICATION HISTORY:
	Written from Scratch	J. D. Offenberg, STX, Oct 1991

(See /host/bluemoon/usr2/idllib/uit/pro/headerstring.pro)


HEADFITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HEADFITS
 CALLING SEQUENCE:
	Result = headfits( filename ,[ EXTEN = ])

 PURPOSE:
	Read a FITS file header record      

 INPUTS:
	FILENAME = String containing the name of the FITS file to be read.

 OPTIONAL INPUT KEYWORD:
	EXTEN  = integer scalar, specifying which FITS extension to read.
		For example, to read the header of the first extension set
		EXTEN = 1.   Default is to read the primary FITS header 
		(EXTEN = 0).

 OUTPUTS:
	Result of function = FITS header, string array

 EXAMPLE:
	Read the FITS header of a file 'test.fits' into a string variable, h

	IDL>  h = headfits( 'test.fits')

 MODIFICATION HISTORY:
	adapted by Frank Varosi from READFITS by Jim Wofford, January, 24 1989
	Keyword EXTEN added, K.Venkatakrishna, May 1992
	Make sure first 8 characters are 'SIMPLE'  W. Landsman October 1993

(See /host/bluemoon/usr2/idllib/uit/pro/headfits.pro)


HELIO

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
    HELIO
 PURPOSE: 
    Compute (low-precision) Heliocentric coordinates for the planets.
    Adapted from the book Celestial Basic
 CALLING SEQUENCE: 
    HELIO, JD, HMS, LIST, HRAD, HLONG, HLAT
 INPUTS:
  JD = Julian day to compute for, long scalar
  HMS = hours, minutes, seconds array: H, M, S.  Universal time.
  LIST = List of planets array.  May be a single number.
    1 = merc, 2 = venus, ... 9 = pluto.
 OUTPUTS:
  HRAD = array of Heliocentric radii (A.U).
  HLONG = array of Heliocentric (ecliptic) longitudes (degrees).
  HLAT = array of Heliocentric latitudes (degrees).
    These values are scalars if LIST is a scalar.
 EXAMPLE:
  To find the heliocentric positions of Jupiter and Saturn on 1-Jan-1989
      JDCNV,1989,1,1,0,JD                   ;Convert to Julian Date 
      HELIO,JD,[0,0,0],[5,6],hrad,hlong,hlat  ;Get radius, long, and lat
 COMMON BLOCKS: 
  HELIOCOM --- stores parameters.
 ROUTINES USED: 
   DATATYPE, ISARRAY,
 MODIFICATION HISTORY: 
   R. Sterner.  20 Aug, 1986.

(See /host/bluemoon/usr2/idllib/uit/pro/helio.pro)


HELIO_JD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HELIO_JD
 PURPOSE:
	Convert geocentric (reduced) Julian date to heliocentric julian date
	(i.e. correct for extra light travel time between Earth and Sun)

 CALLING SEQUENCE:
	jdhelio = HELIO_JD( date, ra, dec)

 INPUTS
	date - reduced Julian date (= JD - 2400000), scalar or vector, MUST
		be double precision
	ra,dec - scalars giving right ascension and declination in DEGREES

 OUTPUTS:
	jdhelio - heliocentric julian date.

 EXAMPLE:
	What is heliocentric julian date of an observation of V402 Cygni
	(RA = 20 7 15, Dec = 37 0.33) taken June 15, 1973 at 11:40 UT?

	IDL> juldate, [1973,6,15,11,40], jd      ;Get Geocentric julian date
	IDL> hjd = helio_jd( jd, ten(20,7,15)*15., ten(37,0.33) )  
                                                            
	==> hjd = 41848.9881

 PROCEDURES CALLED:
	zparcheck, xyz

 REVISION HISTORY:
 	Algorithm from the book Astronomical Photometry by Henden, p. 114
	Written,   W. Landsman       STX     June, 1989 

(See /host/bluemoon/usr2/idllib/uit/pro/helio_jd.pro)


HEXTRACT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HEXTRACT
 PURPOSE:
	Extract a subimage from an array and create a new FITS header with
	updated astrometry for the subarray
 CALLING SEQUENCE:
	HEXTRACT, Oldim, Oldhd, [ Newim, Newhd, x0, x1, y0, y1 ]
		or
	HEXTRACT, Oldim, Oldhd, [x0, x1, y0, y1 ]	 

 INPUTS:
	Oldim - the original image array
	Oldhd - the original image header

 OPTIONAL INPUTS:
	x0, x1, y0, y1 - respectively, first and last X pixel, and first and
	last Y pixel to be extracted from the original image, integer scalars.
	If omitted,  HEXTRACT will prompt for these parameters

 OPTIONAL OUTPUTS:
	Newim - the new subarray extracted from the original image 
	Newhd - header for newim containing updated astrometry info
		If output parameters are not supplied or set equal to
		-1, then the HEXTRACT will modify the input parameters 
		OLDIM and OLDHD to contain the subarray and updated header.

 PROCEDURE:
	The FITS header parameters NAXIS1, NAXIS2, CRPIX1, and CRPIX2 are
	updated for the extracted image.

 EXAMPLE:  
	Read an image from a FITS file 'IMAGE', extract a 512 x 512 subimage 
	with the same origin, and write to a new FITS file 'IMAGENEW'

	IDL> im = READFITS( 'IMAGE', hdr )	;Read FITS files into IDL arrays
	IDL> hextract, im, h, 0, 511, 0, 511	;Extract 512 x 512 subimage
	IDL> writefits, 'IMAGENEW', im ,h	;Write subimage to a FITS file

 PROCEDURES CALLED
	CHECK_FITS, STRN, SXPAR, SXADDPAR, SXADDHIST
 MODIFICATION HISTORY:
	Written, Aug. 1986 W. Landsman, STX Corp.
	Use astrometry structure,   W. Landsman      Jan, 1994

(See /host/bluemoon/usr2/idllib/uit/pro/hextract.pro)


HINFO

[Previous Routine] [Next Routine] [List of Routines]
  NAME
	HINFO
  PURPOSE:
	Describe information in a FITS image header in a nice format.  The 
	input can be either a FITS string array, or the filename of a .HHH file.

  CALLING SEQUENCE:
	hinfo, hdr

  INPUTS:
	hdr - FITS header.  It must be either (1) a scalar string giving the
		name of the .HHH file containing a FITS header or (2) a string
		FITS header array

  OPTIONAL KEYWORDS:
	TEXTOUT - Determines output device - see TEXTOPEN

  METHOD:
	The FITS header is searched for the keywords IMAGE, DATATYPE, NAXIS1
	NAXIS2,OBJECT,TELESCOP,FILTER,EXPTIME, as well as for astrometry
	keywords.

  REVISION HISTORY:
	Written   W. Landsman              February, 1991
	Fixed computation of image center  December  1991
	Improved display of exposure time  March 1992
	Updated to use ASTROMETRY structures.  J.D. Offenberg, HSTX, Jan 1993
	Work for UITPHOT headers without NAXIS keywords

(See /host/bluemoon/usr2/idllib/uit/pro/hinfo.pro)


HOST_TO_IEEE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   HOST_TO_IEEE
 PURPOSE:
    To translate an IDL variable from IEEE-754 representation (as used, for
    example, in FITS data ), into the host machine architecture.

 CALLING SEQUENCE:

    HOST_TO_IEEE, data, [ IDLTYPE = , ]

 INPUT-OUTPUT PARAMETERS:
     data - any IDL variable, scalar or vector.   It will be modified by
            HOST_TO_IEEE to convert from host to IEEE representation.  Byte 
            and string variables are returned by HOST_TO_IEEE unchanged
 OPTIONAL KEYWORD INPUTS:
     IDLTYPE - scalar integer (1-7) specifying the IDL datatype according
             to the code given by the SIZE function.      This keyword
             will usually be used when suppying a byte array that needs
             to be interpreted as another data type (e.g. FLOAT).
 EXAMPLE:
     Suppose FITARR is a 2880 element byte array to be converted to a FITS
     record and interpreted a FLOAT data.

       IDL> host_to_ieee, FITARR, IDLTYPE = 4
 METHOD:
     The BYTEORDER procedure is called with the appropiate keywords
 RESTRICTION:
     Requires IDL V2.2.2 or later for floating or double precision
 MODIFICATION HISTORY:
     Adapted from CONV_UNIX_VAX, W. Landsman   Hughes/STX    January, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/host_to_ieee.pro)


HPRECESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HPRECESS
 PURPOSE:
	Precess the astrometry in a FITS header to a new equinox

 CALLING SEQUENCE:
	HPRECESS, HDR, [ yearf ]      

 INPUT-OUTPUT:
	HDR - FITS Header, must contain the CRVAL astrometry keywords,
		and either an EPOCH or EQUINOX keyword.
		HDR will be modified to contain the precessed astrometry

 OPTIONAL INPUT:
	YEARF - Scalar, giving the year of the new (Final) equinox.
		If not supplied, user will be prompted for this value.

 METHOD:
	The CRVAL and CD (or CROTA) keywords are extracted from the header 
	and precessed to the new equinox.  The EPOCH or EQUINOX keyword in 
	the header is  updated.  A HISTORY record is added

 RESTRICTIONS:
	The FK4 reference frame is assumed for both equinoxes.

 PROCEDURES USED:
	ZPARCHECK, GET_EQUINOX, EXTAST, SXADDPAR, SXADDHIST, PRECESS,
	PRECESS_CD, PUTAST
 REVISION HISTORY:                                               
	Written  W. Landsman        STX              July, 1988
	CD matrix precessed -                        February, 1989
	Update EQUINOX keyword when CROTA2 present   November, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/hprecess.pro)


HPRINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	HPRINT
 PURPOSE:
	Print a FITS header (or any other string array) at the the terminal
	by printing 1 line at a time.
	Needed because IDL will add an extra space to the 80 character
	FITS lines, causing a space to appear betweeen lines.

 CALLING SEQUENCE:
	HPRINT, h, [ firstline ]

 INPUTS:
	H - FITS header (or any other string array).

 OPTIONAL INPUT:
	FIRSTLINE - scalar integer specifying the first line to begin 
		displaying.   The default is FIRSTLINE = 1, i.e. display 
		all the lines.     If Firstline is negative, then the first
		line to be printed is counted backward from the last line.

 NOTES:
	HPRINT has the following differences from the intrinsic PRINT procedure

	(1) Arrays are printed one line at a time to avoid a space between 80
		character lines
	(2) Lines are trimmed with STRTRIM before being printed to speed up 
		display
	(3) The /more option is used for output. 

 EXAMPLE:
	Read the header from a FITS file named 'test.fits' and display it at the
	terminal beginning with line 50

	IDL> h = headfits( 'test.fits')         ;Read FITS header
	IDL> hprint, h, 50                      ;Display starting at line 50

	To print the last 25 lines of the header

	IDL> hprint, h, -25

 REVISION HISTORY:
	Written W. Landsman                     July, 1990
	Added test for user quit                July, 1991
	Added optional FIRSTLINE arguement      November, 1992
	Modifed for Mac IDL, I  Freedman HSTX April 1994        

(See /host/bluemoon/usr2/idllib/uit/pro/hprint.pro)


HREBIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HREBIN
 PURPOSE:
	Expand or contract a FITS or SDAS image using REBIN and update the 
	header array.  The size of the new image must be an integer factor of 
	the original image size.    User can either overwrite the input array,
	or write to new variables.

 CALLING SEQUENCE:
	hrebin, oldhd        ;Special calling sequence to just update header
	hrebin, oldim, oldhd, [ newim, newhd, newx, newy, OUTSIZE = ,SAMPLE = ]

 INPUTS:
	OLDIM - the original image array
	OLDHD - the original image FITS header, string array

 OPTIONAL INPUTS:
	NEWX - size of the new image in the X direction, integer scalar
	NEWY - size of the new image in the Y direction, integer scalar
		HREBIN will prompt for NEWX and NEWY if not supplied

 OPTIONAL OUTPUTS:
	NEWIM - the image after expansion or contraction with REBIN
	NEWHD - header for newim containing updated astrometry info
		If output parameters are not supplied, the program
		will modify the input parameters OLDIM and OLDHD
		to contain the new array and updated header.

 OPTIONAL INPUT KEYWORDS:
	SAMPLE - Expansion or contraction is done using REBIN which uses 
		bilinear interpolation when magnifying and boxaveraging when 
		minifying.
		If the SAMPLE keyword is supplied and non-zero, then nearest 
		neighbor sampling is used in both cases.   

	OUTSIZE - Two element integer vector which can be used instead of the
		NEWX and NEWY parameters to specify the output image dimensions

 PROCEDURE:
	The parameters BSCALE, NAXIS1, NAXIS2, CRPIX1, and CRPIX2 and the CD 
	(or CDELT) parameters are updated for the new FITS header.

 EXAMPLE:
	Compress a 2048 x 2048 image array IM, with header FITS HDR, to a 
	512 x 512 array.   Overwrite the input variables with the compressed 
	image and header.

	IDL> hrebin, im, hdr, OUT = [512,512]

 PROCEDURES USED:
	SXPAR, SXADDHIST, CHECK_FITS

 MODIFICATION HISTORY:
	Written, December 1990  W. Landsman, ST System Corp.
	Update CD1_1 keywords   W. Landsman   November 1992

(See /host/bluemoon/usr2/idllib/uit/pro/hrebin.pro)


HREVERSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HREVERSE
 PURPOSE:
	Reverse an image about either the X or Y axis, and create a new 
	header with updated astrometry for the reversed image.

 CALLING SEQUENCE:
	HREVERSE,oldim,oldhd, [ subs ]   	;Update input image and header
		or
	HREVERSE, oldim, oldhd, newim, newhd, [ subs ]   

 INPUTS:
	OLDIM - the original image array
	OLDHD - the original image header

 OPTIONAL INPUTS:
	SUBS - Subs equals 1 to reverse the order of the X dimension,
		2 to reverse Y order.  If omitted, then HREVERSE will
		prompt for this scalar parameter.

 OPTIONAL OUTPUTS:
	NEWIM - the rotated image, with the same dimensions as Oldim 
	NEWHD - header for newim containing updated astrometry info
		If output parameters are not supplied, the program
		will modify the input parameters OLDIM and OLDHD
		to contain the rotated image and updated header.

 SIDE EFFECTS:
	A right-handed coordinate system is converted into a left-
	handed one, and vice-versa.

 PROCEDURE:
	The User's Library procedure REVERSE is used to reverse the image.
	The CD and CRPIX header parameters are updated for the new header.
	For AIPS type astrometry, the CDELT parameters are also updated.
	A history record is also added to the header

 MODIFICATION HISTORY:
	Written, Aug. 1986 W. Landsman, STI Corp.
	Error modifying CROTA angles corrected     9-23-88
	Added format keyword, J. Isensee, July, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/hreverse.pro)


HROT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	HROT
 PURPOSE:
	Rotate an image (cubic, bilinear or nearest neighbor interpolation) 
	and create a new FITS header with updated astrometry for the rotated 
	image.

 CALLING SEQUENCE:
	HROT, oldim, oldhd, [ newim, newhd, angle, xc, yc, int, 
			MISSING =, INTERP = ]
 INPUTS:
	OLDIM - the original image array                             
	OLDHD - the original FITS image header, string array

 OPTIONAL INPUTS:
	NEWIM - If NEWIM is set to -1, then the old image and header will
		be updated
	ANGLE - Rotation angle degrees counterclockwise
	XC    - X Center of rotation (-1 for center of image)
	YC    - Y Center of rotation (-1 for center of image)
	INT   - 0 for nearest neighbor, 1 for bilinear interpolation
		2 for cubic interpolation.   Cubic interpolation requires
		IDL V3.5 or later.

 OPTIONAL OUTPUTS:
	NEWIM - the rotated image, with the same dimensions as Oldim 
	NEWHD - header for newim containing updated astrometry info
		If output parameters are not supplied, the program
		will modify the input parameters OLDIM and OLDHD
		to contain the rotated image and updated header.

 OPTIONAL INPUT KEYWORD:
	MISSING - Set this keyword to a scalar value which will be assigned
		to pixels in the output image which do not correspond to 
		existing imput images (e.g if one rotates off-center). 
		If not supplied then linear extrapolation is used.

	INTERP - scalar set to either 0 (nearest neighbor interpolation),
		1 (bilinear interpolation), or 2 (cubic interpolation, V3.5
		or later).    Either the INTERP keyword or the int parameter
		can be specified.
 EXAMPLE:
	Rotate an image non-interactively 30 degrees counterclockwise.  Use
	bilinear interpolation, and set missing values to 0.

	IDL>  HROT, im_old, h_old, im_new, h_new, 30, -1, -1, 1, MIS = 0

 RESTRICTIONS:
	Unlike the ROT procedure, HROT cannot be used to magnify or
	or demagnify an image. Use HCONGRID or HREBIN instead.

 PROCEDURE:
	The image array is rotated using the ROT procedure.
	The CD (or CROTA) and CRPIX parameters, if present in the FITS header,
	are updated for the new rotation.
	History records are also added to the header

 PROCEDURES USED:
	CHECK_FITS, GETOPT, ROT, SXADDPAR, EXTAST, GETROT

 MODIFICATION HISTORY:
	Written, Aug. 1986 W. Landsman, ST Systems Corp.
	Added MISSING keyword, W. Landsman March, 1991
	Added cubic interpolation, use astrometry structure   Feb 1994

(See /host/bluemoon/usr2/idllib/uit/pro/hrot.pro)


IDLBDR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IDLBDR
 
 PURPOSE:
	Emulate the BDR reduction of a UIT image.    This procedure is 
	specific to the UIT Vax or Unix machines at GSFC.

 CALLING SEQUENCE
	IDLBDR, Read_Name, Im_Name, [ HDfile = , HDNo =, /NoDelete, LINEAR = ]

 PURPOSE:
	Subract a 2-d BAKFOG, linearize, and flat field a UIT density image. 

 INPUT 
	Read_Name - input STSDAS density image name, scalar string
 
 OPTIONAL INPUT
	Out_name -   name for output image before suffixes are added.
               If not supplied, READ_NAME, is used.
 
 OUTPUT
	NONE

 OPTIONAL KEYWORD INPUTS
	HDFILE   - Name of H & D curve file to read (def = 'NEWHD.DAT'),
	HDNO     - Entry within H&D curve file to read (DEF = 0)
	NODELETE - If present and nonzero, do not delete linearized images
		after the linearized + flat fielded image has been 
               created
	LINEAR - If this keyword is set, then the reduction stops after the
		image has been linearized, and no flat-field is applied.
                   
 SIDE EFFECTS
	A background subtracted, linearized, and flat fielded image is 
	written to disk.   

 REVISION HISTORY
	N. Collins    HUGHES/STX, FEB 25, 1994
	Adapted from routines by N. Collins, M. Greason, and S. Gessner.
    

(See /host/bluemoon/usr2/idllib/uit/pro/idlbdr.pro)


IEEE_TO_HOST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   IEEE_TO_HOST
 PURPOSE:
    To translate an IDL variable in IEEE-754 representation (as used, for
    example, in FITS data ), into the host machine architecture.

 CALLING SEQUENCE:

    IEEE_TO_HOST, data, [ IDLTYPE = , ]

 INPUT-OUTPUT PARAMETERS:
     data - any IDL variable, scalar or vector.   It will be modified by
            IEEE_TO_HOST to convert from IEEE to host representation.  Byte 
            and string variables are returned by IEEE_TO_HOST unchanged
 OPTIONAL KEYWORD INPUTS:
     IDLTYPE - scalar integer (1-7) specifying the IDL datatype according
             to the code given by the SIZE function.     This keyword
             is usually when DATA is a byte array to be interpreted as
             another datatype (e.g. FLOAT).
 EXAMPLE:
     A 2880 byte array (named FITARR) from a FITS record is to be 
     interpreted as floating and converted to the host representaton:

      IDL> IEEE_TO_HOST, bytarr, IDLTYPE = 4     
 METHOD:
     The BYTEORDER procedure is called with the appropiate keyword
 RESTRICTION:
     Requires IDL V2.2.2 or later for floating or double precision
 MODIFICATION HISTORY:
     Adapted from CONV_UNIX_VAX, W. Landsman   Hughes/STX   May, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/ieee_to_host.pro)


IMCIRCLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IMCIRCLE
 PURPOSE:
	To blank out the area on an image outside a circle of specified radius 
	and specified center.

 CALLING SEQUENCE:
	new = IMCIRCLE( Image, Rad, X, Y, VALUE) 

 INPUT:
	Image - 2-d array for which one wants to specify an image circle

 OPTIONAL INPUTS:
	RAD - radius of circle to be drawn, scalar, in pixels.  IMCIRCLE prompts
		for a radius if not supplied
	X - x position for circle center, numeric scalar
	Y - y position for circle center, numeric scalar
	If X and Y are not specified then IMCIRCLE assumes the center of the
		image
	VALUE - Value to be assigned to blanked out pixels - default is 0
            Default = 0.

 OUTPUTS:
	New = resulting image

 EXAMPLE:
    To assign a pixel value of 0 to pixels outside of the UIT image circle,
    in a 512 x 512 image array, IM

              IM = IMCIRCLE ( IM, 256 )
 REVISON HISTORY:
       written by B. Pfarr, STX, 1/91 from TVCIRCLE.
       fixed header documentation, B. Pfarr, 2/91

(See /host/bluemoon/usr2/idllib/uit/pro/imcircle.pro)


IMCONTOUR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IMCONTOUR
 PURPOSE:
	Contour plot labeled with astronomical coordinates.  The type
	of coordinate display is controlled by the keyword TYPE
	Set TYPE=0 (default) to measure distances from the center of the image
	(IMCONTOUR will decide whether the plotting units will be in
	arc seconds, arc minutes, or degrees depending on image size.)
	Set TYPE=1 for standard RA and Dec labeling

 CALLING SEQUENCE:
	IMCONTOUR, im, hdr,[ TYPE=, PUTINFO=, XTITLE = , YTITLE = , NLEVELS= 
		MAX_VALUE=, LEVELS=, TITLE =, SUBTITLE =, FOLLOW = , XMINOR =,
		YMINOR =, CHAN =  ]

 INPUTS:
	IM - 2-dimensional image array
	HDR - FITS header associated with IM, string array, must include
		astrometry keywords.   IMCONTOUR will also look for the
		OBJECT and IMAGE keywords, and print these if found and the 
		PUTINFO keyword is set.

 OPTIONAL PLOTTING KEYWORDS:
	TYPE - the type of astronomical labeling to be displayed.   Either set
		TYPE = 0 (default), distance to center of the image is
		marked in units of Arc seconds, arc minutes, or degrees

		TYPE = 1 astronomical labeling with Right ascension and 
		declination.

	PUTINFO - If set then IMCONTOUR will add information about the image
		to the right of the contour plot.  Information includes image
		name, object, image center, image center, contour levels, and
		date plot was made

	The other keywords XTITLE, YTITLE, NLEVELS, MAX_VALUE, LEVELS,
	TITLE, SUBTITLE, FOLLOW, XMINOR, and YMINOR have the same 
	meaning as in the CONTOUR procedure.  

	CHAN - On devices with multiple channels this specifies the output 
		channel.   On the IVAS and DeAnza image displays the default 
		is the graphics overlay.

 NOTES:
	(1) The contour plot will have the same dimensional ratio as the input
		image array
	(2) To contour a subimage, use HEXTRACT before calling IMCONTOUR

 PROCEDURES USED:
	CHECK_FITS, EXTAST, GETROT, TICPOS, TICLABEL, TIC_ONE, TICS, XYAD
	CONS_RA, CONS_DEC, ADSTRING

 REVISION HISTORY:
	Written   W. Landsman   STX                    May, 1989
	Fixed RA,Dec labeling  W. Landsman             November, 1991
	Fix plottting keywords  W.Landsman             July, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/imcontour.pro)


IMDBASE

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	IMDBASE
 PURPOSE:
	Locate sources within a specified IDL database that are within a
	given image.

 CALLING SEQUENCE:
	imdbase, hdr, catalogue, [list, XPOS= ,YPOS=, XRANGE= ,YRANGE= , 
			SUBLIST = ]  

 INPUTS:
	hdr - FITS image header containing astrometry, and the NAXIS1,
		NAXIS2 keywords giving the image size
	catalogue - string giving name of catalogue in database
		Database must contain the (preferably indexed)
		fields RA (in hours) and DEC.   Type DBHELP for a 
		list of the names of available catalogues.

 OPTIONAL OUTPUT PARAMETER:
	LIST - A long vector containing the entry numbers of sources found
		within the image.   This vector can then be used with other
		database procedures, e.g. to print specified fields (DBPRINT)
		or subselect with further criteria (DBFIND)

 OPTIONAL OUTPUT KEYWORD PARAMETER:
	XPOS - REAL*4 vector giving X positions of catalogue sources found 
		within the image
	YPOS - REAL*4 vector giving Y positions of catalogue sources found 
		within the image

 OPTIONAL INPUT KEYWORD PARAMETERS
	XRANGE - 2 element vector giving the X range of the image to consider.
		The default is to search for catalogue sources within the entire
		image
	YRANGE - 2 element vector giving the Y range of the image to consider.
	SUBLIST - vector giving entries in the database to consider in the
		search.  If not supplied, or set equal to -1, then all entries
		are considered.

 NOTES:
	If a list vector is not supplied, then the found objects are displayed
	at the terminal.

 EXAMPLE:
	Find all existing IUE SWP observations within the field of the disk
	file LINEAR:FUV0435.  Subselect those taken with the SWP camera

      SXHREAD,'LINEAR:FUV0435',H        ;Read header from disk
      IMDBASE,H,'IUE',list              ;Find IUE obs. within image 
      LIST2 = DBFIND('CAM_NO=3',LIST)   ;Subselect on SWP images

 SIDE EFFECTS:
	The IDL database is left open upon exiting IMDBASE:
 NOTES:
	The NGC2000, GUIDESTAR, PRIN_GAL, SKYMAP, OMEGACEN, NGC1851, PPM, SAO
	HST_CATALOG, HIPPARCOS, and YALE_BS catalogues are assumed to be in 
	equinox 2000.  All other catalogues are assumed to be in equinox 1950 

 SYSTEM VARIABLES:                                                
	The non-standard system variable !TEXTOUT  to control the output device
	for the listing.  See TEXTOPEN.

 PROCEDURES USED:
	SXPAR, EXTAST, GET_EQUINOX, PRECESS, TEXTOPEN, TEXTCLOSE, XY2AD, 
	DBOPEN, DBFIND, AD2XY, DBEXT
 REVISION HISTORY:
	Written W. Landsman            September, 1988
	Added SUBLIST keyword          September, 1991
	Updated to use ASTROMETRY structures	J.D. Offenberg, HSTX, Jan 1993
	Conversion for precession fixed.   R.Hill, HSTX, 22-Apr-93
	Added additional 2000 coordinate catalogs   W. Landsman  April 93

(See /host/bluemoon/usr2/idllib/uit/pro/imdbase.pro)


IMF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IMF
 PURPOSE:
	Returns values of an N-component power-law logarithmic initial mass 
	function, normalized so that the total mass distribution equals one 
	solar mass.

 CALLING SEQUENCE:
	psi = IMF( mass, expon,  mass_range )

 INPUTS:
	mass - mass in units of solar masses (scalar or vector)
		Converted to floating point if necessary
	expon - power law exponent, uusally negative, scalar or vector
		The number of values in expon equals the number of different
		power-law components in the IMF
		A Saltpeter IMF has a scalar value of expon = -1.35
	mass_range - vector containing the mass upper and lower limits of the 
		IMF and masses where the IMF exponent changes.   The number 
		of values in mass_range should be one more than in expon.   
		The values in mass_range should be monotonically increasing.

 OUTPUTS
	psi - mass function, number of stars per unit logarithimic mass interval
		evaluated for supplied masses

 NOTES:
	The mass spectrum f(m) giving the number of stars per unit mass 
	interval is related to psi(m) by  m*f(m) = psi(m).    The normalization
	condition is that the integral of psi(m) between the upper and lower
	mass limit is unity.

 EXAMPLE:
       (1) Print the number of stars per unit mass interval at 3 Msun 
		for a Salpeter (expon = -1.35) IMF, with a mass range from 
		0.1 MSun to 110 Msun.

		IDL> print, imf(3, -1.35, [0.1, 110] ) / 3

	(2) Lequex et al. (1981, A & A 103, 305) describes an IMF with an
		exponent of -0.6 between 0.007 Msun and 1.8 Msun, and an
		exponent of -1.7 between 1.8 Msun and 110 Msun.    Plot
		the mass spectrum f(m)

		IDL> m = [0.01,0.1,indgen(110) + 1 ]  ;Make a mass vector
		IDL> expon = [-0.6, -1.7]	;Exponent Vector
		IDL> mass_range = [ 0.007, 1.8, 110]	;Mass range
		IDL> plot_oo, m, imf(m, expon, mass_range ) / m

 METHOD
	IMF first calculates the constants to multiply the upper and lower
	power law such that the IMF is continuous at the intermediate mass, 
	and that the total mass integral is one solar mass.  The IMF is then 
	calculated for the supplied masses.   Also see Scalo (1986)

 REVISION HISTORY:
	Written    W. Landsman              August, 1989  
	Force Expon_up to be a scalar       June 1992
	Set masses LE mass_u rather than LT mass_u  August, 1992

(See /host/bluemoon/usr2/idllib/uit/pro/imf.pro)


IMG2PHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IMG2PHOT
 PURPOSE:
	To get stellar positions from a displayed image by cursor and
	search UITPHOT tables for them.  Photometric information and,
	if a second table is available, colors are extracted.

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	n = img2phot([sel, WIDTH=wdth, SILENT=slnt, TXTWDGT=outtext,]
		INSWDGT=instext)
 OUTPUTS:
	sel       - A structure array containing position/magnitude information
	            for the selected stars.  Each element contains:
			XI     - The x coordinate of the star in the image.
			YI     - The y coordinate of the star in the image.
			XT     - The x coordinate of the star in the table.
			YT     - The y coordinate of the star in the table.
			RA     - The right ascension of the star, in degrees.
			DEC    - The declination of the star, in degrees.
			EQNX   - The equinix of the celestial coordinates.
			MAG1   - The first aperture magnitude of the star.
			ERR1   - The first aperture magnitude error.
			MAG2   - The second aperture magnitude of the star.
			ERR2   - The second aperture magnitude error.
			MAG3   - The third aperture magnitude of the star.
			ERR3   - The third aperture magnitude error.
			MAGPSF - The PSF magnitude of the star.
			ERRPSF - The PSF magnitude error.
			SKY    - The sky flux.
			ERRSKY - The sky error.
			IND    - The index in the table of the star.
			FILTER - The table's filter.
			COLOR  - A structure containing the UV color of the
			         star.  This structure contains the color, and
			         two strings indicating the filters used.
	returned  - The number of positions that have been selected and
	            extracted.
 KEYWORDS:
	INSWDGT   - The instruction widget.  This is where the instructions
	            for the use of this function are written.
	SILENT    - If present and non-zero AND if sel has been specified on
	            the command line, information concerning each selected star
	            is not written to the screen.
	TXTWDGT -   If present and non-negative, and if FILE has not been 
	            specified, the output is written to this widget instead of 
	            the standard output.
	WIDTH     - Defines the size of the full-width half-max used in the
	            centroid, the size of the boxes displayed about the stars,
	            and the maximum separation between the table and image
	            star positions defining a match.  1/3 of this number is
	            used to determine the maximum separation.
 COMMON BLOCKS:
	Image_Blk  The image common block.  See IMG_INIT for details.
 PROCEDURE:
	The mouse is used to select positions from the image display.  Each
	position is searched for in the first UITPHOT FITS table.  If a table
	entry is found, the photometric information is extracted and displayed.
	The information is also added to the end of the 'sel' array.  This
	array is compressed, eliminating the dummy entry at the start, just
	before returning from the procedure.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 24 April 1992.
	Widget support for output added.  MRG, Hughes STX, 27 April 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/img2phot.pro)


IMG_INIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IMG_INIT
 PURPOSE:
	To read an image in from disk and display it.  The image is saved
	in a common block, along with the header and a set of scale factors
	(used to convert coordinates).

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	img_init [, imfile, /CONTRAST,CHANNEL=chn,TITLE='',XSIZE=xsz,YSIZE=ysz]
 INPUTS:
	imfile     A string containing the name of the SDAS files to get the 
	           image from.  If not provided, this is asked for.
 KEYWORDS:
	CHANNEL    The IDL graphics window to display the image in.  If not
	           specified, the current window is used.
	CONTRAST   If present and non-zero, the CONTRAST procedure is called
	           after the image has been displayed.
	XSIZE      If present and non-zero, this keyword supplies the 
	           horizontal size of the image display.  Defaults to 512.
	YSIZE      If present and non-zero, this keyword supplies the 
	           vertical size of the image display.  Defaults to 512.
	TITLE      A string used as the title of the window.
 COMMON BLOCKS:
	Image_Blk  The image common block, consisting of:
			sclx  The x (horizontal) scale factor.
			scly  The y (vertical) scale factor.
			cn    The channel the image is displayed in.
			im    An array containing the image.
			hd    The image header.
	           The scale factors are computed by dividing the image size
	           by the display size.  Therefore, multiply a display coord.
	           by the scale factors to get the image coord.
 PROCEDURE:
	The image is read in, scaled to the appropriate size, and displayed.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 23 April 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/img_init.pro)


IMLABEL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       IMLABEL
 PURPOSE:
       To label an image which has been displayed on the workstation
       with pixel values, or right ascension and declination if
       astrometry info is present in the header. Will also write to a 
       postscript file.

 CALLING SEQUENCE:
	IMLABEL, h, pflag, [ KEY , XDIS =, YDIS =, CHSIZE = ]

 INPUTS:
	h       - FITS image header array

 OPTIONAL INPUTS:
	pflag   - if present and nonzero, display pixels only

 OPTIONAL KEYWORD INPUTS:
	key   - optional FITS keyword to be extracted for title, scalar string
	xdis  - approx. dist. in pixels for x tics (def=20)
	ydis  - approx. dist. in pixels for y tics (def=20)
	chsize - scale factor for size of character labels (def = 1.0)

 OUTPUTS:
	None
 SYSTEM VARIABLES: 
	The system variable !GRID should be set to 1 to display 
	full grid lines, or set to 0 to see just tic marks.

 RESTRICTIONS:
	The following image present difficulties for IMLABEL
		(1) Declinations greater than 70 or less than -70 degrees.
		(2) Rotation angles near 90 or 270 degrees
	The RA and Dec labels will only be approximate for large
	declinations.

 SIDE EFFECTS:
       IMLABEL will mask the outside 50 pixels of the screen.  If you need
       To see part of an image hidden under the mask, suppress the graphics
       overlay (graphon).  The color and intensity of the coordinate overlay
       may be modified with the procedures GRCOL and GRINT, respectively.
       NOTE: IF writing to a postscript file, the border will NOT be masked.
       Use procedure Border to create the border first.

 REVISON HISTORY:
       written by B. Pfarr, STX, 4/14/87
	REVISED G. HENNESSY FOR IVAS SEP 1988
	Modified for use with a workstation.  M. Greason, STX, May 1990
       Modified to use normal coordinates.  Will work with postscript. 
                B. PFarr, STX, 1/91
       Modified to also work on the IVAS and DEANZA, BP, 2/91
       converted key,xdis,ydis to keywords BP, 4/91
       added chsize keyword, BP, 4/91
	Updated to use ASTROMETRY structure.  J.Offenberg, Hughes STX, Jan 1993

(See /host/bluemoon/usr2/idllib/uit/pro/imlabel.pro)


IMLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	IMLIST        
 PURPOSE:
	Display pixel values on an image surrounding a specified X,Y center.
	IMLIST is similar to TVLIST but the center pixel is supplied directly by
	the user, rather than being read off of the image display

 CALLING SEQUENCE:
	IMLIST, Image, Xc, Yc, [ TEXTOUT = , DX = , DY = ,WIDTH = ,DESCRIP = ]

 INPUTS:
	Image - Two-dimensional array containing the image 
	Xc  -   X pixel value at which to center the display, integer scalar 
	Yc -    Y pixel value at which to center the display, integer scalar 

 OPTIONAL INPUTS KEYWORDS:
	TEXTOUT - Scalar number (1-5) or string which determines output device.
		(see TEXTOPEN) The following dev/file is opened for output.

		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)

	DX     -Integer scalar giving the number of pixels inthe  X direction 
		to be displayed.  If omitted then DX = 18 for byte images, and 
		DX = 14 for integer images.  IMLIST will display REAL data 
		with more significant figures if more room is availble to 
		print.  

	DY    - Same as DX, but in Y direction.  If omitted, then DY = DX 
	WIDTH - Integer scalar giving the character width of the output device.
		Default is 80 characters.
	DESCRIP =  Scalar string which will be written as a description over
		the output pixel values.   If DESCRIP is not supplied, and the
		output device specified by TEXTOUT is not a terminal, then the
		user will be prompted for a description.

 OUTPUTS:
	None.

 PROCEDURE:
	Corresponding region of image is then displayed at
	the terminal.   If necessary, IMLIST will divide all pixel values
	in a REAL*4 image by a (displayed) factor of 10 to make a pretty format.

 SYSTEM VARIABLES:
	If the keyword TEXTOUT is not supplied, then the non-standard system
	variable !TEXTOUT will be read.

 RESTRICTIONS:
	IMLIST may not be able to correctly format all pixel values if the
	dynamic range of the values near the center pixel is very large

 EXAMPLE:
	Display the pixel values of an image array IM in the vicinity of 254,111

	IDL> imlist, IM, 254, 111

 PROCEDURES USED
	TEXTOPEN, F_FORMAT, TEXTCLOSE, DATATYPE
 REVISION HISTORY:
	Written,    W. Landsman             June, 1991
	Added DESCRIP keyword    W. Landsman      December, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/imlist.pro)


IMWARP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    IMWARP
 PURPOSE:
    Warps an image to move a given set of x, y coordinates to correspond
    to another set of x, y coordinates ('reference' coordinates).
 CALLING SEQUENCE:
    imwarp,oldim,newim,x,y,xref,yref,missing=missing,degree=degree
 INPUT PARAMETERS:
    oldim = input image
    x, y  = coordinates of real-world things (e.g., stars) on oldim
    xref, yref = coordinates you want those things to have on output image
    missing [keyword] = POLY_2D keyword
    degree [keyword] = degree of polynomial fit; default is 1
    fast [keyword] = flag for nearest-neighbor transformation;
                     default is bilinear interpolation
 OUTPUT PARAMETERS:
    newim = output image
 COMMON BLOCKS:  none
 SIDE EFFECTS:  none
 PROCEDURE:
    Gets coefficients with polywarp, then calls poly_2d.
 MODIFICATION HISTORY:
    Written by R. S. Hill, ST Sys. Corp., 10 April 1991
    Degree keyword added.  RSH, STX, 15 April 1991
    Fast keyword added.  RSH, STX, 16 April 1991

(See /host/bluemoon/usr2/idllib/uit/pro/imwarp.pro)


INTERLUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	INTERLUT
 PURPOSE:
	Use the mouse to control the lower limit and range of the color table.
 CALLING SEQUENCE:
       INTERLUT		; Contrast image interactively 
	INTERLUT,INIT           ; Don't use previously saved color table
 OPTIONAL INPUT:
	INIT - scalar, which if present, tells INTERLUT to contrast the
              currently loaded color lookup table.   Each call to
              INTERLUT reduces the dynamic range of the lookup table.
	       Therefore, one usually tries to use the lookup table
	       which was in effect before the first call to INTERLUT
 OUTPUTS:
	None.
 METHOD:
       INTERLUT calls STRETCH which compresses color table between values
       of LOW and HIGH, which are determined by the cursor position
	Maximum dynamic (LOW = 0, HIGH= 255) is achieved when cursor 
       is at screen center.  Moving cursor away from center in the X 
       direction raises LOW cutoff, moving cursor away from center in 
       Y direction lowers HIGH cut0ff

	Hitting the Left mouse button reverses black and white. 
	Hitting the Right mouse button causes the procedure to exit.
 COMMON BLOCKS:
	Values of the low and high cutoff are saved in
	the common block CONTRST, however LOW and HIGH are always
       reinitialized to 0 and 255.
 SYSTEM VARIABLES:
       Set !QUIET = 1 to not print instructions
 REVISION HISTORY:
	W. B. Landsman, March, 1988
       Converted to use with a workstation/IDLV2.  M. Greason, STX, June 1990.

(See /host/bluemoon/usr2/idllib/uit/pro/interlut.pro)


IRAFDIR

[Previous Routine] [Next Routine] [List of Routines]

 NAME:
     IRAFDIR
 PURPOSE:
     Provide a brief description of the IRAF images on a directory
 CALLING SEQUENCE:
     IRAFDIR                   ;Describe IRAF files on default directory
     IRAFDIR,DIRECTORY         ;Include the directory name
     IRAFDIR,DIRECTORY   ;

OPTIONAL INPUT PARAMETERS:
    DIRECTORY - String giving file name, disk or directory to be searched 

 KEYWORDS:
    TEXTOUT - specifies output device.
		 textout=1	TERMINAL using /more option
		 textout=2	TERMINAL without /more option
		 textout=3	.prt
		 textout=4	laser.tmp
		 textout=5      user must open file
                textout = filename (default extension of .prt)

 OUTPUT PARAMETERS:
     None

 PROCEDURE:
     FINDFILE is used to find all '.imh' files in the directory. 
     The object name and image size (NAXIS1, NAXIS2) are extracted
     from the header. Each header is also searched for the parameters
     DATE-OF-OBS, TELESCOP, EXPTIME.
  
 SYSTEM VARIABLES:
     If 'textout' keyword is not specified to select an output device,
     !TEXTOUT will be the default.

 MODIFICATION HISTORY:
 Written, K. Venkatakrishna, ST Systems Corp, August 1991

(See /host/bluemoon/usr2/idllib/uit/pro/irafdir.pro)


IRAFRD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IRAFRD
 PURPOSE:
	Read an IRAF (OIF) file and read into an IDL image and header arrays.
	Program will prompt for the file name if not supplied.

 CALLING SEQUENCE:
	IRAFRD, im, hdr, filename, [SILENT = , VMSIMG = ]  

 OPTIONAL INPUT:
	FILENAME -  Character string giving the name of the IRAF image 
		header.  If omitted, then program will prompt for the 
		file name.  IRAFRD always assumes the header file has an 
		extension '.imh'.    IRAFRD will automatically locate the
		".pix" file containing the data by parsing the contents of 
		the .imh file.   (If the parse is unsuccesful, then IRAFRD looks
		in the same directory as the .imh file.)
 OUTPUTS:
	IM - array containing image data
	HDR - string array containing header.  Basic information in the
		IRAF header is converted to a FITS style header

 OPTIONAL INPUT KEYWORDS:
	VMSIMG     - UNIX keyword included to indicate that the file
		originated on a VAX.  If VMSIMG ne 0, then byteordering
		appropriate to a vms image will be performed.
	SILENT  - If this keyword is present, the size of the image
		will not be printed.

 SIDE EFFECTS:
	IF FILENAME is not supplied, then the program will check that
	the image and header variable do not already contain data.

 RESTRICTIONS:
	(1)  Image size and history sections of the IRAF header are copied 
		into the FITS header HDR.  Other information (e.g. astrometry)
		might not be included unless it is also in the history section
	(2)  IRAFRD ignores the node name when deciphering the name of the
		IRAF ".pix" file.
	(3)  Certain FITS keywords ( DATATYPE, IRAFNAME) may appear more than
		once in the output name

 PROCEDURE:
	IRAFRD obtains dimensions and type of image from the IRAF header.

 MODIFICATION HISTORY:
	Written W. Landsman, STX January 1989
	Converted to IDL Version 2.  M. Greason, STX, June 1990
	Updated for DecStation compatibility   W. Landsman   March 1992
	Don't leave an open LUN  W. Landsman   July 1993

(See /host/bluemoon/usr2/idllib/uit/pro/irafrd.pro)


IRAFWRT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    IRAFWRT
 PURPOSE:
    Write IDL data in IRAF (OIF) format (.imh and .pix files).
    Does the reverse of IRAFRD.
 CALLING SEQUENCE: 
    IRAFWRT, image, hdr, filename, [ PIXDIR = ]
 INPUTS:
    image - array containing data
    hdr   - The  corresponding FITS header.   Use MKHDR to create a minimal
            FITS header if one does not already exist.
    filename - Scalar string giving the name of the file to be written 
           Should not include the extension name, which will be supplied by 
           IRAFWRT.
 OUTPUTS:
    None
 OPTIONAL KEYWORD INPUT:
    PIXDIR - scalar string specifying the directory into which to write
            the IRAF pixel (.pix) file.   The default is to write the pixel
            file to the same directory as the header (.imh) file
 SIDE EFFECTS:
    Image array and  FITS header are written to IRAF pixel file'filename.pix'
    and header file 'filename.imh'
 EXAMPLE:
    Write an empty 50 x 50 array of all zeros to an IRAF file named 'EMPTY'

    IDL> im = intarr( 50, 50)         ;Create empty array
    IDL> mkhdr, hdr, im               ;Create a minimal FITS header
    IDL> irafwrt, im, hdr, 'empty'    ;Write to a IRAF file named 'empty'
 PROCEDURE:
    IRAFWRT gets information about the data - image dimensions, size, 
    datatype, maximum and minimum pixel values - and writes it into
    the binary part of the header. The ASCII part of the header
    is directly copied after deleting records with certain keywords 
    A pixel file is created, with a header in the first 1024 bytes
 RESTRICTIONS:
     (1) The files are not created by IRAFWRT are not identical to those 
     created by the IRAF routine rfits.    However, the files created by 
     IRAFWRT appear to be compatible with all the IRAF routines tested so far.
     (2)  IRAFWRT has been tested on a limited number of data types
     (3)  IRAFWRT has not been tested on a DecStation.
 MODIFICATION HISTORY:
     Written K. Venkatakrishna, STX February 1992
     VMS compatibility    W. Landsman      April 1992
     Work with headers without DATE-OBS or ORIGIN           August 1992

(See /host/bluemoon/usr2/idllib/uit/pro/irafwrt.pro)


ISARRAY

[Previous Routine] [Next Routine] [List of Routines]
 Name: 
     ISARRAY
 PURPOSE: 
     Determine if arg is an array.
 CALLING SEQUENCE: 
     I = ISARRAY(A)
 Inputs: 
     A = variable to test.
 OUTPUTS: 
     I = function result. 1 if A is an array, else 0.
 MODIFICATION HISTORY: 
    R. Sterner           20 Mar, 1986.

(See /host/bluemoon/usr2/idllib/uit/pro/isarray.pro)


ISOSTR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ISOSTR
 PURPOSE:
    To select isolated stars. 
 CALLING SEQUENCE:
    isostr,x,y,rmax,index
 INPUTS:
    x      - array of star x values 
    y      - array of star y values 
    rmax   - scalar, giving maximum distance between stars of two distinct
             groups.  Stars less than this distance are always in the same
             group.
 OUTPUTS:
    index  - index array for saved stars
 REVISION HISTORY:
    Written by Jesse Hill, ST Ststems Corp., October, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/isostr.pro)


ITT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ITT
 PURPOSE:
	Load or disable an intensity transformation table (ITT).   It is
	usually used to either (1) enhance weak features or (2) reverse
	positive and negative.

 CALLING SEQUENCE:
	ITT, [ type ]

 OPTIONAL INPUT PARAMETERS:
	TYPE - The type of ITT transformation; (0) disable the ITT, (1) linear 
		scale, (2) square root scale, (3) cube root scale, and 
		(4) logarithmic scale.
		A negative number will reverse positive and negative.  If this 
		parameter is omitted, a menu will appear.
 OUTPUT PARAMETERS:
	None.

 COMMON BLOCKS:
	The common block ITTCOM stores the 256 element array used to transform
	the color vectors.

 PROCEDURE:
	The color vectors are multiplied by the intensity transformation table
	and loaded with TVLCT

 MODIFICATION HISTORY:
      Written, W. Landsman, August 1986

(See /host/bluemoon/usr2/idllib/uit/pro/itt.pro)


ITTSTARS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ITTSTARS
 PURPOSE:
	To display on the screen a series of stars of evenly spaced, known,
	magnitudes for comparison to an already-displayed image.
 CALLING SEQUENCE:
	ittstars, hd, sky, skyerr [, arr]
 INPUTS:
	hd        - The header associated with the displayed image.  This
	            parameter must be supplied and must contain a valid 
	            BSCALE and BZERO for the image.
	sky       - The "mean" sky background, in magnitude units.  The
	            SKYUNIT keyword can be used to indicate other units
	            for this parameter.
	skyerr    - The error in the sky background, in magnitude units.  
	            The SKYUNIT keyword can be used to indicate other units
	            for this parameter.
 OPTIONAL OUTPUTS:
	arr       - The array that is displayed, containing the dummy stars
	            and sky.
 KEYWORDS:
	MAGMINMAX - A two-element array containing the minimum and maximum
	            magnitude stars to display.  Defaults to 20. to 10.
	MAGSTEP   - Indicates the difference in magnitude of consequetive
	            stars.  Defaults to 0.5.
	MAGZERO   - Indicates the zero point in the physical unit - 
	            magnitude unit conversion.  Defaults to the UIT value
	            of -21.1.  The conversion:
			mag = -2.5 alog10(flux) + MAGZERO.
	NOSAT     - If present and non-zero, the stars are not limited to
	            a two-byte integer range of value.  In other words, they
	            do not saturate.  See the note in SIDE EFFECTS.
	NOUIT     - If present and non-zero, photon noise is modeled after
	            the Poisson distribution (assuming photon noise is to
	            be folded into the display).
	NUMCOLS   - The number of columns of stars displayed.  Defaults to 5.
	PHOTONNSE - If present and non-zero, photon noise is folded into
	            the dummy stars as they are created.  The UIT variance
	            function will be used to determine this noise unless
	            the NOUIT keyword is set.  NOTE:  the UIT variance function
	            may cause negative saturation (-32768) near the center of
	            the brighter stars.  This is due to the large variances
	            found near the saturation point.  This problem doesn't 
	            appear in the Poisson distribution because the error is
	            derived from the signal and is definely a fraction of 
	            the signal.
	PIXMINMAX - A two-element array containing the minimum and maximum
	            pixel values in the displayed image.  These are used to
	            provide correct scaling.  Defaults to the minimum and 
	            maximum of the dummy stars and the sky.
	PSFWID    - The full-width-half-max of the point spread function,
	            in ARCSECONDS.  Defaults to UIT's of 3. arcseconds.
	SKYUNIT   - If present, this keyword indicates the units of the
	            supplied sky and its error:
			0 = image "e" units (the default),
			1 = physical units (ergs/cm^2/s...),
			2 = magnitudes.
	STARSIZ   - The maximum size of a star in both axes.  This parameter
	            sets the dimensions of the gaussian kernal which is created
	            to emulate the stars.  This parameter must be odd.
	            Defaults to 15. 
	TITLE     - The title of the new graphics window.  Defaults to
	            "ITT Stars"
 SIDE EFFECTS:
	An IDL graphics window is left open on the screen.
 PROCEDURE:
	A model star (or proto-star) is first created.  It is modeled after a
	gaussian, using the PSF full-width-half-max to derive the sigma.  GKER
	is used to do the modeling.

	An array is created and set to the sky background value.  It is then
	randomized by adding in a set of random numbers; these numbers have a
	gaussian distribution about zero and a standard deviation of the error
	in the sky.

	The stars are added to the array.  Each star is built by multiplying
	the proto-star by the total flux to be contained by the star.  The flux
	is determined by converting the magnitude of the star to physical units
	with MAG2FLUX and then converting this flux to image intensity units by
	using the BSCALE parameter extracted from the header.  The sky,
	extracted from the array, is added to the star.  If called for, photon
	noise is then added in, using the same procedure used when adding sky
	noise to the background.  The final star is then inserted into the
	array.

	The array is displayed using CTVSCL.  MINDATA and MAXDATA keywords are
	supplied by this procedure's PIXMINMAX keyword; if not supplied, the
	array is scaled normally.

	Each star is annotated with its magnitude.  A small pixmap is created
	to act as a staging area for the string.  This allows the displayed
	string to consist of a 0 background and full intensity (255) text
	without much effort.  The pixmap is destroyed just before termination
	of the procedure.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 23 October 1992.
	Updated to use ASTROMETRY structures. Joel D. Offenberg, HSTX, Jan 1993

(See /host/bluemoon/usr2/idllib/uit/pro/ittstars.pro)


IUEAPER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IUEAPER
 PURPOSE:
	Measures flux in an anatomically correct IUE large aperture 
	as projected on 'image'; centered at ra,dec 
	with long axis position angle 'pos_ang' from north
	and draws the aperture outline on the image (if no /NODRAW) 

 CALLING SEQUENCE:
      	IUEAPER, image, hdr, ra, dec, pos_ang, flux, [/NODRAW] 
 INPUTS:
	IMAGE  -  input image array
	HDR    -  FITS image header (string array) 
	RA,DEC - center position for aperture (degrees, same as hdr) 
	POS_ANG     -  position angle of long axis, measured N to E in degrees

 KEYWORDS:
	NODRAW - if set, doesn't draw the aperture on the image

	Any valid keyword to the PLOTS command can also be passed to IUEAPER 
	e.g. set COLOR or THICK to modify the color or thickness of the 
	drawn aperture.

 OUTPUTS:
	FLUX - Flux in IUE aperture in ergs/(cm**2 sec A)
		prints out E-unit flux and the area correction factor too

 REVISON HISTORY:
	Written, B. Cornett May 1991
	Scaling of final E-unit total in accord with current MOUSSE
	conventions (spatial scaling assumed already in BSCALE).
	Drawing of aperture now rounds with NINT.  Size of aperture
	empirically adjusted to put area factor within ~1% of 1.0
	for several pixel sizes.  R. S. Hill, Hughes STX, 8 April 1993

(See /host/bluemoon/usr2/idllib/uit/pro/iueaper.pro)


JDCNV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       JDCNV
 PURPOSE:
       Converts Gregorian dates to Julian days   
 CALLING SEQUENCE:
       JDCNV,YR,MN,DAY,HR,JULIAN
 INPUTS:
       YR = Year (integer)  
       MN = Month (integer 1-12)
       DAY = Day  (integer 1-31) 
       HR  = Hours and fractions of hours of universal time (U.T.)
 OUTPUTS:
       JULIAN = Julian date (double precision) 
 EXAMPLE:
       To find the Julian Date at 1978 January 1, 0h (U.T.)
       JDCNV,1978,1,1,0.,JULIAN
       will give JULIAN = 2443509.5
 NOTES:
       (1) JDCNV will accept vector arguments 
       (2) JULDATE is an alternate procedure to perform the same function
 REVISON HISTORY:
       Converted to IDL from Don Yeomans Comet Ephemeris Generator,
       B. Pfarr, STX, 6/15/88

(See /host/bluemoon/usr2/idllib/uit/pro/jdcnv.pro)


JPRECESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	JPRECESS
 PURPOSE:
	Calculate the mean place of a star at J2000.0 on the FK5 system from the
	mean place at B1950.0 on the FK4 system.

 CALLING SEQUENCE:
	jprecess, ra, dec, ra_2000, dec_2000, [ MU_RADEC = , PARALLAX = 
		RAD_VEL =  ]

 INPUTS:
	RA,DEC - input B1950 right ascension and declination in *degrees*.
		Scalar or vector

 OUTPUTS:
	RA_2000, DEC_2000 - the corresponding J2000 right ascension and 
		declination in *degrees*.   Same number of elements as RA,DEC
		but always double precision. 

 OPTIONAL INPUT-OUTPUT KEYWORDS
	MU_RADEC - 2xN element double precision vector containing the proper 
		   motion in seconds of arc per tropical *century* in right 
		   ascension and declination.
	PARALLAX - N_element vector giving stellar parallax (seconds of arc)
	RAD_VEL  - N_element vector giving radial velocity in km/s

	The values of MU_RADEC, PARALLAX, and RADVEL will all be modified
	upon output to contain the values of these quantities in the
	J2000 system.    Values will also be converted to double precision.  
	The parallax and radial velocity will have a very minor influence on 
	the J2000 position.

  NOTES:
	The algorithm is taken from the Astronomical Almanac 1990, page B42.
	Also see Aoki et al (1983), A&A, 128,263

	The error in using the IDL procedure PRECESS for converting between
	B1950 and J2000 can be up to 1.5", mainly in right ascension.   If
	better accuracy than this is needed then JPRECESS should be used.

 EXAMPLE:
	The SAO catalogue gives the B1950 position and proper motion for the 
	star HD 119288.   Find the J2000 position. 

	   RA(1950) = 13h 39m 44.526s      Dec(1950) = 8d 38' 28.63''  
	   Mu(RA) = -.0259 s/yr      Mu(Dec) = -.093 ''/yr

	IDL> mu_radec = 100D* [ -15D*.0259, -0.093 ]
	IDL> ra = ten(13,39,44.526)*15.D 
	IDL> dec = ten(8,38,28.63)
	IDL> jprecess, ra, dec, ra2000, dec2000, mu_radec = mu_radec
	IDL> print, adstring(ra2000, dec2000,2)
		===> 13h 42m 12.740s    +08d 23' 17.69"

 RESTRICTIONS:
	"When transferring individual observations, as opposed to catalog mean
	place, the safest method is to tranform the observations back to the
	epoch of the observation, on the FK4 system (or in the system that was
	used to to produce the observed mean place), convert to the FK5 system,
	and transform to the the epoch and equinox of J2000.0" -- from the
	Explanatory Supplement (1992), p. 180

 REVISION HISTORY:
	Written,    W. Landsman                September, 1992
	Corrected a couple of typos in M matrix   October, 1992
	Vectorized, W. Landsman                   February, 1994

(See /host/bluemoon/usr2/idllib/uit/pro/jprecess.pro)


JULDATE

[Previous Routine] [Next Routine] [List of Routines]
  NAME:
    JULDATE
  PURPOSE:                                   
    Convert from calender to Reduced Julian Date
  CALLING SEQUENCE:
    JULDATE, /PROMPT           ;Prompt for Calender Date, print Julian Date
    JULDATE, date, jd      
  INPUT:
    DATE - 5-element array containing year,month (1-12),day,hour & minute
           all specified as numbers (Universal Time). Year after 1900
           can be specified 2 ways, either for example, as 83 or 1983.
           Years B.C should be entered as negative numbers.  If Hour or
           Minute are not supplied, they will default to 0. 
  OUTPUT:
    JD - reduced julian date, double precision scalar.  To convert to
         Julian Date, add 2400000.   JULDATE will print the value of
         JD at the terminal if less than 2 parameters are supplied, or if 
         the /PROMPT keyword is set
      
  OPTIONAL INPUT KEYWORD:
    PROMPT - If this keyword is set and non-zero, then JULDATE will prompt
             for the calender date at the terminal.
  RESTRICTIONS:
     Will not work for years between 0 and 99 A.D.  (since these are
     interpreted as years 1900 - 1999).  Will not work for year 1582.

     The procedure HELIO_JD can be used after JULDATE, if a heliocentric
     Julian date is required.
  EXAMPLE:
     A date of 25-DEC-1981 06:25 UT may be expressed as either

     IDL> juldate, [81,12,25,6,25], jd       
     IDL> juldate, [1981,12,25.2673611], jd 

     In either case, one should obtain a reduced julian date of 
     JD = 44963.7673611
  REVISION HISTORY
    Adapted from IUE RDAF (S. Parsons)                      8-31-87
    Algorithm from Sky and Telescope April 1981   
    Added /PROMPT keyword, W. Landsman    September 1992

(See /host/bluemoon/usr2/idllib/uit/pro/juldate.pro)


KURUCZ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	KURUCZ
 PURPOSE:
	Generates fluxes for the 1991 Kurucz stellar models 
	The calling sequence to this version of KURUCZ differs from that in 
	the IUE RDAF.

 CALLING SEQUENCE:
	KURUCZ, WAVE, FLAM, [ Teff, Logg, LogZ, /OLD ]

 OPTIONAL INPUTS:
	WAVE - Wavelength vector (Angstroms).  Kurucz model fluxes will
		be quadratically interpolated onto the supplied wavelength 
		grid.  If WAVE is not supplied, then WAVE will be returned as 
		the 1221 element wavelength vector supplied in the Kurucz
		models.
	Te - Model Effective Temperature, scalar (between 3500 - 50000)
	Logg - Logarithm Surface Gravity, scalar, (valid range 0.0 - 5.0)
	LogZ - Logarithm metal abundance relative to solar, always one of the
		sixteen values +1.0,+0.5,+0.3,+0.2,+0.1,+0.0,-0.1,-0.2,-0.3,
		-0.5,-1.0,-1.5,-2.0,-2.5,-3.0,or -3.5.
		User will be prompted for Te, Logg, and LogZ if not supplied.

 KEYWORD INPUT:
	OLD  - If the keyword is selected, the procedure will call up the
		the old 1979 Kurucz models
	  
 OUTPUTS:
	WAVE - Wavelength array (Angstroms)
	FLAM - (F Lambda) Flux (ergs/cm2/s/A).  To convert to flux at Earth, 
		multiply by !PI*(R/d)^2  where R is the stellar radius, and d 
		is the stellar distance.  FLAM will have the same number of 
		elements as WAVE
 NOTES:
	KURUCZ will not interpolate between model temperatures: the user
	must supply the exact Teff, LOGg and LogZ of an actual model. 

	Because so many models are now available, KURUCZ will no longer display
	the range of available models
 COMPARISON WITH KURUCZ 1979:
	The new models have up to 1221 wave/flux points model and are available
	with sixteen metallicities.   There is also an improvement in the 
	treatment of opacity.

 EXAMPLES:
	KURUCZ,W,F                ;user is prompted for input parameters
	W = 1000 + INDGEN(100)*10 ;Create a wavelength array between
       	                        1000 and 2000 A
	KURUCZ,W,F,7000,4.5,-2    ;user is not prompted unless KURUCZ
               		;can't find model with supplied params.
				;Fluxes are quadratically interpolated
                              ;onto the supplied wavelength grid.

 REVISION HISTORY:
	OLD_KURUCZ:
        10-31-86 J. Hill & B. Boothman:Adapted from the RDAF for UIT.
	KURUCZ (1991):
	  6-21-91 J.D Offenberg		Re-configured for 1991 models.
					Model searching routine altered.

(See /host/bluemoon/usr2/idllib/uit/pro/kurucz.pro)


KURUCZ_LYC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	KURUCZ_LYC
 PURPOSE:
	Quickly return the total number of Lyman continuum photons for a 
	Kurucz model flux of specified temperature, gravity, and metallicity.
	This program is designed for speed, since it is called many times
	during evaluation of a star cluster evolution model.

 CALLING SEQUENCE:
	KURUCZ_LYC, LYC, Te, g, log_z

 INPUTS:
	Te - effective temperature, scalar.  A blackbody flux value is returned
		for Te > 50000.     The Kurucz models are interpolated in
		temperature if Te does not correspond to an available model
	g -  Log of the surface gravity (cm/s^2).  KURUCZ_LYC selects the 
		Kurucz model with the closest value of g, and does not 
		interpolate.     
	logZ - Log metal abundance relative to solar, always one of the
		nineteen values +1.0,+0.5,+0.3,+0.2,+0.1,+0.0,-0.1,-0.2,-0.3,
		-0.5,-1.0,-1.5,-2.0,-2.5,-3.0,-3.5,-4.0,-4.5,-5.0
 OUTPUTS:
	LYC -  Number of Lyman continum photons per cm^2 per second, scalar
		To find the number of lyman continuum photons observed at Earth
		multiply by R^2/d^2 where R is the stellar radius and d is the
		stellar distance.   
 COMMON BLOCKS:
	On the first call to KURUCZ_LYC, or if LOG_Z has changed from the 
	previous call, KURUCZ_LYC is initialized by identifying the KURUCZ 
	models with the specified metallicity and storing the data in the 
	common block KURUCZ.  
 REVISION HISTORY:
	Written        W. Landsman           January, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/kurucz_lyc.pro)


KURUCZ_LYC_1979

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   KURUCZ_LYC_1979
 PURPOSE:
   Quickly obtain the number of Lyman continuum photons from a KURUCZ
   (1979) model interpolated in termperature.
 CALLING SEQUENCE:
   kurucz_lyc_1979, lyc, te, g, log_z
 INPUTS:
   Te - effective temperature, scalar.  The number of Lyc photons is 
        assumed to be zero for Te < 5500.  A blackbody flux is returned 
        for Te > 50000.
   g -  Log of the surface gravity (cm/s^2).  KURUCZ_LYC_1979 selects the 
        Kurucz model with the closest value of g, and does not interpolate. 
 OUTPUTS:
   LYC - Number of Lyman continuum photons, scalar
 COMMON BLOCKS:
   The parameters and continuum fluxes in the KURUCZ models are stored
   in the common block KURUCZ_LYC_1979
 REVISION HISTORY:
   Written        W. Landsman               November 1989

(See /host/bluemoon/usr2/idllib/uit/pro/kurucz_lyc_1979.pro)


KUR_INT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     KUR_INT
 PURPOSE:
     Quickly obtain a (1993) Kurucz model flux interpolated in temperature.
     These program is designed for speed, since it is called many times
     during evaluation of a star cluster evolution model.

 CALLING SEQUENCE:
    KUR_INT, W, F, Te, g, log_z, [ W_INDEX = ]

 INPUTS:
     W -  Wavelength(s) (A) at which to evaluate model fluxes, scalar or 
          vector.          This parameter is ignored if the W_INDEX keyword
          is supplied
     Te - effective temperature, scalar.  A blackbody flux value is returned
          for Te < 5500 or for Te > 50000.
     g -  Log of the surface gravity (cm/s^2).  KUR_INT selects the Kurucz 
          model with the closest value of g, and does not interpolate.     
     LogZ - Logarithm metal abundance relative to solar, always one of the
         sixteen values +1.0,+0.5,+0.3,+0.2,+0.1,+0.0,-0.1,-0.2,-0.3,-0.5,
         -1.0,-1.5,-2.0,-2.5,-3.0,or -3.5.

 OUTPUTS:
     F -  Model flux, same number of elements as W.

 OPTIONAL KEYWORD INPUT:
     W_INDEX - Vector specifying the indicies of the Kurucz wavelength grid
          to return.    This keyword is used when speed is required
          as it avoids interpolation onto a separate wavelength grid.
          The procedure GET_KUR_WAVE can be used to obtain the Kurucz
          wavelength grid.

 COMMON BLOCKS:
   On the first call to KUR_INT, or if LOG_Z has changed from the previous
   then KUR_INT is initialized by identifying the KURUCZ models with the
   specified metallicity and storing the data in the common block KURUCZ  

 REVISION HISTORY:
   Written        W. Landsman           January, 1990
   Planck function call fixed for w_index.  RSH, HSTX, 30-Nov-1993

(See /host/bluemoon/usr2/idllib/uit/pro/kur_int.pro)


KUR_INT_1979

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	KUR_INT_1979
 PURPOSE:
	Quickly obtain a (1979) Kurucz model flux interpolated in temperature.
	This program is designed for speed, since it is called many times
	during evaluation of a star cluster evolution model.

 CALLING SEQUENCE:
	KUR_INT_1979, W, F, Te, g, log_z

 INPUTS:
	W -  Wavelength(s) (A) at which to evaluate model fluxes, scalar or 
		vector 
	Te - effective temperature, scalar.  A blackbody flux value is returned
		for Te < 5500 or for Te > 50000.
	g -  Log of the surface gravity (cm/s^2).  KUR_INT selects the Kurucz 
		model with the closest value of g, and does not interpolate.
	log_z - log of the metal abundance relative to solar 0,-1, or -2

 OUTPUTS:
	F -  Model flux, same number of elements as W.

 COMMON BLOCKS:
	On the first call to KUR_INT_1979, or if LOG_Z has changed from the 
	previous call, KUR_INT_1979 is initialized by identifying the 
	KURUCZ models with the specified metallicity and storing the data 
	in the common block KURUCZ  

 REVISION HISTORY:
	Written        W. Landsman           January, 1990

(See /host/bluemoon/usr2/idllib/uit/pro/kur_int_1979.pro)


LEGEND

[Previous Routine] [Next Routine] [List of Routines]
 Name:
      	LEGEND 
 Purpose:
	This procedure makes a legend for a plot.  The legend can contain
	a mixture of symbols, linestyles, Hershey characters (vectorfont),
	and filled polygons (usersym).
 Examples:
	The call:
		legend,['diamond','asterisk','square'],psym=[4,2,6]
	produces:
		-----------------
		|		|
		|  <> diamond	|
		|  *  asterisk	|
		|  [] square	|
		|		|
		-----------------
	Each symbol is drawn with a plots command, so they look OK.
	Other examples are given in usage.
 Usage:
	legend,items,linestyle=linestyle	; vertical legend at upper left
	legend,items,psym=psym			; ditto except using symbols
	legend,items,psym=psym,/horizontal	; horizontal format
	legend,items,psym=psym,box=0		; sans border
	legend,items,psym=psym,delimiter='='	; embed an '=' betw psym & text
	legend,items,psym=psym,margin=2		; 2-character margin
	legend,items,psym=psym,position=pos	; position of legend
	legend,items,psym=psym,number=2		; plot two symbols, not one
	legend,items,/fill,psym=[8,8,8],colors=[10,20,30]; 3 filled squares
 Inputs:
	items = text for the items in the legend, a string array.
		You can omit items if you don't want any text labels.
		For example, items = ['diamond','asterisk','square'].
 Optional Inputs:
	linestyle = array of linestyle numbers  If linestyle(i) < 0, then omit 
		ith symbol or line to allow a multi-line entry.
	psym = array of plot symbol numbers.  If psym(i) is negative, then a
		line connects pts for ith item.  If psym(i) = 8, then the
		procedure usersym is called with vertices define in the 
		keyword usersym.
	N. B.: Choose either linestyle, psym, neither, or both.  If neither is
		present, only the text is output.  If both linestyle and
		psym parameters are present, they both have to have the
		same number of elements, and normal plot behaviour occurs.
		By default, if psym is positive, you get one point so there is
		no connecting line.
	vectorfont = vector-drawn characters for the sym/line column, e.g.,
		['!9B!3','!9C!3','!9D!3'] produces an open square, a checkmark,
		and a partial derivative, which might have accompanying items
		['BOX','CHECK','PARTIAL DERIVATIVE'].  If vectorfont(i) = '',
		then plots is called to make a symbol or a line, but if
		vectorfont(i) is a non-null string, then xyouts is called.
		There is no check that !p.font is set properly, e.g., -1 for
		X and 0 for PostScript.  This can produce an error, e.g., use
		!20 with PostScript and !p.font=0, but allows use of Hershey
		*AND* PostScript fonts together.
 Optional Keywords:
	/help = flag to print header
	/horizontal = flag to make the legend horizontal
	/vertical = flag to make the legend vertical (D=vertical)
	box = flag to include/omit box around the legend (D=include)
	delimiter = embedded character(s) between symbol and text (D=none)
	colors = array of colors for plot symbols/lines (D=!color)
	textcolors = array of colors for text (D=!color)
	margin = margin around text measured in characters and lines
	spacing = line spacing (D=bit more than character height)
	pspacing = psym spacing (D=3 characters)
	charsize = just like !p.charsize for plot labels
	position = normalized coordinates of the upper left of the legend
	number = number of plot symbols to plot or length of line (D=1)
	usersym = 2-D array of vertices, cf. usersym in IDL manual. (D=square)
	/fill = flag to fill the usersym
 Outputs:
	legend to current plot device
 Optional Output Keywords:
	corners = 4-element array, like !p.position, of the normalized
	  coords for the box (even if box=0): [llx,lly,urx,ury].
	  Useful for multi-column or multi-line legends, for example,
	  to make a 2-column legend, you might do the following:
	    c1_items = ['diamond','asterisk','square']
	    c1_psym = [4,2,6]
	    c2_items = ['solid','dashed','dotted']
	    c2_line = [0,2,1]
	    legend,c1_items,psym=c1_psym,corners=c1,box=0
	    legend,c2_items,line=c2_line,corners=c2,box=0,pos=[c1(2),c1(3)]
	    c = [c1(0)c2(2),c1(3)>c2(3)]
	    plots,[c(0),c(0),c(2),c(2),c(0)],[c(1),c(3),c(3),c(1),c(1)],/norm
	  Useful also to place the legend.  Here's an automatic way to place
	  the legend in the lower right corner.  The difficulty is that the
	  legend's width is unknown until it's is plotted.  In this example,
	  the legend is plotted twice: the first time in the upper left, the
	  second time in the lower right.
	    legend,['1','22','333','4444'],linestyle=indgen(4),corners=corners
			; BOGUS LEGEND---FIRST TIME TO REPORT CORNERS
	    xydims = [corners(2)-corners(0),corners(3)-corners(1)]
			; SAVE WIDTH AND HEIGHT
	    chdim=[!d.x_ch_size/float(!d.x_size),!d.y_ch_size/float(!d.y_size)]
			; DIMENSIONS OF ONE CHARACTER IN NORMALIZED COORDS
	    pos = [!x.window(1)-chdim(0)-xydims(0) $
			,!y.window(0)+chdim(1)+xydims(1)]
			; CALCULATE POSITION FOR LOWER RIGHT
	    plot,findgen(10)	; SIMPLE PLOT; YOU DO WHATEVER YOU WANT HERE.
	    legend,['1','22','333','4444'],linestyle=indgen(4),pos=pos
			; REDO THE LEGEND IN LOWER RIGHT CORNER
	  You can modify the pos calculation to place the legend where you
	  want.  For example to place it in the upper right:
	    pos = [!x.window(1)-chdim(0)-xydims(0),!y.window(1)-xydims(1)]
 Common blocks:
	none
 Procedure:
	If keyword help is set, call doc_library to print header.
	See notes in the code.
 Restrictions:
	Here are some things that aren't implemented.
	- It would be nice to allow data and device coords as well.
	- An orientation keyword would allow lines at angles in the legend.
	- An array of usersyms would be nice---simple change.
	- An order option to interchange symbols and text might be nice.
	- Somebody might like double boxes, e.g., with box = 2.
	- Another feature might be a continuous bar with ticks and text.
	- There are no guards to avoid writing outside the plot area.
	- There is no provision for multi-line text, e.g., '1st line!c2nd line'
	  Sensing !c would be easy, but !c isn't implemented for PostScript.
	  A better way might be to simply output the 2nd line as another item
	  but without any accompanying symbol or linestyle.  A flag to omit
	  the symbol and linestyle is linestyle(i) = -1.
 Side Effects:
 Modification history:
	write, 24-25 Aug 92, F K Knight (knight@ll.mit.edu)
	allow omission of items or omission of both psym and linestyle, add 
	  corners keyword to facilitate multi-column legends, improve place-
	  ment of symbols and text, add guards for unequal size, 26 Aug 92, FKK
	add linestyle(i)=-1 to suppress a single symbol/line, 27 Aug 92, FKK
	add keyword vectorfont to allow characters in the sym/line column,
	  28 Aug 92, FKK
	Removed default Usersym defintion  W. Landsman  HSTX   July, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/legend.pro)


LEGENDTEST

[Previous Routine] [Next Routine] [List of Routines]
 Name:
	legendtest
 Purpose:
	Test the legend procedure.
 Usage:
	.run legendtest
 Inputs:
	none
 Optional Inputs:
	none
 Keywords:
	none
 Outputs:
	legends of note
 Common blocks:
	none
 Procedure:
 Side Effects:
	Sets !20 font to symbol if PostScript and !p.font=0.
 Restrictions:
	With the vectorfont test, you'll get different results for PostScript
	depending on the value of !p.font.
 Modification history:
	write, 27 Aug 92, F.K.Knight (knight@ll.mit.edu)

(See /host/bluemoon/usr2/idllib/uit/pro/legendtest.pro)


LINFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    LINFIT 
 PURPOSE:
    To make a least squares fit to data with a straight line:   
    Y = A + B*X  (IDL version of Bevington's LINFIT program)
    
 CALLING SEQUENCE: 
    LINFIT, X, Y, WT, A, B, SI
 INPUT PARAMETERS:

    X -  vector containing the independent variable data
    Y - vector containing the dependent variable data
    WT - vector containing the weighting function data
         as described by Bevington (p.104).   If uniform weighting is 
         desired, set WT = 1. For instrumental uncertainties, use
         WT=1/sigmay^2.
 OUTPUT PARAMETERS
    A -  Required output scalar containing the y-intercept for the least
         squares fit.
    B  - Output scalar containing the slope of the least squares
         line.
 OPTIONAL OUTPUT PARAMETER:
    SI - vector containing statistical information on the
         fit. 
         SI(0)= correlation coefficient (R) where 1. is a perfect fit
                & 0. represents no correlation (see STATISTICAL TREATMENT
                OF EXPERIMENTAL DATA by Young p.130)
         SI(1)= 1 sigma error of coefficient A (SIGMAA)
         SI(2)= 1 sigma error of coefficient B (SIGMAB) 
         SI(3)= mean value of Y array
         if no weighting is specified the following are included:
         SI(4)= scatter about mean (SQRT( TOTAL((Y-YAVG)^2)/N-1 ))
         SI(5)= scatter about fit (SQRT( TOTAL((Y-(A+BX))^2)/N-2 ))
 EXAMPLES:

    To fit measurements of equivalent width (EQW) to a linear function
    of time with uniform weighting of the individual points:

    IDL> wt=0.*time+1.0 
    IDL> linfit,time,eqw,wt,a,b,si    
    IDL> yfit = b*time+a 
    IDL> plot,time,eqw, psym = 4
    IDL> oplot,time,yfit    

 NOTES:
    Least squares (for further infomation see DATA REDUCTION
    AND ERROR ANALYSIS FOR THE PHYSICAL SCIENCES by Bevington
    pp. 92-118).
    Modifications were made (9-25-84 RWT) which makes the procedure
    differ slightly from Bevington's. Instead of fitting the
    expression
           Y = A + B*X,
    LINFIT calculates
          Y = a + b*(x-)
    where  = TOTAL(X*WT)/TOTAL(WT). LINFIT converts back to the
    original expression using the equations:
          A = a - b*
          B = b
          SIGMAA = SQRT(SIGMAa^2 + SIGMAb^2*^2)
          SIGMAB = SIGMAb
*MODIFICATION HISTORY: 
    Adapted from the IUE RDAF          December, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/linfit.pro)


LINTERP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:   
	LINTERP  
 PURPOSE: 
	Linearly interpolate tabulated data from one data grid to another.
	Use QUADTERP for quadratic interpolation.

 CALLING SEQUENCE:
	LINTERP, Xtab, Ytab, Xint, Yint, [MISSING = ]   

 INPUT PARAMETERS: 
	Xtab -  Vector containing the current independent variable grid.
		Must be monotonic increasing or decreasing
	Ytab -  Vector containing the current dependent variable values at 
		the XTAB grid points.
	Xint -  Scalar or vector containing the new independent variable grid 
		points for which interpolated value(s) of the dependent 
		variable are sought.

 OUTPUT PARAMETERS:
	Yint  -  Scalar or vector with the interpolated value(s) of the 
		dependent variable at the XINT grid points.
		YINT is double precision if XTAB or YTAB are double,
		otherwise YINT is REAL*4

 OPTIONAL INPUT KEYWORD:
	MISSING - Scalar specifying YINT value(s) to be assigned, when Xint
		value(s) are outside of the range of Xtab.     Default is to
		truncate the out of range YINT value(s) to the nearest value 
		of YTAB.   See the help for the INTERPOLATE function.

 EXAMPLE:
	To linearly interpolate from an IUE spectrum wavelength grid
	WAVE, FLUX to another grid defined as:
	WGRID = [1540., 1541., 1542., 1543., 1544, 1545.]
   
	IDL>  LINTERP, WAVE, FLUX, WGRID, FGRID  

	FGRID will be a 6 element vector containing the values of FLUX 
	linearly interpolated onto the WGRID wavelength scale

 PROCEDURE: 
	Uses TABINV to calculate the effective index of the values
	in Xint in the table Xtab.  The resulting index is used
	with the intrinsic INTERPOLATE function to find the corresponding 
	Yint value in Ytab.  Unless the MISSING keyword is supplied, out
	of range Yint values are truncated to the nearest value of Ytab.

 NOTES:
	Users with IDL versions before V2.2.2 need to replace the call to
	INTERPOLATE with the commented lines at the end of the procedure

 PROCEDURES CALLED:
	TABINV, ZPARCHECK
 MODIFICATION HISTORY:
	Adapted from the IUE RDAF,  W. Landsman      October, 1988
	Modified to use the new INTERPOLATE function        June, 1992
	Modified to always return REAL*4             October, 1992
	Added MISSING keyword                        August, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/linterp.pro)


LINTERPOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    LINTERPOL
 PURPOSE:
    Interpolate in the log as a function of the log.
 CALLING SEQUENCE:
    ygrid = linterpol(yfiducial,xfiducial,xgrid)
 INPUT PARAMETERS:
    yfiducial, xfiducial = arrays of ordinate and abscissa values defining
                           the known function
    xgrid = array of abscissa values at which to interpolate
 OUTPUT PARAMETERS:
    ygrid = array of interpolated ordinate values
 COMMON BLOCKS:  none
 SIDE EFFECTS:   none
 PROCEDURE:   Calls function interpol
 MODIFICATION HISTORY:
    Written by R. S. Hill, Hughes STX, 3-Aug-88

(See /host/bluemoon/usr2/idllib/uit/pro/linterpol.pro)


LOG_G

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LOG_G
 PURPOSE:
	Use Stefan's law to return the log of the surface gravity of a star 
	given its mass, effective temperature, and bolometric luminosity.

 CALLING SEQUENCE:
	log_g, g, m, logTeff, lbol

 INPUTS:
	m - mass in units of solar masses, non-negative scalar or vector
	logTeff - log effective temperature (degrees K), scalar or vector
	lbol - log of ratio of star's bolometric luminosity to the
		solar bolometric luminosity
 OUTPUTS:
	g - log surface gravity (cm / s^2)

 EXAMPLE:
	Obtain the solar gravity (m=1, logteff=alog10(5770) = 3.761,lbol = 0)
	==> IDL> log_g,g,1,3.761,0   ==> g = 4.44 

 METHOD:
	Stefan's law (lbol = 4*!pi*(R^2)*sigma*(Teff^4) ) is combined with
	the gravitation law ( g = G*m/R^2)) to relate the gravity g to the
	luminosity lbol, effective temperature Teff, and mass m.

 REVISION HISTORY:
	Written      W. Landsman      STX           August, 1988
	Rewrote using logarithm notation            January, 1993

(See /host/bluemoon/usr2/idllib/uit/pro/log_g.pro)


LOOK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	LOOK
 PURPOSE:
	To allow the user to determine visibilities of a target (or targets)
	through an easy-to-use widget interface.
 CALLING SEQUENCE:
	look [, mtlfil]
 INPUTS:
	mtlfil  - The name of a file containing a list of targets.  This list
	          is used to create a "list" widget, which may be used to
	          select targets with the mouse.  If not present, the "list"
	          widget is not used.
 KEYWORDS:
	TIM_RES - The time resolution of the search, in hours.  Defaults to
	          15 seconds.  Note:  going much finer will result in 
	          arithmetic errors.
 COMMON BLOCKS:
	look_comm     - Contains information that needs to be shared throughout
	                the program:
				fnt - The font to use in displayed text.
	look_save_com - This common block allows the event handler to save
	                information from one call to another.  This common
	                block is not intended for other procedures to make
	                use of; it is purely intended to provide static
	                storage for "look_event".
	look_widg_com - This common block permits transfer of data from
	                the "look" procedure to its event handler.
	rep_orb_comm  - Maintains a count of the number of times the 
	                REPORT_ORBIT procedure has been called.  The first time
	                it is called, its widgets are realized and registered.
 RESTRICTIONS:
	Widget support is mandatory.
 PROCEDURE:
	A menu is created and used to issue commands.  An event handler 
	(look_event) processes these commands (and is located in this file).

	WARNING:  Results of a scan over a range of times are NOT automatically
	written to a file.  If such a save is desired, it is necessary to 
	issue the command before exiting or processing another target/time 
	range.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, Hughes STX, 25 November 1992.

(See /host/bluemoon/usr2/idllib/uit/pro/look.pro)


M83

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   M83
 CALLING SEQUENCE:
   M83,M83
 PURPOSE
   Quickly display an image of M83 on the current image plane
 OUTPUT PARAMETERS:
   M83 - 512 x 512 byte image array of M83
 MODIFICATION HISTORY
   Adapted for SUN Workstation IDL Version 2, J. Isensee, Sept., 1990
   Included VAX and SUN paths for M83vis.dat, N. Collins, Nov., 1990

(See /host/bluemoon/usr2/idllib/uit/pro/m83.pro)


MAEDER_INIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME
	MAEDER_INIT
 PURPOSE:
	Initialize the MAEDER common block, using the evolutionary models
	of Schaller et al. (1992) and Schaerer et al. (1993)

 CALLING SEQEUNCE:
	MAEDER_INIT, [ Z_evol, Mdot ]

 OPTIONAL INPUT:
	Z_Evol - scalar giving metal abundance to compute Maeder evolution 
		models with.   Must be 0.001, 0.008, 0.004, 0.02 or 0.04.  
		If not supplied than Z_evol = 0.02 (solar metalicity) is 
		assumed.

       Mdot - scalar either 1 (default) or 2.   If Mdot = 2 then  
		MAEDER_INIT returns the models with the double the mass loss 
		rate of the deJager parameterization when the winds are 
		believed to be driven by radiation pressure (main-sequence + 
		Wolf-Rayet phases)
		
  METHOD:
	The appropiate models are extracted from the IDL database MAEDER.
	The stellar parameters for each model are then stored in
	the common block MAEDER.   This avoids having to read the database
	repeatedly.

 REVISION HISTORY:
	Written      W. Landsman           May, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/maeder_init.pro)


MAEDER_INIT_OLD

[Previous Routine] [Next Routine] [List of Routines]
  NAME
	MAEDER_INIT_OLD
  PURPOSE:
	Initialize the MAEDER common block using the OLDMAEDER database.

  CALLING SEQEUNCE:
	MAEDER_INIT_OLD, [ Z_evol ]

  OPTIONAL INPUT:
	Z_Evol - scalar giving metal abundance to compute Maeder (1990) 
		evolution models with.   Must be 0.002, 0.005, 0.02, or 0.04.
		If not supplied than Z_evol = 0.02 (solar metalicity) is 
		assumed.
  METHOD:
	The appropiate models are extracted from the IDL databases OLDMAEDER and
	OLDMAEDER_Z.   The stellar parameters for each model are then stored in
	the common block MAEDER.   This avoids having to read the database
	repeatedly.

  REVISION HISTORY:
	Written      W. Landsman           May, 1991

(See /host/bluemoon/usr2/idllib/uit/pro/maeder_init_old.pro)


MAG2FLUX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MAG2FLUX
 PURPOSE:
	Convert from magnitudes to flux (ergs/s/cm^2/A).  Use FLUX2MAG for
	the opposite direction.

 CALLING SEQUENCE:
	flux = mag2flux( mag, [ zero_pt ] )

 INPUTS:
	mag - scalar or vector of magnitudes

 OPTIONAL INPUT:
	zero_pt - scalar giving the zero point level of the magnitude.
		If not supplied then zero_pt = 21.1 (Code et al 1976)

 OUTPUT:
	flux - scalar or vector flux vector (flux = 10^(-0.4*(mag + zero_pt))

 REVISION HISTORY:
	Written    J. Hill        STX Co.       1988

(See /host/bluemoon/usr2/idllib/uit/pro/mag2flux.pro)


MAG2PHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MAG2PHOT
 PURPOSE:
	Extracts objects from a UITPHOT table, selecting those with
	magnitudes between an interactively specified range.

	This is a SHOWPHOT procedure.
 CALLING SEQUENCE:
	flg = mag2phot([sel, WIDTH=wdth, SILENT=slnt, TXTWDGT=outtext,
		BASWDGT=baswdgt,] INSWDGT=instext)
	sel       - A structure array containing position/magnitude information
	            for the selected stars.  Each element contains:
			XI     - The x coordinate of the star in the image.
			YI     - The y coordinate of the star in the image.
			XT     - The x coordinate of the star in the table.
			YT     - The y coordinate of the star in the table.
			RA     - The right ascension of the star, in degrees.
			DEC    - The declination of the star, in degrees.
			EQNX   - The equinix of the celestial coordinates.
			MAG1   - The first aperture magnitude of the star.
			ERR1   - The first aperture magnitude error.
			MAG2   - The second aperture magnitude of the star.
			ERR2   - The second aperture magnitude error.
			MAG3   - The third aperture magnitude of the star.
			ERR3   - The third aperture magnitude error.
			MAGPSF - The PSF magnitude of the star.