Astronomy User's 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:14:28 2000.

List of Routines


Routine Descriptions

ABSCAL

[Next Routine] [List of Routines]
 NAME:
       ABSCAL
 PURPOSE:
       Apply the FITS BZERO and BSCALE keyword values to a data array

 CALLING SEQUENCE:
       RESULT = ABSCAL( Value, Header, /DEBUG)

 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.

 OPTIONAL INPUT KEYWORD:
       /DEBUG - If DEBUG is set, then ABSCAL will print the
               calibration units given by the BUNIT keyword.

 REVISION HISTORY:
       Written W. Landsman, STX Corporation     January 1987
       Use DEBUG keyword instead of !DEBUG      September 1995
       Converted to IDL V5.0   W. Landsman   September 1997

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


AD2XY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     AD2XY
 PURPOSE:
     Compute X and Y from  RA and DEC and a FITS  astrometry structure
 EXPLANATION:
     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, 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) in FITS convention (first pixel is 1,1)
        .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

     X,Y will be in the standard IDL convention (first pixel is 0), and
     *not* the FITS convention (first pixel is 1)         
 REVISION HISTORY:
     Converted to IDL by B. Boothman, SASC Tech, 4/21/86
     Use astrometry structure,  W. Landsman      Jan. 1994   
     Do computation correctly in degrees  W. Landsman       Dec. 1994
     Only pass 2 CRVAL values to WCSSPH2XY   W. Landsman      June 1995
     Don't subscript CTYPE      W. Landsman       August 1995        
     Converted to IDL V5.0   W. Landsman   September 1997
     Understand reversed X,Y (X-Dec, Y-RA) axes,   W. Landsman  October 1998

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


ADSTRING

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

 CALLING SEQUENCE
       result = ADSTRING( ra_dec, precision )           
               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 or vector
       DEC    - Declination in decimal degrees, numeric scalar or vector

 OPTIONAL INPUT:
       PRECISION  - Integer scalar (0-4) giving 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.    Values of 
               precision larger than 4 will be truncated to 4.    If
               PRECISION is 3 or 4, then RA and Dec should be input as 
               double precision.

 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'

       (3) The first two calls in (2) can be combined in a single call using
           vector input
              print,adstring([30.42,30.42],[-1.23,0.23], 1)
 PROCEDURES CALLED:
       FSTRING(), RADEC, SIXTY()

 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]
       Call ROUND() instead of NINT()    February 1996  [W. Landsman]
       Check roundoff past 60s           October 1997   [W. Landsman]
       Work for Precision =4             November 1997  [W. Landsman]
       Converted to IDL V5.0   W. Landsman 24-Nov-1997
       Major rewrite to allow vector inputs   W. Landsman  February 2000

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


ADXY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ADXY
 PURPOSE:
	Use a FITS header to convert celestial (RA,Dec) to pixel coordinates
 EXPLANATION:
	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

       X and Y will be in standard IDL convention (first pixel is 0) and not
       the FITS convention (first pixel is 1).
 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.

 PROCEDURES CALLED:
	AD2XY, ADSTRING(), EXTAST, GETOPT()

 REVISION HISTORY:
	W. Landsman                 HSTX          January, 1988
	Use astrometry structure   W. Landsman   January, 1994	
	Changed default ADSTRING format   W. Landsman    September, 1995
	Converted to IDL V5.0   W. Landsman   September 1997

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


AFHREAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      AFhread
 PURPOSE:
      Subroutine of WFPCREAD to read a GEIS header from an HST STSDAS image.
 EXPLANATION:
       This procedure reads a GEIS header from an HST image.   It then looks
       if a .SHH file is present for FOC images to calculate better 
       astrometry by getting the current PSANGLV3 from this file.   Called by
        WFPCREAD.PRO

 CALLING SEQUENCE:
       AFhread, HdrFile, hdr

 INPUTS:
       HdrFile - scalar string giving name of STSDAS header for an FOC image   

 OUTPUTS:
       hdr - string array, FITS header for the FOC image.    The position
               angle of the V3 axis of HST (PSANGLV3) is added, if it could 
               be found in the .SHH file       
 PROCEDURE CALLS:
       STRN(), SXADDPAR, SXHREAD, SXPAR()
 REVISION HISTORY:
       Written         Eric W. Deutsch  (U. of Washington)    June, 1994
       Documentation update   W. Landsman  (HSTX)             July, 1994
       Converted to IDL V5.0   W. Landsman   September 1997
       Removed call to EXIST() function   W. Landsman        April 1999

(See /host/bluemoon/usr2/idllib/astron/pro/afhread.pro)


AIRTOVAC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       AIRTOVAC
 PURPOSE:
       Convert air wavelengths to vacuum wavelengths 
 EXPLANATION:
       Wavelengths are corrected for the index of refraction of air under 
       standard conditions.  Wavelength values below 2000 A will not be 
       altered.  Uses the IAU standard for conversion given in Morton 
       (1991 Ap.J. Suppl. 77, 119)

 CALLING SEQUENCE:
       AIRTOVAC, WAVE

 INPUT/OUTPUT:
       WAVE - Wavelength in Angstroms, scalar or vector
               WAVE should be input as air wavelength(s), it will be
               returned as vacuum wavelength(s).  WAVE is always converted to
               double precision upon return.

 EXAMPLE:
       If the air wavelength is  W = 6056.125 (a Krypton line), then 
       AIRTOVAC, W yields an vacuum wavelength of W = 6057.8019

 METHOD:
       See Morton (Ap. J. Suppl. 77, 119) for the formula used

 REVISION HISTORY
       Written W. Landsman                November 1991
       Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/airtovac.pro)


AITOFF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       AITOFF
 PURPOSE:
       Convert Right Ascension, Declination to X,Y using an AITOFF projection.
 EXPLANATION:
       This procedure can be used to create an all-sky map in Galactic 
       coordinates with an equal-area Aitoff projection.  Output map 
       coordinates are zero longitude centered.

 CALLING SEQUENCE:
       AITOFF, L, B, X, Y 

 INPUTS:
       L - longitude - scalar or vector, in degrees
       B - latitude - same number of elements as L, in degrees

 OUTPUTS:
       X - X coordinate, same number of elements as L.   X is normalized to
               be between -180 and 180
       Y - Y coordinate, same number of elements as L.  Y is normalized to
               be between -90 and 90.

 NOTES:
       See AIPS memo No. 46, page 4, for details of the algorithm.  This
       version of AITOFF assumes the projection is centered at b=0 degrees.

 REVISION HISTORY:
       Written  W.B. Landsman  STX          December 1989
       Modified for Unix:
               J. Bloch        LANL SST-9      5/16/91 1.1
       Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/aitoff.pro)


AITOFF_GRID

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

 PURPOSE:
       Produce an overlay of latitude and longitude lines over a plot or image
 EXPLANATION:
       The grid is plotted on the current graphics device. AITOFF_GRID 
       assumes that the ouput plot coordinates span the x-range of 
       -180 to 180 and the y-range goes from -90 to 90.

 CALLING SEQUENCE:

       AITOFF_GRID [,DLONG,DLAT,[LINESTYLE=N, LABEL =, /NEW ]

 OPTIONAL INPUTS:

       DLONG   = Optional input longitude line spacing in degrees. If left
                 out, defaults to 30.
       DLAT    = Optional input lattitude line spacing in degrees. If left
                 out, defaults to 30.

 OPTIONAL INPUT KEYWORDS:

       LINESTYLE       = Optional input integer specifying the linestyle to
                         use for drawing the grid lines.
       LABEL           = Optional keyword specifying that the lattitude and
                         longitude lines on the prime meridian and the
                         equator should be labeled in degrees. If LABELS is
                         given a value of 2, i.e. LABELS=2, then the longitude
                         labels will be in hours and minutes instead of
                         degrees.
       /NEW          =   If this keyword is set, then AITOFF_GRID will create
                         a new plot grid, rather than overlay an existing plot.

 OUTPUTS:
       Draws grid lines on current graphics device.

 EXAMPLE:
       Create a labeled Aitoff grid of the Galaxy, and overlay stars at 
       specified Galactic longitudes, glong and latitudes, glat

       IDL> aitoff_grid,/label,/new        ;Create labeled grid
       IDL> aitoff, glong, glat, x,y      ;Convert to X,Y coordinates
       IDL> plots,x,y,psym=2              ;Overlay "star" positions

 AUTHOR AND MODIFICATIONS:

       J. Bloch        1.2     6/2/91
       Converted to IDL V5.0   W. Landsman   September 1997
       Create default plotting coords, if needed   W. Landsman  August 2000

(See /host/bluemoon/usr2/idllib/astron/pro/aitoff_grid.pro)


APER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      APER
 PURPOSE:
      Compute concentric aperture photometry (adapted from DAOPHOT) 
 EXPLANATION:
     APER can compute photometry in several user-specified aperture radii.  
     A separate sky value is computed for each source using specified inner 
     and outer sky radii.   

 CALLING SEQUENCE:
     APER, image, xc, yc, [ mags, errap, sky, skyerr, phpadu, apr, skyrad, 
                       badpix, /EXACT, /FLUX, PRINT = , /SILENT, SETSKYVAL = ]
 INPUTS:
     IMAGE -  input image array
     XC     - vector of x coordinates. 
     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:
     /EXACT -  By default, APER counts subpixels, but uses a polygon 
             approximation for the intersection of a circular aperture with
             a square pixel (and normalize the total area of the sum of the
             pixels to exactly match the circular area).   If the /EXACT 
             keyword, then the intersection of the circular aperture with a
             square pixel is computed exactly.    The /EXACT keyword is much
             slower and is only needed when small (~2 pixels) apertures are
             used with very undersampled data.    
     /FLUX - By default, APER uses a magnitude system where a magnitude of
               25 corresponds to 1 flux unit.   If set, then APER will keep
              results in flux units instead of magnitudes.
     PRINT - if set and non-zero then APER will also write its results to
               a file aper.prt.   One can specify the output file name by
               setting PRINT = 'filename'.
     /SILENT -  If supplied and non-zero then no output is displayed to the
               terminal.
     SETSKYVAL - Use this keyword to force the sky to a specified value 
               rather than have APER compute a sky value.    SETSKYVAL 
               can either be a scalar specifying the sky value to use for 
               all sources, or a 3 element vector specifying the sky value, 
               the sigma of the sky value, and the number of elements used 
               to compute a sky value.   The 3 element form of SETSKYVAL
               is needed for accurate error budgeting.

 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

 PROCEDURES USED:
       DATATYPE(), GETOPT, MMM, PIXWT(), STRN(), STRNUMBER()
 NOTES:
       Reasons that a valid magnitude cannot be computed include the following:
      (1) Star position is too close (within 0.5 pixels) to edge of the frame
      (2) Less than 20 valid pixels available for computing sky
      (3) Modal value of sky could not be computed by the procedure MMM
      (4) *Any* pixel within the aperture radius is a "bad" pixel

       APER was modified in June 2000 in two ways: (1) the /EXACT keyword was
       added (2) the approximation of the intersection of a circular aperture
       with square pixels was improved (i.e. when /EXACT is not used) 
 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
       TEXTOUT may be a string                  W. Landsman September 1995
       FLUX keyword added                       J. E. Hollis, February, 1996
       SETSKYVAL keyword, increase maxsky       W. Landsman, May 1997
       Work for more than 32767 stars           W. Landsman, August 1997
       Converted to IDL V5.0                    W. Landsman   September 1997
       Don't abort for insufficient sky pixels  W. Landsman  May 2000
       Added /EXACT keyword                     W. Landsman  June 2000       

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


ARCBAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ARCBAR
 PURPOSE:
       Draw an arc bar on an image showing the astronomical plate scale

 CALLING SEQUENCE:
       ARCBAR, hdr, arclen,[  COLOR= , /DATA, LABEL= , /NORMAL, POSITION =, 
                              /SECONDS, SIZE=, THICK= ]

 INPUTS:
       hdr - image FITS header with astrometry, string array
       arclen - numeric scalar giving length of bar in arcminutes (default)
               or arcseconds (if /SECONDS is set) 

 OPTIONAL KEYWORD INPUTS:
       COLOR - integer scalar specifying the color to draw the arcbar (using
               PLOTS), default = !P.COLOR
       /DATA - if set and non-zero, then the POSITION keyword is given in data
              units
       LABEL - string giving user defined label for bar.  Default label is size
               of bar in arcminutes
       /NORMAL - if this keyword is set and non-zero, then POSITION is given in
               normalized units
       POSITION - 2 element vector giving the (X,Y) position in device units 
               (or normalized units if /NORMAL is set, or data units if /DATA
               is set) at which to place the  scale bar.   If not supplied, 
               then the user will be prompted to place the cursor at the 
               desired position
       SIZE  - scalar specifying character size of label, default = 1.0
       THICK -  Character thickness of the label, default = !P.THICK

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

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

 RESTRICTIONS:
       When using using a device with scalable pixels (e.g. postscript)
       the data coordinate system must be established before calling ARCBAR.
       If data coordinates are not set, then ARCBAR assumes that the displayed
       image size is given by the NAXIS1 keyword in the FITS header.
 PROCEDURE CALLS:
       AD2XY, EXTAST, GSSSADXY, SXPAR()
 REVISON HISTORY:
       written by L. Taylor (STX) from ARCBOX (Boothman)
       modified for Version 2 IDL,                     B. Pfarr, STX, 4/91
       New ASTROMETRY structures               W.Landsman,  HSTX, Jan 94
       Recognize a GSSS header                 W. Landsman June 94
       Added /NORMAL keyword                   W. Landsman Feb. 96
       Use NAXIS1 for postscript if data coords not set,  W. Landsman Aug 96
       Fixed typo for postscript W. Landsman   Oct. 96
       Account for zeropoint offset in postscript  W. Landsman   Apr 97
       Converted to IDL V5.0   W. Landsman   September 1997
       Added /DATA, /SECONDS keywords   W. Landsman    July 1998

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


ARROWS

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

 CALLING SEQUENCE:
      ARROWS,h, [ xcen, ycen, ARROWLEN= , CHARSIZE=  COLOR= , /DATA
                              FONT=, /NORMAL, /NOTVERTEX, THICK=  ]

 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

 OPTIONAL KEYWORD INPUTS:
       arrowlen  - length of arrows in terms of normal Y size of vector-drawn
                     character,  default  = 3.5, floating point scalar
       charsize  - character size, default = 2.0, floating point scalar
       color     - color that the arrows and NE letters should be.  Default
                    value is !P.COLOR
       Data - if this keyword is set and nonzero, the input center (xcen,
                 ycen) is understood to be in data coordinates
       font - IDL vector font number (1-20) to use to display NE letters.
                 For example, set font=13 to use complex italic font.
       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.
       thick     - line thickness, default = 2.0, floating point scalar
 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".

 PROCEDURES USED:
       EXTAST - Extract astrometry structure from FITS header
       ONE_ARROW - Draw a labeled arrow	
       ZPARCHECK
 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
       Recognize GSSS header    W. Landsman       June 1993
       Added /FONT keyword W. Landsman           April 1995
       Modified to work correctly for COLOR=0  J.Wm.Parker, HITC   1995 May 25
       Work correctly for negative CDELT values   W. Landsman   Feb. 1996
       Converted to IDL V5.0   W. Landsman   September 1997

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


ASTDISP

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

 PURPOSE:
	Print astronomical and pixel coordinates in a standard format
 EXPLANATION:
	This procedure (ASTrometry DISPlay) prints the astronomical and
	pixel coordinates in a standard format.  X,Y must be supplied.  RA,DEC
	may also be supplied, and a data number (DN) may also be 
	supplied.   With use of the Coords= keyword, a string containing the 
	formatted data can be returned in addition or instead (with /silent) 
	of printing.

 CALLING SEQUENCE:
	ASTDISP, x, y, [Ra, Dec, DN, COORD = , /SILENT ]

 INPUT:
	X  - The X pixel coordinate(s), scalar or vector
	Y  - The Y pixel coordinate(s), scalar or vector

 OPTIONAL INPUTS:
	RA -  Right Ascention in *degrees*, scalar or vector
	DEC - DEClination in *degrees*, scalar or vector (if RA is supplied, DEC must also be supplied)
	DN -  Data Number or Flux values

	Each of the inputs X,Y, RA, DEC, DN should have the same number of 
		elements
 OPTIONAL INPUT KEYWORDS:
	SILENT    Prevents printing.  Only useful when used with Coords=
 OUTPUT:
	Printed positions in both degrees and sexigesimal format
	All passed variables remain unchanged
 OPTIONAL KEYWORD OUTPUT:
	COORDS    Returns the formatted coordinates in a string
 PROCEDURES CALLED:
	ADSTRING - used to format the RA and Dec
 HISTORY:
	10-AUG-90 Version 1 written by Eric W. Deutsch
	20-AUG-91 Converted to standard header.  Vectorized Code.  E. Deutsch
	20-NOV-92 Added Coords= and /silent.  E.Deutsch
	Converted to IDL V5.0   W. Landsman   September 1997

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


ASTRMFIX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ASTRMFIX
 PURPOSE:
	Calculate a rough HST WFPC or FOC astrometry solution
 EXPLANATION:
	This program will calculate a rough HST WFPC or FOC astrometry solution
	using the keyword PSANGLEV3 which gives the angle of the V3 axis of
	HST.    Called by WFPCREAD.

 CALLING SEQUENCE:
	AstrmFix, hdr, chip

 INPUT - OUTPUT:
	hdr - FITS header (string array) from either WFPC or FOC.   Header will
		be updated with rough astrometry 

 INPUT:	
	chip - Scalar (typically 0-3) giving the WFPC chip to read.

 HISTORY:
	??-???-???? Written by Eric W. Deutsch
	22-OCT-1992 Changed all calculations to double precision. (E. Deutsch)
	22-OCT-1992 Updated PC Pixel size of 0.04389 from WFPC IDT OV/SV manual(EWD)
	22-OCT-1992 Updated WF Pixel size of 0.1016 from WFPC IDT OV/SV manual(EWD)
	11-JAN-1993 Added warning message and changed CD001001... to CD1_1... (EWD)
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/astrmfix.pro)


ASTRO

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

 CALLING SEQUENCE:
     ASTRO, [ selection, EQUINOX =, /FK4]

 OPTIONAL INPUT:
      SELECTION - Scalar Integer (0-6) giving the the particular astronomical
              utility to be used.  (0) Precession, (1) RA, Dec (2000) to Galactic 
              coordinates, (2) Galactic to RA,Dec (2000) (3) RA,Dec (2000) 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 J2000.   
               This keyword is ignored by the precession utility.   For 
               example, to convert from RA and DEC (J1975) to Galactic 
               coordinates:

               IDL> astro, 1, E=1975
       /FK4 - If this keyword is set and nonzero, then calculations are done
              in the FK4 system.    For example, to convert from RA and Dec
              (B1975) to Galactic coordinates

               IDL> astro,1, E=1975,/FK4 
 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:
      (1) ASTRO temporarily sets !QUIET to suppress compilation messages and
      keep a pretty screen display.   

      (2) ASTRO was changed in December 1998 to use J2000 as the default 
      equinox, **and may be incompatible with earlier calls.***
      
      (3) A nice online page for coordinate conversions is available at
       http://heasarc.gsfc.nasa.gov/cgi-bin/Tools/convcoord/convcoord.pl   
 PROCEDURES USED:
      Procedures: GET_COORDS, EULER       Function: ADSTRING
 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
      Allow floating point equinox input J. Parker/W. Landsman  July 1996
      Make FK5 the default, add FK4 keyword

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


ASTROLIB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       ASTROLIB
 PURPOSE:
       Add the non-standard system variables used by the IDL Astronomy Library
 EXPLANATION: 
       Also defines the environment variable or VMS 
       logical ASTRO_DATA pointing to the directory containing data files 
       associated with the IDL Astronomy library (system dependent).

 CALLING SEQUENCE:
       ASTROLIB

 INPUTS:
       None.

 OUTPUTS:
       None.

 METHOD:
       The non-standard system variables !PRIV, !DEBUG, !TEXTUNIT, and 
       !TEXTOUT are added using DEFSYSV.

 REVISION HISTORY:
       Written, Wayne Landsman, July 1986.
       Use DEFSYSV instead of ADDSYSVAR           December 1990
       Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/astrolib.pro)


AVG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       AVG
 PURPOSE:
       Return the average value of an array, or 1 dimension of an array
 EXPLANATION:
       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, /NAN, /DOUBLE ] )

 INPUTS:
       ARRAY = Input array.  May be any type except string.

 OPTIONAL INPUT PARAMETERS:
       DIMENSION = Optional dimension to do average over, scalar

 OPTIONAL KEYWORD INPUT:
      /NAN - Set this keyword to cause the routine to check for occurrences of
            the IEEE floating-point value NaN in the input data.  Elements with
            the value NaN are treated as missing data.
      /DOUBLE - By default, if the input Array is double-precision, complex, 
                or double complex, the result is of the same type;  otherwise,
                the  result is floating-point.   Use of the /DOUBLE keyword 
                forces a double precision output -- this is equivalent to (but
                faster than) first converting the input array to double.
 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
       Converted to IDL V5.0   W. Landsman   September 1997
       Added /NAN keyword   W. Landsman      July 2000

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


A_B

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     A_b
 PURPOSE:
     Compute B band interstellar extinction according to the RC2.
 EXPLANATION:
     The predicted B band extinction is computed as a function of  
     Galactic position  using the 21 parameter function given by
     deVaucouleurs 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 21 cm 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, same number of 
             elements as input l2 and b2 parameters

 NOTES:
     The controversial aspect of the deVaucouleurs 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) 

     This procedure is mainly of historical interest only, and reddening
     is now better determined using dust maps, such as those available at
     http://astro.berkeley.edu/davis/dust/index.html
 REVISION HISTORY
     Written by R. Cornett and W. Landsman, STX October 1987
     Vectorized code      W. Landsman   STX    December 1992
     Converted to IDL V5.0   W. Landsman   September 1997

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


BARYVEL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BARYVEL
 PURPOSE:
       Calculates heliocentric and barycentric velocity components of Earth.

 EXPLANATION:
       BARYVEL takes into account the Earth-Moon motion, and is useful for 
       radial velocity work to an accuracy of  ~1 m/s.

 CALLING SEQUENCE:
       BARYVEL, dje, deq, dvelh, dvelb

 INPUTS:
       DJE - (scalar) Julian ephemeris date.
       DEQ - (scalar) epoch of mean equinox of dvelh and dvelb. If deq=0
               then deq is assumed to be equal to dje.
 OUTPUTS: 
       DVELH: (vector(3)) heliocentric velocity component. in km/s 
       DVELB: (vector(3)) barycentric velocity component. in km/s

       The 3-vectors DVELH and DVELB are given in a right-handed coordinate 
       system with the +X axis toward the Vernal Equinox, and +Z axis 
       toward the celestial pole.      

 PROCEDURE CALLED:
       Function PREMAT() -- computes precession matrix

 NOTES:
       Algorithm taken from FORTRAN program of Stumpff (1980, A&A Suppl, 41,1)
       Stumpf claimed an accuracy of 42 cm/s for the velocity.    A 
       comparison with the JPL FORTRAN planetary ephemeris program PLEPH
       found agreement to within about 65 cm/s between 1986 and 1994

 EXAMPLE:
       Compute the radial velocity of the Earth toward Altair on 15-Feb-1994

       IDL> jdcnv, 1994, 2, 15, 0, jd          ;==> JD = 2449398.5
       IDL> baryvel, jd, 2000, vh, vb          
               ==> vh = [-17.07809, -22.80063, -9.885281]  ;Heliocentric km/s
               ==> vb = [-17.08083, -22.80471, -9.886582]  ;Barycentric km/s

       IDL> ra = ten(19,50,46.77)*15/!RADEG    ;RA  in radians
       IDL> dec = ten(08,52,3.5)/!RADEG        ;Dec in radians
       IDL> v = vb(0)*cos(dec)*cos(ra) + $   ;Project velocity toward star
               vb(1)*cos(dec)*sin(ra) + vb(2)*sin(dec) 

 REVISION HISTORY:
       Jeff Valenti,  U.C. Berkeley    Translated BARVEL.FOR to IDL.
       W. Landsman, Cleaned up program sent by Chris McCarthy (SfSU) June 1994
       Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/baryvel.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
	Converted to IDL V5.0   W. Landsman   September 1997

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


BOOST_ARRAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	BOOST_ARRAY
 PURPOSE:
	Append one array onto a destination array
 EXPLANATION:
	Add array APPEND to array DESTINATION, allowing the dimensions of
	DESTINATION to adjust to accomodate it.  If both input arrays have the
	same number of dimensions, then the output array will have one
	additional dimension.  Otherwise, the last dimension of DESTINATION
	will be incremented by one.
 CATEGOBY:
	Utility
 CALLING SEQUENCE:
	BOOST_ARRAY, DESTINATION, APPEND
 INPUT:
	DESTINATION	= Array to be expanded.
	APPEND		= Array to append to DESTINATION.
 OUTPUTS:
	DESTINATION	= Expanded output array.
 RESTRICTIONS:
	DESTINATION and APPEND have to be either both of type string or both of
	numerical types.

	APPEND cannot have more dimensions than DESTINATION.

 MODIFICATION HISTOBY:
	Written Aug'88 (DMZ, ARC)
	Modified Sep'89 to handle byte arrays (DMZ)
	Modifed to version 2, Paul Hick (ARC), Feb 1991
	Removed restriction to 2D arrays, William Thompson (ARC), Feb 1992.
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/boost_array.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 than 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

 NOTES:
	If im_int is a 512 x 512 integer array, then the two statements

		IDL> im = fix(round(rebin(float(im_int), 128, 128)))
	        IDL> im  = boxave( im_int,4)

	give equivalent results.   The use of REBIN is faster, but BOXAVE is
	is less demanding on virtual memory, since one does not need to make
	a floating point copy of the entire array.	

 REVISION HISTORY:
	Written, W. Landsman, October 1986
	Call REBIN for REAL*4 and REAL*8 input arrays, W. Landsman Jan, 1992
	Removed /NOZERO in output array definition     W. Landsman 1995
	Fixed occasional integer overflow problem      W. Landsman Sep. 1995
       Allow unsigned data types                      W. Landsman Jan. 2000

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


BPRECESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BPRECESS
 PURPOSE:
       Precess positions from J2000.0 (FK5) to B1950.0 (FK4)
 EXPLANATION:
       Calculates 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 =, EPOCH =   ]

 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.   

       EPOCH - scalar giving epoch of original observations, default 2000.0d
           This keyword value is only used if the MU_RADEC keyword is not set.
 NOTES:
       The algorithm is taken from the Explanatory Supplement to the 
       Astronomical Almanac 1992, page 186.
       Also see Aoki et al (1983), A&A, 128,263

       BPRECESS distinguishes between the following two cases:
       (1) The proper motion is known and non-zero
       (2) the proper motion is unknown or known to be exactly zero (i.e.
               extragalactic radio sources).   In this case, the reverse of 
               the algorithm in Appendix 2 of Aoki et al. (1983) is used to 
               ensure that the output proper motion is  exactly zero. Better 
               precision can be achieved in this case by inputting the EPOCH 
               of the original observations.

       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.

       An unsystematic comparison of BPRECESS with the IPAC precession 
       routine available at ned.ipac.caltech.edu always gives differences 
       less than 0.15".
 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
       Treat case where proper motion not known or exactly zero  November 1994
       Handling of arrays larger than 32767   Lars L. Christensen, march, 1995
       Converted to IDL V5.0   W. Landsman   September 1997
       Fixed bug where A term not initialized for vector input 
            W. Landsman        February 2000
       

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


BREAK_PATH()

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
    BREAK_PATH()

 PURPOSE: 
     Breaks up a path string into its component directories.

 CALLING SEQUENCE: 
     Result = BREAK_PATH( PATHS [ /NoCurrent])

 INPUTS: 
     PATHS   = A string containing one or more directory paths.  The
               individual paths are separated by commas, although in UNIX, 
               colons can also be used.  In other words, PATHS has the same 
               format as !PATH, except that commas can be used as a separator 
               regardless of operating system.

               A leading $ can be used in any path to signal that what follows 
               is an environmental variable, but the $ is not necessary.  (In 
               VMS the $ can either be part of the path, or can signal logical
               names for compatibility with Unix.)  Environmental variables
               can themselves contain multiple paths.

 OUTPUT: 
      The result of the function is a string array of directories.
      Unless the NOCURRENT keyword is set, the first element of the array is 
      always the null string, representing the current directory.  All the 
      other directories will end in the correct separator character for the 
      current operating system.

 OPTIONAL INPUT KEYWORD:
      /NOCURRENT = If set, then the current directory (represented by
               the null string) will not automatically be prepended to the
               output.

 PROCEDURE CALLS:
      Functions:  DATATYPE(), STR_SEP()

 REVISION HISTORY:
       Version 1, William Thompson, GSFC, 6 May 1993.
               Added IDL for Windows compatibility.
       Version 2, William Thompson, GSFC, 16 May 1995
               Added keyword NOCURRENT
       Version 3, William Thompson, GSFC, 29 August 1995
               Modified to use OS_FAMILY
       Version 4, Zarro, GSFC, 4 August 1997
               Added trim to input
       Converted to IDL V5.0   W. Landsman 25-Nov-1997
       Fix directory character on Macintosh system   A. Ferro   February 2000

(See /host/bluemoon/usr2/idllib/astron/pro/break_path.pro)


BSORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BSORT
 PURPOSE:
       Function to sort data into ascending order, like a simple bubble sort.
 EXPLANATION:
       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      
       Always return type LONG    W. Landsman     August 1994
       Converted to IDL V5.0   W. Landsman   September 1997

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


CCM_UNRED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     CCM_UNRED
 PURPOSE:
     Deredden a flux vector using the CCM 1989 parameterization 
 EXPLANATION:
     The reddening curve is that 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).    

     Users might wish to consider using the alternate procedure FM_UNRED
     which uses the extinction curve of Fitzpatrick (1999).
 CALLING SEQUENCE:
     CCM_UNRED, wave, flux, ebv, funred, [ R_V = ]      
             or 
     CCM_UNRED, wave, flux, ebv, [ R_V = ]      
 INPUT:
     WAVE - wavelength vector (Angstroms)
     FLUX - calibrated flux vector, same number of elements as WAVE
             If only 3 parameters are supplied, then this vector will
             updated on output to contain the dereddened flux.
     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)
     (4) Use the 4 parameter calling sequence if you wish to save the 
               original flux vector.

 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
       Allow 3 parameter calling sequence      April 1998
       Converted to IDLV5.0                    April 1998

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


CHECK_FITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CHECK_FITS
 PURPOSE:
       Check that keywords in a FITS header array match the associated data  
 EXPLANATION:
       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 appropriate to the dimensions 
                   of IM
               (3) The BITPIX value in HDR is appropriate to the datatype of IM
       If HDR contains a DATATYPE keyword (as in STSDAS headers), 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, /SILENT
                              ERRMSG = ]'

 INPUT PARAMETERS:
       IM -  FITS (or STSDAS) array, e.g. as read by 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.
       /SILENT - If keyword is set and nonzero, the informational messages 
               will not be printed
 OPTIONAL KEYWORD OUTPUT:
       ERRMSG	= If this keyword is present, then any error messages will be
                 returned to the user in this parameter rather than
                 depending on the MESSAGE routine in IDL.  If no errors are
                 encountered, then a null string is returned.  

 SYSTEM VARIABLE:
       For consistency with previous versions, CHECK_FITS sets the obsolete
       !ERR keyword, although its use is discouraged in favor of the ERRMSG
       keyword.   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 header 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.

 PROCEDURE CALLS:
       STRN(),FXADDPAR, fxpar() 
 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
        Converted to IDL V5.0   W. Landsman   September 1997
       Allow unsigned data types   W. Landsman December 1999
       Allow BZERO = 0 for unsigned data types   W. Landsman January 2000
       Added ERRMSG keyword, W. Landsman February 2000
       Use FXADDPAR to put NAXISi in proper order   W. Landsman August 2000

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


CHECK_TAPE_DRV

[Previous Routine] [Next Routine] [List of Routines]
 NAME        :	
	CHECK_TAPE_DRV
 PURPOSE     :	
	Associates tape drive numbers with device files.  *Unix only*
 EXPLANATION :	
	This is an internal routine to the CDS/SERTS Unix tape handling
	utilities.  It converts tape drive numbers to actual device
	names, and checks to make sure that the device file is open.

		**Unix only**

 CALLING SEQUENCE:         :	
	CHECK_TAPE_DRV, UNIT, LOGICAL_DRIVE, DRIVE, LUN

 INPUTS      
	UNIT = Tape unit number.  Tape drives are selected via the UNIX
		       environment variables "MT1", "MT2", etc.  The desired
		       tape drive is thus specified by numbers, as in VMS.
		       Must be from 0 to 9.

 OUTPUTS     :	
	LOGICAL_DRIVE = Name of environment variable pointing to tape
				drive device file, e.g. "MT0".
	DRIVE	      = Name of device file, e.g. '/dev/nrst0'.
	LUN	      = Logical unit number used for reads and writes.

 COMMON      :	
	CHCK_TAPE_DRVS contains array TAPE_LUN, containing logical unit
		numbers for each tape device, and TAPE_OPEN, which tells
		whether each device is open or not.

 RESTRICTIONS:	
	The environment variable "MTn", where n corresponds to the
		variable UNIT, must be defined.  E.g.,

			setenv MT0 /dev/nrst0

		Requires IDL v3.0 or later.

 SIDE EFFECTS:	
	If the device file is not yet open, then the tape is rewound,
		and a file unit is opened to it.

 Category    :	Utilities, I/O, Tape.

 Prev. Hist. :	William Thompson, Apr 1991.

 Written     :	William Thompson, GSFC, April 1991.

 Modified    :	Version 1, William Thompson, GSFC, 21 December 1993.
			Added keyword /NOSTDIO to OPEN statement.
			Incorporated into CDS library.
		Version 2, William Thompson, GSFC, 22 December 1993.
			Added spawn to "mt rewind".
		Version 3, W. Landsman GSFC 10-Apr-1996
			Open for Readonly, if Update access is unavailable

 Version     :	Version 3, 10-Apr-1996.
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/check_tape_drv.pro)


CIC

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

 PURPOSE:
       Interpolate an irregularly sampled field using Cloud in Cell method

 EXPLANATION:
       This function interpolates an irregularly sampled field to a
       regular grid using Cloud In Cell (nearest grid point gets
       weight 1-dngp, point on other side gets weight dngp, where
       dngp is the distance to the nearest grid point in units of the
       cell size).

 CATEGORY:
       Mathematical functions, Interpolation

 CALLING SEQUENCE:
       Result = CIC, VALUE, POSX, NX[, POSY, NY, POSZ, NZ, 
                     AVERAGE = average, WRAPAROUND =  wraparound,
                     ISOLATED = isolated, NO_MESSAGE = no_message]

 INPUTS:
       VALUE: Array of sample weights (field values). For e.g. a
              temperature field this would be the temperature and the
              keyword AVERAGE should be set. For e.g. a density field
              this could be either the particle mass (AVERAGE should
              not be set) or the density (AVERAGE should be set).
       POSX:  Array of X coordinates of field samples, unit indices: [0,NX>.
       NX:    Desired number of grid points in X-direction.
       
 OPTIONAL INPUTS:
      POSY: Array of Y coordinates of field samples, unit indices: [0,NY>.
      NY:   Desired number of grid points in Y-direction.
      POSZ: Array of Z coordinates of field samples, unit indices: [0,NZ>.
      NZ:   Desired number of grid points in Z-direction.

 KEYWORD PARAMETERS:
       AVERAGE:    Set this keyword if the nodes contain field samples
                   (e.g. a temperature field). The value at each grid
                   point will then be the weighted average of all the
                   samples allocated to it. If this keyword is not
                   set, the value at each grid point will be the
                   weighted sum of all the nodes allocated to it
                   (e.g. for a density field from a distribution of
                   particles). (D=0). 
       WRAPAROUND: Set this keyword if you want the first grid point
                   to contain samples of both sides of the volume
                   (see below).
       ISOLATED:   Set this keyword if the data is isolated, i.e. not
                   periodic. In that case total `mass' is not conserved.
                   This keyword cannot be used in combination with the
                   keyword WRAPAROUND.
       NO_MESSAGE: Suppress informational messages.

 Example of default allocation of nearest grid points: n0=4, *=gridpoint.

     0   1   2   3     Index of gridpoints
     *   *   *   *     Grid points
   |---|---|---|---|   Range allocated to gridpoints ([0.0,1.0> --> 0, etc.)
   0   1   2   3   4   posx

 Example of ngp allocation for WRAPAROUND: n0=4, *=gridpoint.

   0   1   2   3         Index of gridpoints
   *   *   *   *         Grid points
 |---|---|---|---|--     Range allocated to gridpoints ([0.5,1.5> --> 1, etc.)
   0   1   2   3   4=0   posx


 OUTPUTS:
       Prints that a CIC interpolation is being performed of x
       samples to y grid points, unless NO_MESSAGE is set. 

 RESTRICTIONS:
       Field data is assumed to be periodic with the sampled volume
       the basic cell, unless ISOLATED is set.
       All input arrays must have the same dimensions.
       Postition coordinates should be in `index units' of the
       desired grid: POSX=[0,NX>, etc.
       Keywords ISOLATED and WRAPAROUND cannot both be set.

 PROCEDURE:
       Nearest grid point is determined for each sample.
       CIC weights are computed for each sample.
       Samples are interpolated to the grid.
       Grid point values are computed (sum or average of samples).
 NOTES:
       Use tsc.pro for a higher-order interpolation scheme, ngp.pro for a lower
       order interpolation scheme.    A standard reference for these 
       interpolation methods is:   R.W. Hockney and J.W. Eastwood, Computer 
       Simulations Using Particles (New York: McGraw-Hill, 1981).
 EXAMPLE:
       nx=20
       ny=10
       posx=randomu(s,1000)
       posy=randomu(s,1000)
       value=posx^2+posy^2
       field=cic(value,posx*nx,nx,posy*ny,ny,/average)
       surface,field,/lego

 MODIFICATION HISTORY:
       Written by Joop Schaye, Feb 1999.
       Avoid integer overflow for large dimensions P.Riley/W.Landsman Dec. 1999

(See /host/bluemoon/usr2/idllib/astron/pro/cic.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, [/RADIANS]

 INPUTS/OUTPUT:
       ang     - The angle to modify, in degrees.  This parameter is
                 changed by this procedure.  Can be a scalar or vector.
                 The type of ANG is always converted to double precision
                 on output.

 OPTIONAL INPUT 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 angle is transformed between -360 and 360 using the MOD operator.   
       Negative values (if any) are then transformed between 0 and 360
 MODIFICATION HISTORY:
       Written by Michael R. Greason, Hughes STX, 10 February 1994.
       Get rid of WHILE loop, W. Landsman, Hughex STX, May 1996
       Converted to IDL V5.0   W. Landsman   September 1997

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


CLEANPLOT

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

 CALLING SEQUENCE:
       Cleanplot, [ /Silent]

 INPUTS:       
       None

 OPTIONAL KEYWORD INPUT:
       /SILENT - If set, then CLEANPLOT will not display a message giving the 
                 the system variables tags being reset.
 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
       Assume user has at least V3.0.0           W. Landsman   August 95
       V5.0 has 60 instead of 30 TICKV values    W. Landsman   Sep. 97
       Change !D.N_COLORS to !D.TABLE_SIZE for 24 bit displays
               W. Landsman  April 1998
       Added silent keyword to supress output & modified X_old to
       handle the new !X and !Y tags in IDL 5.4   S. Penton     July 2000
       Test for visual depth if > V5.1   W. Landsman     July 2000
       

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


CNTRD

[Previous Routine] [Next Routine] [List of Routines]
  NAME: 
       CNTRD
  PURPOSE:
       Compute the 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.
       Allowed input vectors        G. Hennessy       April,  1992
       Fixed to prevent wrong answer if floating pt. X & Y supplied
               W. Landsman        March, 1993
       Convert byte, integer subimages to float  W. Landsman  May 1995
       Converted to IDL V5.0   W. Landsman   September 1997
       Better checking of edge of frame David Hogg October 2000

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


COMPARE_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COMPARE_STRUCT  
 PURPOSE:
	Compare all matching tag names and return differences
 EXPLANATION:
 	Compare all matching Tags names (except for "except_Tags")
	between two structure arrays (may be different struct.defs.),
	and return a structured List of fields found different.
 CATEGORY:
			Structures
 CALLING SEQUENCE:
	diff_List = compare_struct( struct_A, struct_B )
 INPUTS:
	struct_A, struct_B : the two structure arrays to compare.
	Struct_Name : for internal recursion use only.
 KeyWords:
		EXCEPT = string array of Tag names to ignore (NOT to compare).
		/BRIEF = number of differences found for each matching field
						of two structures is printed.
		/FULL = option to print even if zero differences found.
		/RECUR_A = option to search for Tag names
				in sub-structures of struct_A,
				and then call compare_struct recursively
				for those nested sub-structures.
		/RECUR_B = search for sub-structures of struct_B,
				and then call compare_struct recursively
				for those nested sub-structures.
	Note:
		compare_struct is automatically called recursively
		for those nested sub-structures in both	struct_A and struct_B
		(otherwise cannot take difference)
 OUTPUT:
	Returns a structure array describing differences found,
	which can be examined using print,diff_List or help,/st,diff_List.
 PROCEDURE:
	Match Tag names and then use where function on tags.
 MODIFICATION HISTORY:
	written 1990 Frank Varosi STX @ NASA/GSFC (using copy_struct)
	modif Aug.90 by F.V. to check and compare same # of elements only.
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/compare_struct.pro)


CONCAT_DIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:   
       CONCAT_DIR
               
 PURPOSE:     
       To concatenate directory and file names for current OS.
 EXPLANATION:
       The given file name is appended to the given directory name with the 
       format appropriate to the current operating system.

 CALLING SEQUENCE:               
       result = concat_dir( directory, file) 

 INPUTS:
       directory  - the directory path (string)
       file       - the basic file name and extension (string)
                                   can be an array of filenames.

 OUTPUTS:     
       The function returns the concatenated string.  If the file input
       is a string array then the output will be a string array also.
               
 EXAMPLES:         
       IDL> pixfile = concat_dir('$DIR_GIS_MODEL','pixels.dat')

       IDL> file = ['f1.dat','f2.dat','f3.dat']
       IDL> dir = '$DIR_NIS_CAL'
       IDL> f = concat_dir(dir,file)

 RESTRICTIONS: 
       Assumes Unix type format if os is not vms, MacOS or Windows.
               
       The version of CONCAT_DIR available at 
       http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/system/concat_dir.pro
       includes additional VMS-specific keywords.

 CATEGORY    
        Utilities, Strings
               
 REVISION HISTORY:
       Prev Hist. : Yohkoh routine by M. Morrison
       Written     : CDS version by C D Pike, RAL, 19/3/93
       Version     : Version 1  19/3/93
       Documentation modified Nov-94   W. Landsman 
       Add V4.0 support for Windows    W. Landsman   Aug 95
       Converted to IDL V5.0   W. Landsman   September 1997
       Changed loops to long integer   W. Landsman   December 1998
       Added Mac support, translate Windows environment variables, 
       & treat case where dirname ends in '/' W. Landsman  Feb. 2000

(See /host/bluemoon/usr2/idllib/astron/pro/concat_dir.pro)


CONS_DEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CONS_DEC
 PURPOSE:
       Obtain the X and Y coordinates of a line of constant declination
 EXPLANATION:
       Returns a set of Y pixels values, given an image with tangent projection
       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:
       Implemented only for the TANgent and SIN projections

 NOTES:
       The algorithm (and notation) is based on AIPS Memo 27 by Eric Greisen,
       with modifications for a coordinate description (CD) matrix as 
       described in Paper II of Greisen & Calabretta (2000, A&A, in press).
       These documents are available from 
       http://fits.cv.nrao.edu/documents/wcs/wcs.html

 REVISION HISTORY:
       Written, Wayne Landsman  STX Co.                          April 1988
       Use new astrometry structure,     W. Landsman    HSTX     Jan. 1994
       Use CD matrix, add SIN projection   W. Landsman  HSTX     April, 1996
       Converted to IDL V5.0   W. Landsman   September 1997
       Fix case where DEC is scalar, X is vector   W. Landsman RITSS Feb. 2000
       Fix possible sign error introduced Jan. 2000   W. Landsman  May 2000

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


CONS_RA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CONS_RA
 PURPOSE:
       Obtain the X and Y coordinates of a line of constant right ascension
 EXPLANATION:
       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, [ DEC] )

 INPUTS:         
       RA -  Right Ascension value in DEGREES (0 < RA < 360.).  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.
 OPTIONAL OUTPUT:
       DEC - Computed set of declinations (in DEGREES) for X,Y, coordinates
 NOTES:
       The algorithm (and notation) is based on AIPS Memo 27 by Eric Greisen,
       with modifications for a coordinate description (CD) matrix as 
       described in Paper II of Greisen & Calabretta (2000, A&A, in press).
       These documents are available from 
       http://fits.cv.nrao.edu/documents/wcs/wcs.html

 RESTRICTIONS:
       Implemented only for the TANgent and SIN projections 

 REVISION HISTORY:
       Written, Wayne Landsman  STX Co.        April, 1988
       Algorithm adapted from AIPS memo No. 27 by Eric Griessen
       New astrometry structure
       Converted to IDL V5.0   W. Landsman   September 1997
       Added SIN projection    W. Landsman   January 2000
       Fix possible sign error introduced Jan. 2000   W. Landsman  May 2000

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


CONVOLVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONVOLVE
 PURPOSE:
	Convolution of an image with a Point Spread Function (PSF)
 EXPLANATION:
	The default is to compute the convolution using a product of 
	Fourier transforms (for speed).

 CALLING SEQUENCE:

	imconv = convolve( image1, psf, FT_PSF = psf_FT )
  or:
	correl = convolve( image1, image2, /CORREL )
  or:
	correl = convolve( image, /AUTO )

 INPUTS:
	image = 2-D array (matrix) to be convolved with psf
	psf = the Point Spread Function, (size < or = to size of image).

 OPTIONAL INPUT KEYWORDS:

	FT_PSF = passes out/in the Fourier transform of the PSF,
		(so that it can be re-used the next time function is called).
	FT_IMAGE = passes out/in the Fourier transform of image.

	/CORRELATE uses the conjugate of the Fourier transform of PSF,
		to compute the cross-correlation of image and PSF,
		(equivalent to IDL function convol() with NO rotation of PSF)

	/AUTO_CORR computes the auto-correlation function of image using FFT.

	/NO_FT overrides the use of FFT, using IDL function convol() instead.
		(then PSF is rotated by 180 degrees to give same result)
 METHOD:
	When using FFT, PSF is centered & expanded to size of image.
 HISTORY:
	written, Frank Varosi, NASA/GSFC 1992.
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/convolve.pro)


CONV_STSDAS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONV_STSDAS
 PURPOSE:
	Convert internal format of an STSDAS image to host machine architecture
 EXPLANATION:
	Converts 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 VMS machine, then
	by default CONV_STSDAS assumes the image originated on VMS.   If the
	host is VMS, 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 image
		CONV_STSDAS assumes a default header extension of .hhh -- 
		otherwise the header extension should be included in sdas_name.
		The internal format of the file will be modified by CONV_STSDAS.

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

 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 VMS, 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.
	(3)  Note that CONV_STSDAS currently does not support conversion *from*
		a little-endian machine (OSF, windows)		

 REVISION HISTORY:
	Written   W. Landsman                     January, 1993
	Don't require .hhh extension		April, 1993
	Increase speed by calling SXGINFO	May, 1993
	Converted to IDL V5.0   W. Landsman   September 1997

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


CONV_UNIX_VAX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
      CONV_UNIX_VAX
 PURPOSE:
      To convert Unix IDL data types to Vax IDL data types. 
 EXPLANATION:
      CONV_UNIX_VAX assumes the Unix IDL data type is IEEE standard in either
      big-endian or little-endian format.

 CALLING SEQUENCE:
      CONV_UNIX_VAX, variable, [ SOURCE_ARCH = ]

 PARAMETERS:
      variable - The data variable to be converted.  This may be a scalar
            or an array.  Valid datatypes are integer, longword,
            floating point, and double precision. The result of the 
            conversion is passed back in the original variable.
 OPTIONAL INPUT KEYWORD:  
      SOURCE_ARCH = name (string) of source architecture
            if using this function on a VAX, otherwise
            !VERSION.ARCH is used to determine the conversion.
            **If run on a VAX, the default is to assume the source to be
            a little-endian machine with IEEE floating point
            (e.g. MIPSEL or Alpha***).
 RESTRICTIONS:
      Requires that data be from IEEE standard Unix machines
      (e.g. SUN, MIPSEL, or Alpha).
 EXAMPLE:
      Read a 100 by 100 matrix of floating point numbers from a data
      file created on a Sun.  Then convert the matrix values into
      VAX format.

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

 MODIFICATION HISTORY:
      Version 1      By John Hoegy            13-Jun-88
      04-May-90 - WTT:  Created CONV_UNIX_VAX from VAX2SUN,
                         reversing floating point procedure.
       Modified  P. Keegstra             September 1994
           Implemented MIPSEL and ALPHA architecture,
           distinguishing VMS and OSF
       Modified  P. Keegstra             February 1995
           Added 386 PC based architectures
       If since V5.1 then VMS is always little endian    June 1998
       Convert to IDL V5.0   W. Landsman                 June 1998

(See /host/bluemoon/usr2/idllib/astron/pro/conv_unix_vax.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.
 EXPLANTION:
      Generally used on non-Vax machines to parse data created on Vaxes.
      The architecture is obtained from IDL sys.var. !VERSION.ARCH.   

 CALLING SEQUENCE:
      var_unix = conv_vax_unix( var_vax, [TARGET_ARCH = ] )

 INPUT PARAMETER:
      var_vax - 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.

 OPTIONAL INPUT KEYWORD:  
      TARGET_ARCH = name (string) of desired target architecture
            (e.g. 'sparc' or 'mipsel').    If not supplied, then 
            !VERSION.ARCH is used to determine the target architecture.
            Note that CONV_VAX_UNIX will leave variables unchanged on a
            VMS machine, unless the TARGET_ARCH keyword is set.
            
 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> readu,1,data
      IDL> data = conv_vax_unix( data )
 NOTE:
       Prior to IDL V5.1, the architecture "alpha" was ambiguous, since VMS 
       alpha IDL used VAX D-float while OSF/1 alpha IDL uses little-endian 
       IEEE.    The program uses !VERSION.OS to do the right thing when
       converting to a representation appropriate for the current
       platform.  To convert to a representation appropriate for
       an OSF/1 alpha on a VAX or (pre V5.1) VMS alpha, please specify
       the "mipsel" (or "i386") architecture.      

 MODIFICATION HISTORY:
       Written   F. Varosi               August 1990
       Modified  P. Keegstra             April 1992
           Implemented MIPSEL architecture
       Modified  P. Keegstra             July 1994
           Implemented ALPHA architecture, distinguishing VMS and OSF
       Modified  P. Keegstra             February 1995
           Added 386 PC based architectures
       Modified  P. Keegstra             March 1995
           Added note, restored and fixed old specifiers 
           for 386 PC based architectures
      Modified W. Landsman for VAX problems in V4.0        August 1995
      Work for double complex variables                    August 1995
      Remove informational messages under VMS              August 1997
      Since V5.1, IDL VMS uses little endian IEEE          June 1998
      Convert to IDL V5.0                                  June 1998

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


COPY_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COPY_STRUCT
 PURPOSE:
 	Copy all fields with matching tag names from one structure to another
 EXPLANATION
	Fields with matching tag names are copied from one structure array to 
	another structure array of different type.
	This allows copying of tag values when equating the structures of
	different types is not allowed, or when not all tags are to be copied.
	Can also recursively copy from/to structures nested within structures.
	Note that the number of elements in the output structure array
	is automatically adjusted to equal the length of input structure array.
	If this not desired then use pro copy_struct_inx which allows
	specifying via subscripts which elements are copied where in the arrays.

 CALLING SEQUENCE:

	copy_struct, struct_From, struct_To, NT_copied
	copy_struct, struct_From, struct_To, EXCEPT=["image","misc"]
	copy_struct, struct_From, struct_To, /RECUR_TANDEM

 INPUTS:
	struct_From = structure array to copy from.
	struct_To = structure array to copy values to.

 KEYWORDS:

	EXCEPT_TAGS = string array of tag names to ignore (to NOT copy).
		Used at all levels of recursion.

	SELECT_TAGS = tag names to copy (takes priority over EXCEPT).
		This keyword is not passed to recursive calls in order
		to avoid the confusion of not copying tags in sub-structures.

	/RECUR_FROM = search for sub-structures in struct_From, and then
		call copy_struct recursively for those nested structures.

	/RECUR_TO = search for sub-structures of struct_To, and then
		call copy_struct recursively for those nested structures.

	/RECUR_TANDEM = call copy_struct recursively for the sub-structures
		with matching Tag names in struct_From and struct_To
		(for use when Tag names match but sub-structure types differ).

 OUTPUTS:
	struct_To = structure array to which new tag values are copied.
	NT_copied = incremented by total # of tags copied (optional)

 INTERNAL:
	Recur_Level = # of times copy_struct calls itself.
		This argument is for internal recursive execution only.
		The user call is 1, subsequent recursive calls increment it,
		and the counter is decremented before returning.
		The counter is used just to find out if argument checking
		should be performed, and to set NT_copied = 0 first call.
 EXTERNAL CALLS:
	pro match	(when keyword SELECT_TAGS is specified)
 PROCEDURE:
	Match Tag names and then use corresponding Tag numbers.
 HISTORY:
	written 1989 Frank Varosi STX @ NASA/GSFC
 	mod Jul.90 by F.V. added option to copy sub-structures RECURSIVELY.
	mod Aug.90 by F.V. adjust # elements in TO (output) to equal
			# elements in FROM (input) & count # of fields copied.
	mod Jan.91 by F.V. added Recur_Level as internal argument so that
			argument checking done just once, to avoid confusion.
			Checked against Except_Tags in RECUR_FROM option.
	mod Oct.91 by F.V. added option SELECT_TAGS= selected field names.
	mod Aug.95 by W. Landsman to fix match of a single selected tag.
	mod Mar.97 by F.V. do not pass the SELECT_TAGS keyword in recursion.
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/copy_struct.pro)


COPY_STRUCT_INX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	COPY_STRUCT_INX
 PURPOSE:
	Copy matching tags & specified indices from one structure to another
 EXPLANATION:
 	Copy all fields with matching tag names (except for "except_Tags")
	from one structure array to another structure array of different type.
	This allows copying of tag values when equating the structures of
	different types is not allowed, or when not all tags are to be copied.
	Can also recursively copy from/to structures nested within structures.
	This procedure is same as copy_struct with option to
	specify indices (subscripts) of which array elements to copy from/to.
 CALLING SEQUENCE:

	copy_struct_inx, struct_From, struct_To, NT_copied, INDEX_FROM=subf

	copy_struct_inx, struct_From, struct_To, INDEX_FROM=subf, INDEX_TO=subto

 INPUTS:
	struct_From = structure array to copy from.
	struct_To = structure array to copy values to.

 KEYWORDS:

	INDEX_FROM = indices (subscripts) of which elements of array to copy.
		(default is all elements of input structure array)

	INDEX_TO = indices (subscripts) of which elements to copy to.
		(default is all elements of output structure array)

	EXCEPT_TAGS = string array of Tag names to ignore (to NOT copy).
		Used at all levels of recursion.

	SELECT_TAGS = Tag names to copy (takes priority over EXCEPT).
		This keyword is not passed to recursive calls in order
		to avoid the confusion of not copying tags in sub-structures.

	/RECUR_FROM = search for sub-structures in struct_From, and then
		call copy_struct recursively for those nested structures.

	/RECUR_TO = search for sub-structures of struct_To, and then
		call copy_struct recursively for those nested structures.

	/RECUR_TANDEM = call copy_struct recursively for the sub-structures
		with matching Tag names in struct_From and struct_To
		(for use when Tag names match but sub-structure types differ).

 OUTPUTS:
	struct_To = structure array to which new tag values are copied.
	NT_copied = incremented by total # of tags copied (optional)

 INTERNAL:
	Recur_Level = # of times copy_struct_inx calls itself.
		This argument is for internal recursive execution only.
		The user call is 1, subsequent recursive calls increment it,
		and the counter is decremented before returning.
		The counter is used just to find out if argument checking
		should be performed, and to set NT_copied = 0 first call.
 EXTERNAL CALLS:
	pro match	(when keyword SELECT_TAGS is specified)
 PROCEDURE:
	Match Tag names and then use corresponding Tag numbers,
	apply the sub-indices during = and recursion.
 HISTORY:
	adapted from copy_struct: 1991 Frank Varosi STX @ NASA/GSFC
	mod Aug.95 by F.V. to fix match of a single selected tag.
	mod Mar.97 by F.V. do not pass the SELECT_TAGS keyword in recursion,
		and check validity of INDEX_FROM and INDEX_TO in more detail.
	Converted to IDL V5.0   W. Landsman   September 1997

(See /host/bluemoon/usr2/idllib/astron/pro/copy_struct_inx.pro)


CORREL_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CORREL_IMAGES
 PURPOSE:
       Compute the 2-D cross-correlation function of two images
 EXPLANATION:
       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.

 CALLING SEQUENCE:
       Result = CORREL_IMAGES( image_A, image_B, 
                        [XSHIFT=, YSHIFT=, XOFFSET_B=, YOFFSET_B=, REDUCTION=, 
                        MAGNIFICATION=, /NUMPIX, /MONITOR  )

 INPUTS:
       image_A, image_B = the two images of interest.

 OPTIONAL INPUT 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 - if set, 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.

 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
       Use ROUND instead of NINT, June 1995, Wayne Landsman HSTX
       Avoid divide by zero errors, W. Landsman HSTX April 1996
	Remove use of !DEBUG    W. Landsman   June 1997
       Subtract mean of entire image before computing correlation, not just 
          mean of overlap region   H. Ebeling/W. Landsman   June 1998
       

(See /host/bluemoon/usr2/idllib/astron/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
 EXPLANATION"
	Optimal offset is computed by means of maximizing the correlation 
	function of the two images.

 CALLING SEQUENCE:
	CORREL_OPTIMIZE, image_A, image_B, xoffset_optimum, yoffset_optimum 
		[ XOFF_INIT=, YOFF_INIT=, MAGNIFICATION=, /PRINT, /NUMPIX, 
		  /MONITOR, PLATEAU_THRESH=  ]

 INPUTS:
	image_A, image_B = the two images of interest.

 OPTIONAL INPUT 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.
	PLATEAU_THRESH = threshold used for detecting plateaus in 
		the cross-correlation matrix near maximum, (default=0.01),
		used only if MAGNIFICATION > 1.    Decrease this value for
		high signal-to-noise data

 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
	Added PLATEAU_THRESH keyword  June 1997,  Wayne Landsman  STX   
	Converted to IDL V5.0   W. Landsman   September 1997

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


CORRMAT_ANALYZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CORRMAT_ANALYZE 
 PURPOSE:
	Find the optimal (x,y) offset to maximize correlation of 2 images
 EXPLANATION:
	Analyzes the 2-D cross-correlation function of two images
	and finds the optimal(x,y) pixel offsets.
	Intended for use with function CORREL_IMAGES.

 CALLING SEQUENCE:
	corrmat_analyze, correl_mat, xoffset_optimum, yoffset_optimum, 
		max_corr, edge, plateau, [XOFF_INIT=, YOFF_INIT=, REDUCTION=, 
		MAGNIFICATION=, PLATEAU_THRESH=, /PRINT]

 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.

 OPTIONAL INPUT 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.

 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
	Use ROUND instead of NINT, June 1995 Wayne Landsman HSTX
	Remove use of non-standard !DEBUG system variable   W.L. HSTX 
	Converted to IDL V5.0   W. Landsman   September 1997

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


COSMO_PARAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     COSMO_PARAM
 PURPOSE:
     Derive full set of cosmological density parameters from a partial set
 EXPLANATION:
     This procedure is called by LUMDIST and GALAGE to allow the user a choice
     in defining any two of four cosmological density parameters.

     Given any two of the four input parameters -- (1) the normalized matter 
     density Omega_m (2) the normalized cosmolgical constant, Omega_lambda (2) the normalized 
     curvature term, Omega_k and (4) the deceleration parameter q0 --  this 
     program will derive the remaining two.     Here "normalized" means divided by the closure
     density so that Omega_m + Omega_lambda + Omega_k = 1.    For a more
     precise definition see Caroll, Press, & Turner (1992, ArAA, 30, 499).     

     If less than two parameters are defined, this procedure sets default 
     values of Omega_k=0 (flat space), Omega_lambda = 0.7, Omega_m = 0.3
     and q0 = -0.5
 CALLING SEQUENCE:
       COSMO_PARAM, Omega_m, Omega_lambda, Omega_k, q0

 INPUT-OUTPUTS:
     Omega_M - normalized matter energy density, non-negative numeric scalar
     Omega_Lambda - Normalized cosmological constant, numeric scalar
     Omega_k - normalized curvature parmeter, numeric scalar.   This is zero
               for a flat universe
     q0 - Deceleration parameter, numeric scalar = -R*(R'')/(R')^2
          = 0.5*Omega_m - Omega_lambda
 NOTES:
     If more than two parameters are defined upon input (overspecification), 
     then the first two defined parameters in the ordered list Omega_m, 
     Omega_lambda, Omega_k, q0 are used to define the cosmology.
 EXAMPLE:
     Suppose one has Omega_m = 0.3, and Omega_k = 0.5 then to determine
     Omega_lambda and q0
    
       IDL> cosmo_param, 0.3, omega_lambda, 0.5, q0
   
       which will return omega_lambda = 0.2 and q0 = -2.45
 REVISION HISTORY:
       W. Landsman         Raytheon ITSS         April 2000

(See /host/bluemoon/usr2/idllib/astron/pro/cosmo_param.pro)


CREATE_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CREATE_STRUCT
 PURPOSE:
       Create an IDL structure from a list of tag names and dimensions
 EXPLANATION:
       Dynamically create an IDL structure variable from list of tag names 
       and data types of arbitrary dimensions.   Useful when the type of
       structure needed is not known until run time.

       Unlike the intrinsic function CREATE_STRUCT(), this procedure does not
       require the user to know the number of tags before run time.   (Note
       there is no name conflict since the intrinsic CREATE_STRUCT is a 
       function, and this file contains a procedure.)
 CALLING SEQUENCE:
       CREATE_STRUCT, STRUCT, strname, tagnames, tag_descript, 
                             [ DIMEN = , /CHATTER, /NODELETE ]

 INPUTS:
       STRNAME -   name to be associated with structure (string)
               Must be unique for each structure created.   Set
               STRNAME = '' to create an anonymous structure

       TAGNAMES -  tag names for structure elements
               (string or string array)

       TAG_DESCRIPT -  String descriptor for the structure, containing the
               tag type and dimensions.  For example, 'A(2),F(3),I', would
               be the descriptor for a structure with 3 tags, strarr(2), 
               fltarr(3) and Integer scalar, respectively.
               Allowed types are 'A' for strings, 'B' or 'L' for unsigned byte 
               integers, 'I' for integers, 'J' for longword integers, 
               'F' or 'E' for floating point, 'D' for double precision
               'C' for complex, and 'M' for double complex
               Uninterpretable characters in a format field are ignored.

               For vectors, the tag description can also be specified by
               a repeat count.  For example, '16E,2J' would specify a 
               structure with two tags, fltarr(16), and lonarr(2)

 OPTIONAL KEYWORD INPUTS:
       DIMEN -    number of dimensions of structure array (default is 1)

       CHATTER -  If /CHATTER is set, then CREATE_STRUCT will display
                  the dimensions of the structure to be created, and prompt
                  the user whether to continue.  Default is no prompt.

       NODELETE - If /NODELETE is set, then the temporary file created
                  CREATE_STRUCT will not be deleted upon exiting.   See below

 OUTPUTS:
       STRUCT -   IDL structure, created according to specifications 

 EXAMPLES: 

       IDL> create_struct, new, 'name',['tag1','tag2','tag3'], 'D(2),F,A(1)'

       will create a structure variable new, with structure name NAME

       To see the structure of new:

       IDL> help,new,/struc
       ** Structure NAME, 3 tags, 20 length:
          TAG1            DOUBLE         Array(2)
          TAG2            FLOAT          0.0
          TAG3            STRING         Array(1)

 PROCEDURE:
       Generates a temporary procedure file using input information with
       the desired structure data types and dimensions hard-coded.
       This file is then executed with CALL_PROCEDURE.

 NOTES:
       If CREATE_STRUCT cannot write a temporary .pro file in the current 
       directory, then it will write the temporary file in the getenv('HOME')
       directory.

       At present, can fail if a tag_name cannot be used as a proper
       structure component definition, e.g., '0.10' will not
       work, but a typical string like 'RA' or 'DEC' will.
       A partial workaround checks for characters '\' and '/'
       and '.' and converts them to '_'. in a tag_name.

       Note that 'L' now specifies a LOGICAL (byte) data type and not a
       a LONG data type for consistency with FITS binary tables

 RESTRICTIONS:
       The name of the structure must be unique, for each structure created.
       Otherwise, the new variable will have the same structure as the 
       previous definition (because the temporary procedure will not be
       recompiled).  ** No error message will be generated  ***

 SUBROUTINES CALLED:
       FDECOMP, GETTOK(), REPCHR() 

 MODIFICATION HISTORY:
       Version 1.0 RAS January 1992
       Modified 26 Feb 1992 for Rosat IDL Library (GAR)
       Modified Jun 1992 to accept arrays for tag elements -- KLV, Hughes STX
       Accept anonymous structures W. Landsman  HSTX    Sep. 92
       Accept 'E' and 'J' format specifications   W. Landsman Jan 93
       'L' format now stands for logical and not long array
       Accept repeat format for vectors        W. Landsman Feb 93
       Accept complex and double complex (for V4.0)   W. Landsman Jul 95
       Work for long structure definitions  W. Landsman Aug 97
       Converted to IDL V5.0   W. Landsman   September 1997
       Write temporary file in HOME directory if necessary  W. Landsman Jul 98
       Use OPENR,/DELETE for OS-independent file removal W. Landsman Jan 99

(See /host/bluemoon/usr2/idllib/astron