Lowell Buie 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:21:11 2000.

List of Routines


Routine Descriptions

ACRE

[Next Routine] [List of Routines]
 NAME: 
  acre
 PURPOSE: 
  Automatic Cosmic Ray Extraction
 DESCRIPTION:
  This program will attempt to identify and remove Cosmic Ray strikes from
    an image.  This program was developed and tested on HST PC data prior
    to the refurbishment mission.  It may work for other types of data but
    it is as of now untested elsewhere.
  The simplest usage is the single pass mode where the same parameters are
    used for the entire image.  First, the image is smoothed with a median
    filter using a box filter size given by width.  This smoothed image is
    then subtracted from the original image.  A robust mean of a portion of
    the image is calculated and subtracted from the image though this mean
    should be near zero.  Any pixel see to deviate by THRESH standard
    deviations from this average is marked for removal and replaced by its
    corresponding value in the smoothed image.
  This initial step works very well on the sky.  I've found that THRESH=3
    WIDTH=7 work pretty well on all but the largest CRS's.  Using a value
    for width less than 7 seems to leave residual "rings" of hot pixels from
    around the edges of a strike.
  The draw back to these parameters is that it is much too agressive in and
    around actual objects in the frame.  The cores of the PSF will be removed
    and numerous pixels will be tagged in the wings of the PSF.
  To get around this problem, use the EXCLUDE keyword.  This is a 5xN array
    containing circular regions to scan with different parameters.  The array
    holds N such regions.  For each region you must specify the following:
       (0,n) - x location of region
       (1,n) - y location of region
       (2,n) - radius of region
       (3,n) - sigma threshold to use in this region
       (4,n) - width of median smoothing, (no smoothing if set to 0).
    The procedure used is to first restore all the pixels in the region to
    their original values (in case they were changed in the first step).
    If the width is set to zero, nothing more is done.  If the width is a
    meaningful value, then the original image is smoothed with that width
    and the region is scanned for deviant pixels again and replaces any
    found.
  The effects of each region are cumulative on the image and done in order
    they appear in the array.  So any final steps of restoring small locations
    should be done last.  Also, the step of smoothing the image is very cpu
    intensive.  It will run much faster if you can group all regions with
    similar smoothing values together.
  In practice, a smaller width (~3) and higher thresh (~4) seems to work in
    the wings of the PSF, but it will still take out the core.  So, you
    need to specify two zones, one for cleaning that is nearly the size
    of the outer fringes of the PSF and one for pretecting the image that
    is smaller and centered on the core.  If you happen to get a strike
    near the core of the PSF, this routine won't help and you're probably
    screwed anyway.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  pro acre,dirty_im,clean_im,thresh,width, $
              BLFINAL=blfinal,BLMASK=blmask, $
              EXCLUDE=exclude,MASK=mask,VERBOSE=verbose
 INPUTS:
  dirty_im - Original input image to be cleaned.
  thresh   - Deviation threshold, in sigma, from background to cause
                pixel to be fixed.
  width    - Median smoothing width to get local background reference.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  BLFINAL  - Flag, if true, brings up ITOOL to blink between the original
                and cleaned images.
  BLMASK   - Flag, if true, brings up ITOOL to blink between the original
                and the mask showing pixels that are being replaced.
  EXCLUDE  - Array that controls special extraction behavior in select
                regions of the image.  See DESCRIPTION for details.
  VERBOSE  - Flag, if true, generates a wordy output of progress and
                action as routine progresses.
 OUTPUTS:
  clean_im - Final cleaned up image.
 KEYWORD OUTPUT PARAMETERS:
  MASK     - Return of the mask image.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/04/05 - Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/acre.pro)


ADDSLASH

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  addslash
 PURPOSE: 
  Append a trailing / to string (if needed).
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  addslash,name
 INPUTS:
  name - string to modify
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  name - string with trailing slash
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/06/08, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/addslash.pro)


ADDSTARS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  addstars
 PURPOSE: (one line)
  Manipulate the master star catalog (add/replace)
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  addstars,name,ra,dec,rap,decp,alias
 INPUTS:
     name   - Name of the star.
     ra     - Right Ascension in radians. J2000
     dec    - Declination in radians.     J2000
     rap    - RA proper motion, "/year
     decp   - Dec proper motion, "/year
 OPTIONAL INPUT PARAMETERS:
     alias  - String with aliases for star name, each alias must be separated
                by the | character, imbedded blanks are allowed but only one
                is preserved and all leading and trailing blanks are removed.
                the default is have no aliases.
 KEYWORD INPUT PARAMETERS:
     FILE    - Name of star catalog file.  Default is:
                 '/gryll/data1/buie/starcat/starcat.dat'
     FLUSH_INFO - Flush all cached information, force a clean start
     NOLOAD  - Flag, if set, suppresses the call to LOADSTAR.  This is
                  intended to be used ONLY when this routine is called by
                  LOADSTAR to prevent infinite recursion.  When set, it
                  is assumed that the common block is empty and all its
                  contents will be overwritten.

 OUTPUTS:
   common block and file are updated
 COMMON BLOCKS:
     MWB_STARCAT
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/21, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/addstars.pro)


AIRINDEX

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	airindex
PURPOSE: (one line)
	Compute the real part of the refractive index of air.
DESCRIPTION:
	This function is based on the formulas in Filippenko, PASP, v. 94,
	pp. 715-721 for the index of refraction of air.  The conversion from
  relative humidity to vapor pressure is from the Handbook of Chemistry
  and Physics.
CATEGORY
  Miscellaneous
CALLING SEQUENCE:
	n = airindex(wave,pressure,temp,relhum)
INPUTS:
	wave     - wavelength of light, in microns
	pressure - atmospheric pressure in mm of Hg
	temp     - atmospheric temperature in degrees C
	relhum   - Relative humidity (in percent)
OUTPUTS:
	return value is the index of refraction for the input conditions.
REVISION HISTORY:
	Written by Marc W. Buie, STScI, 2/28/91
  97/03/03, MWB, changed name from REFRAC, changed to relative humidity
COMMENTS:

(See /host/bluemoon/usr2/idllib/contrib/buie/airindex.pro)


AIRMASS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  airmass
 PURPOSE: (one line)
  Compute airmass for one or more times.
 DESCRIPTION:
  This is should be a pretty good function for computing the air mass factor.
  The default is to use the cosine based formula derived by David Tholen
  but the older secant based formula from Hardie is still available.  The
  zenith angle is corrected for refraction before using either formula (see
  REFRAC).  The defaults on the atmospheric conditions are STP.  This function
  should be quite good up to 5 airmasses.  This formula will work up to
  a zenith angle of 80 degrees after which the computation id not done.
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  am = airmass(jd,ra,dec,lat,lon,wave,pressure,temp,relhum)
 INPUTS:
  jd  - Julian date (must be double precision to get nearest second).
  ra  - Right ascension (of date) in radians.
  dec - Declination (of date) in radians.
  lat - Latitude of observatory in radians.
  lon - West longitude of observatory in radians.
 OPTIONAL INPUT PARAMETERS:
  wave     - wavelength of light, in microns (default=0.56)
  pressure - atmospheric pressure in mm of Hg (default=760.0)
  temp     - atmospheric temperature in degrees C (default=0.0)
  relhum   - Relative humidity (in percent) (default=0.0)
 KEYWORD INPUT PARAMETERS:
  UT  - Time, in hours to add to JD to get the correct Universal Time.
  HARDIE - Flag, if set causes Hardie formula to be used.
 KEYWORD OUTPUT PARAMETERS:
  ALT - Optional return of the altitude for each airmass.
  LHA - Optional return of the local hour angle.
  LST - Optional return of the local sidereal time.
  AZI - Optional return of the azimuth (west from south).
 OUTPUTS:
  Return value is the airmass in single precision.
 COMMON BLOCKS:
  None.
 SIDE EFFECTS:
 RESTRICTIONS:
  Any input may be a vector.  If more than one is a vector then the
  lengths must match.  The return will have the same dimensions as
  the input.
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 1992 March, by Marc W. Buie, Lowell Observatory
  94/05/05 - MWB, modified to split out the LST calculation, added LST and
                LHA optional keyword outputs and UT keyword input.'
  97/03/03 - MWB, added the Tholen airmass equation as the default.  Hardie
                is still included as an option.  Also added refraction
                to the calculation which added numerous inputs.
  97/10/23 - MWB, added the AZI keyword.

(See /host/bluemoon/usr2/idllib/contrib/buie/airmass.pro)


ALTOHA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  altoha
 PURPOSE: (one line)
  Convert an object altitude to its hour angle.
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  altoha,alt,dec,lat,ha,type
 INPUTS:
  alt  - Altitude of object above horizon in radians
  dec  - Declination of object in radians
  lat  - Latitude of observatory in radians
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  ha   - hour angle for object (< 0 is East, > 0 is West)
  type - indicates the success of the conversion
           -1   object is always below ALT
            0   conversion ok, HA valid
            1   object is always above ALT
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/05/07 - Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/altoha.pro)


ANGSEP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  angsep
 PURPOSE:
  Compute the angular distance between two spherical coordinates.
 DESCRIPTION:

 CATEGORY:
  Mathematical
 CALLING SEQUENCE:
  ans=angsep(ra1,dec1,ra2,dec2)

 INPUTS:
  ra1  - RA of first position (radians)
  dec1 - Dec of first position (radians)
  ra2  - RA of second position (radians)
  dec2 - Dec of second position (radians)

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return value is the angular distance in radians.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:

(See /host/bluemoon/usr2/idllib/contrib/buie/angsep.pro)


ASTCOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astcol
 PURPOSE:
  Collect astrometry observations for multiple objects
 DESCRIPTION:
  
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astcol,OBSCODE=obscode,SAVEDIR=savedir

 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  NONEWCODE - Flag, if set suppresses the generation of new object id codes.
  OBSCODE - Observatory code for observations, default=688 (Lowell Obs.)
  SAVEDIR - Directory where final astrometry is to be placed.  The default
              value is /gryll/data1/buie/astrometry

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    97/03/18 - Written by Marc W. Buie, Lowell Observatory
    97/07/09 - Added the savedir keyword
    97/07/25, MWB, slight change to the Bowell file format output.
    98/06/22, MWB, added call to ASTLIST at end, also newcodes are taken from
                 first available number, not last code in file.
    98/11/04, MWB, now filters out magnitudes fainter than 80.0

(See /host/bluemoon/usr2/idllib/contrib/buie/astcol.pro)


ASTEVAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  asteval
 PURPOSE:
  Evaulate an astrometric polynomial function.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  val=asteval,ind,coeff,terms
 INPUTS:
  x     - X - coordinate (scalar or vector)
  y     - Y - coordinate (scalar or vector)
  coeff - Coefficients of the transformation, this must be a vector that has
              the terms to be used, the length must be equal to total(terms)
  terms - Which terms are to be used
           This must be a 10 element vector, a 1 means use the term, 0 means don't
              0 - const (always use this)
              1 - x     (always use this)
              2 - y     (always use this)
              3 - r
              4 - x^2
              5 - y^2
              6 - x^3
              7 - y^3
              8 - xy^2
              9 - yx^2

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return value - Dependent value(s), if x,y was 1-d then this will be scalar.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/06/17, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/asteval.pro)


ASTLINKS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astlinks
 PURPOSE:
  Scan for linkages among a collection of asteroid astrometric measurements
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astlinks,otherdir
 INPUTS:

 OPTIONAL INPUT PARAMETERS:
  otherdir - If specified, the local .ast files are checked against this
               directory too.
 KEYWORD INPUT PARAMETERS:
  NOLOCAL - Flag, if set will suppress checking for linkages within the
               astrometry from the current directory.

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/01/13, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astlinks.pro)


ASTLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astlist
 PURPOSE:
  Create a summary listing from a final astrometry file.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astlist,file
 INPUTS:
  file - Final astrometry file to read and summarize.
  outfile - (Optional), name of file to write results to.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  All information is printed to screen.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/03/26, Written by Marc W. Buie, Lowell Observatory
  98/11/04, MWB, now filters out magnitudes fainter than 80.0

(See /host/bluemoon/usr2/idllib/contrib/buie/astlist.pro)


ASTPRED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astpred
 PURPOSE:
  Simple asteroid position predictor when no orbit is available.
 DESCRIPTION:

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  astpred,astfile,jdi,ra,dec

 INPUTS:
  astfile - file name for set of astrometric observations for object.
  jdi     - Time(s) to predict location for.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  QUIET   - No printed or plotted output.

 OUTPUTS:
  rai     - RA of predicted location.
  deci    - Dec of predicted location.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/01/08, written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astpred.pro)


ASTPRMT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astprmt
 PURPOSE:
  Promote version of an astrometry fit coefficient file to highest version.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astprmt,fitfile,centers
 INPUTS:

  fitfile - File with astrometry fit coefficients (Default=fitcoeff.dat)

  centers - File with image centers.  (Default=centers.dat)

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:

  The fitfile is updated to the most recent version.  Not changed if already
    current.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/10/09, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astprmt.pro)


ASTRD2SN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astrd2sn
 PURPOSE:
  Astrometry conversion from ($\alpha$,$\delta$) to ($\xi$,$\eta$)

 DESCRIPTION:
  Standard coordinate conversion (see Smart, p283)

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  astrd2sn,ra,dec,racen,deccen,xi,eta

 INPUTS:
  ra     - Right ascension (radians)
  dec    - Declination (radians)
  racen  - Right ascension of tangent point between plane and celestial sphere.
  deccen - Declination of tangent point between plane and celestial sphere.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  xi     - Coordinate in tangent plane.
  eta    - Coordinate in tangent plane.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/04/05 - Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astrd2sn.pro)


ASTRD2XY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astrd2xy
 PURPOSE:
  Astrometry conversion from ($\alpha$,$\delta$) to image (x,y)

 DESCRIPTION:
  This transformation is based on a simple linear transformation with
    rotation from the celestial sphere to linear CCD chip coordinates.
    This is only an approximate treatment and will not work for very large
    fields.

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  astrd2xy,ra,dec,info,x,y

 INPUTS:
  ra     - Right ascension (radians)
  dec    - Declination (radians)
  info   - Transformation information held in an anonymous structure with
              the following tags:
                 racen  - Right ascension of center of image.
                 deccen - Declination of center of image.
                 pscale - Plate scale (arcsec/pixel).
                 rang   - Rotation angle of image (radians).
                 xflip  - -1 if image flipped in X, 1 if not.
                 yflip  - -1 if image flipped in Y, 1 if not.
                 xc     - X center of image.
                 yc     - Y center of image.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  x      - X coordinate in image
  y      - Y coordinate in image

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/04/05 - Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astrd2xy.pro)


ASTREPRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astrepro
 PURPOSE:
  Re-reduce existing astrometry originally measured with ASTROM
 DESCRIPTION:
  This file attempts to rereduce astrometric measurements in the current
    directory.  These measures are x,y positions that are found in the
    file, position.dat.  The files fitcoeff.dat and centers.dat are
    scanned for the corresponding transformation relations between x,y
    and RA,DEC.  Any object.ast files in this directory will be overwritten.

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astrepro
 INPUTS:
  All input information comes from files.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  All output information is sent to files.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/06/20, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astrepro.pro)


ASTROM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astrom
 PURPOSE:
  Astrometry from a digital image.
 DESCRIPTION:

  This program is designed to permit doing astrometry and catalog driven
   photometry of digital images.  It is implicitly assumed that these are
   true digital images, ie., that the images are strictly linear up to some
   signal level.  The possiblities supported by this program are quite
   extensive.  Read the PROCEDURE section below for more details.

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astrom,root,fileno

 INPUTS:
  root   - Root of data file name (ie., 970309), must be a string.
  fileno - File number to load (0-999), integer.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  BINFAC   - Binning factor for displayed image.  Default=2

  BORDER   - Optional inset from each edge of array to be considered valid
                for measurements.  The default is 20 pixels in from each
                edge.  The value can either be scalar which is applied to
                all edges, or a 4 element vector that specifies the inset
                relative to [left,right,top,bottom]

  CATPATH  - Location for finding USNO A1.0 catalog for use with refnet.
                default takes on the default of refnet.

  CENTER   - Controls what is used for center of image for star extraction
                0 - (default)  with objects, uses object ephemeris as center
                               no objects, interactive query for choice.
                1 - Use the header coordinates, no corrections.
                2 - Use the header coordinates after taking out last known
                       position offset.

  CLEAN    - Flag, if set requests filtering out
                cosmic ray strikes.  This step doesn't take too long on
                a Sun Ultra 1/170 but may be prohibitive on slower machines.

  DRTHRESH - Threshold on the radial distance (in pixels) of the catalog
                to source matching step when working with a pre-computed
                source list.  (Default=4.3)

  EDIT     - Flag, if set allows interactive culling of bad astrometric
                measurements in the reference net.

  EXTLIST  - If image is a multi-extension FITS image, this list will
                force the reduction of only the extension numbers listed.
                The default is to do all the extensions, one at a time.

  ETATERMS - Vector controlling the astrometric fit in the ETA direction (Dec).
                Must be a 10-element vector, default=[1,1,1,0,0,0,0,0,0,0]
                which is a pure linear fit.  See ASTTERMS for a description
                of the terms available.

  GAIN     - Gain (e-/ADU) of the image.  Default=1.0

  KEYLIST  - Name of a file containing a correspondence list. This list
                associates a set of standard names with the actual keyword
                names found in a FITS file header. If this keyword is
                omitted, a default list is used, as if a file with the
                following contents had been supplied:
                   AIRMASS   K  AIRMASS
                   DATE      K  DATE-OBS
                   DATETMPL  T  DD-MM-YYYY
                   EXPDELTA  V  0.0
                   EXPTIME   K  EXPTIME
                   FILTER    K  FILTERS
                   FILENAME  K  CCDFNAME
                   OBJECT    K  OBJECT
                   UT        K  UT 
                   RA        K  RA
                   DEC       K  DEC
                The middle column is a flag. It may be K, for Keyword,
                T, for Template, or V, for Value. If it is V, the contents
                of the third field on that line should make sense for the
                name in the first field.

  MAGLIM   - Limiting (faint) magnitude for catalog extraction (default=30.0)

  MINREFRESH - Flag, if set will minimize the amount of screen refreshes.

  MAXSTARS - Maximum number of reference stars to measure. (default=all)

  NEWCAT   - Flag, if set forces the recreation of the STARFILE.

  NOSCALE  - Flag, if set suppresses conversion from integer to floating point
                when the FITS file is read.

  NOOBJECTS - Flag, if set suppresses the final step of measuring astrometric
                unknowns.

  NOREMIND - Flag, if set suppresses the query for the reminder location.

  OBJNAME  - Name of object to collect astrometry for.  By default, the
                FITS header from the image is scanned for the OBJECT keyword
                and this becomes the OBJNAME after compressing multiple blanks,
                trimming leading and trailing blanks, and replacing single
                blanks by "_".

  OBJRAD   - Radius (in pixels) of object aperture for astrometry and
                photometry.  Default=10.  The sky aperture is set between
                objrad+10 and objrad+30.

  PATH     - String, this is the name of the directory where the data are
                stored.  The actual data directory used is PATH+'/'+root.
                The default is '' (blank) and the file would be root.NNN
                which would permit putting a leading path on the root.

  PLASTFILE - This gives the name of the "plast" output file.  The default
                is OBJNAME.pla.  This file contains a list of asteroids that
                may be found on the image and is created by a separate
                program.  To disable this feature, set PLASTFILE='none'.

  PHOTSTARS - Flag.  If set, turns on a special mode that performs photometry
                on all good astrometric reference stars.  The photometry is
                added to the root+'.log' file.  Multiple reductions are
                weeded out and the photometry log file is left sorted by
                file.  The log file is in the ALTLOG format (see basphote).
                The star name is automatically created from its coordinate.
                Ex: a star at 12:12:34.2 and +04:23:45 would be named
                NV1212342+042345.  The position used for the name comes from
                the catalog, not astrometry from the image.

  PRETTY    - String, if set, will cause the final image with overlays to
                be sent to a color postscript output file.  This will only
                be used if you are measuring objects (id., NOOBJECTS not set).
                If not specified, this file will not be created.

  QUEUE     - String, name of printer to send output to.  If supplied, a
                hardcopy of the image is generated along with a list of
                stars identified.  If blank or not specified, no printed output
                is generated.

  RESFILE  - Filename where astrometric measurements are written to.  The
                default file name is OBJNAME.ast.  Only one line per image
                is allowed.  Subsequent measurements made by astrom will
                override the measures for this image.

  ROAM      - Flag, if set will provide a continuous running display of the
                RA and Dec of the cursor when you are in the object
                measurement loop.

  SAVECLEAN - Flag, if set will save the cleaned image to disk.

  SPOT     - Array containing explicit x,y coordinates.  Default=none.
                After the astrometric fit is complete, the RA,DEC of each
                x,y pair (2xN array) is computed, printed to the screen, and
                saved to an ancillary file, spot.dat, in the current directory.

  STARFILE - Filename where a list of astrometric reference stars is to
                be found.  The default file name is OBJNAME.cat.  If this file
                is not found, then this program will attempt to create the
                file by calling "refnet", a program that accesses the
                USNO A1.0 star catalog provided by David Monet of USNOFS.

  SUBEXP   - This keyword controls reducing images with multiple exposures.
                This keyword should contain one or more strings that will
                serve to identify the multiple exposures.  Ideally, this
                id string would be a single character, eg., 'a', 'b', etc.
                This program will loop over the string list for multiple
                reductions of the frame.  The id string will be appended to
                the frame # where ever it is used.  So, in the .ast file and
                fitcoeff.dat file the file name will be root.suffix_tag.  In
                Refstars, the files are suffix_tag.ref.  The default is to
                process one exposure per image and the _tag will not be added
                to any names.

  TRUSTCENTER - Flag, if set indicates that the 2-star solution and the
                   previously known plate center are to be trusted.  This
                   removes the need to do the catalog star identifications.
                   If the astrom.inf file is not found, or, if the plate
                   center is not found in the centers.dat file, then this
                   flag is ignored.  This flag is also ignored if there
                   is a valid Refstars file.

  TWOSTAR  - Flag, if set suppresses the automatic correlation of the source
                   list and catalog and switches to an interactive two star
                   solution to get the initial image location.  This should
                   be done on the first frame of a night.  It also seems to
                   be necessary for large fields with non-linear distortions.
                   This flag has no effect if there are no pre-existing
                   source lists generated by findsrc.pro.

  XCENTER  - Optional override of location of center of optical axis in
                pixel coordinates.  The default is the center of the array.
                This location is considered the location of the tangent plane
                and the location of x=y=0 for the (x,y) <--> (xi,eta)
                transformation.

  XITERMS  - Vector that controls the astrometric fit in the XI direction (RA)
                Must be a 10-element vector, default=[1,1,1,0,0,0,0,0,0,0]
                which is a pure linear fit.  See ASTTERMS for a description
                of the terms available.

  WINDOW   - window number to display image into.

  YCENTER  - Optional override of location of center of optical axis in
                pixel coordinates.  The default is the center of the array.
                This location is considered the location of the tangent plane
                and the location of x=y=0 for the (x,y) <--> (xi,eta)
                transformation.

 OUTPUTS:
  output is graphical and to a series of files.
     astrom.inf  - Records the last 2-star astrometric solution.
                     If the image being reduced is a multi-extension FITS
                     file, this file will be named astromNN.inf where
                     NN is the image extension of interest.
     centers.dat - Records the image center for all measured frames.
     root.log    - Photometry (if PHOTSTARS set)
     objname.ast - Astrometry of object
     objname.cat - Star catalog extraction
     objname.pla - Output of PLAST (list of asteroids on image).
     root.stars  - List of stars and coordinates for those where photometry
                      was measured.  Intended for inclusion in starcat.dat
                      (see GETSTARS.PRO or LOADSTAR.PRO).
     Refstars/fileno.ref - Binary file containing positions, mag, fwhm for
                           all catalog stars measured.  This file will be
                           be reused in later runs of ASTROM on this image
                           as long as the object aperture radius is the same.
     fitcoeff.dat- List of fit coefficients for each of the xi,eta axes.
     position.dat- List of x,y positions for all objects measured.

 KEYWORD OUTPUT PARAMETERS:
  None.

 COMMON BLOCKS:
  None.

 SIDE EFFECTS:

 RESTRICTIONS:

  Input files must all be FITS and the file names must be of the form:
    root.NNN where "root" is some string and NNN is a 3-digit number.

 PROCEDURE:

  This program automates astrometric reductions of CCD images.  Once the
  astrometric solution is determined for the image, you can then proceed
  to measure any source in the image to ascertain it's position.  As you
  might guess from the above list, there are far too many options to this
  program.  It is rare that you will use all the options, instead, some
  subset can be tweaked and tuned to _your_ data to make the process run
  as quickly as possible and with as little user interaction as possible.
  Under certain circumstances this program can run complete automatically
  but only if a great deal is already known about the images.

  To illustrate one use of the program consider doing astrometry of 1 or
  more objects on an image.  Typically on the first invocation on a new
  image that you know little about you will not use any optional information.
  However, the first and most important optional input you can provide is
  the FITS keyword correspondence information through the KEYLIST option.
  If you have a decent header, then the program will have a good object name,
  time for the image, and (hopefully) a good coordinate for the image center.

  The object name is important because it is used to form file names for
  the output astrometry and the ancillary star catalog.  If the images you
  are reducing have the same name for different sky locations then this
  program will get hopelessly confused.

  Next, ASTROM will look for a special file, astrom.inf, that contains clues
  about the image scale and orientation.  If not found, you will be prompted
  for the needed information.  This file can be edited after creation if you
  need to try other guesses (such as flipping image, trying different scales,
  trying different rotation angles, etc.).  This step can be very frustrating
  if you don't have much information about your image.  I quite often find
  it necessary to edit this file many times and re-run ASTROM on the same
  image until it makes sense.

  Next, ASTROM will look for a list of stars that should be on the frame and
  will serve as the astrometric reference network.  If found, the file is
  read.  If not found, then ASTROM will try to create this file using another
  external program (refnet).  The set of stars requested will depend on the
  scale and orientation known at this point so if you get it wrong, delete the
  the star catalog and start over.  The center for the star search comes
  from a number of places.  This is what ASTROM tries, in order, (1)
  using the object name (first one if given an array), try to get an
  ephemeris position for the object for the time of the image, if this
  fails --> (2) ask for RA and DEC of image center.  (3) If NOOBJECTS is set,
  (1) and (2) are bypassed and the RA,DEC from the header are used (after
  precessing to J2000, if needed).  If you aren't doing objects, and the
  header value is bad, then you may need to insert your guess for the
  center directly into the "centers.dat" file.  Sometimes this is the only
  way to proceed if the headers are really screwy.

  Next, ASTROM will try to get a list of
  known asteroids that _might_ be on the image.  For this to work, you
  must have an external program that ASTROM will invoke to collect this
  information to a file.  If the file already exists, then it will be
  read directly without the need for the external program.  Note: this
  external program is non-trivial and cannot be easily exported away from
  Lowell Observatory.  Fortunately, it can be disabled, but, if you can
  use it then you will see positional overlays of the expected locations
  of any asteroids on the frame along with their line of variation scaled
  by the orbit uncertainty (green line) and a 1-hour motion vector (yellow
  line).

  With this information in hand, ASTROM begins to work with the screen image.
  The image is displayed with a fairly hard linear stretch, -7 sigma to
  +16 sigma about the mean sky signal.  The border is drawn and you are
  (possibly) asked to indicate a location on the image to be remembered.  I
  find this useful in marking the location of a specific object that will
  be highlighted throughout the analysis.  This is not used with NOOBJECTS
  set.

  If you allow it, ASTROM will proceed to remove cosmic rays from the image.
  This step is almost always useful but can sometimes take a long time to
  run depending on the size of the image and the speed of your computer.
  On a SUN Ultra 1/170E, a 4k x 2k image can take 10-20 seconds to clean.
  After cleaning the image is redisplayed with the same scaling.  If you watch
  carefully you will see the cosmic ray strikes "blink off".

  Next, the asteroid overlay is generated and plotted.  This involves
  generating ephemeris positions for all the asteroids for the time of this
  frame.  Again, an external program is called to generate these positions
  and you find the relevant documentation in my IDL front-end program, EPHEM.

  Now, we get on to the steps of getting the astrometric grid in place.
  The image center, scale and orientation are used in calculating the locations
  of all catalog stars.  Red diamonds, scaled in size by magnitude, are
  plotted on the image at these predicted locations.  Your job at this
  point is to match up the overlay with the image.  This can be either
  very easy, very hard, or anywhere in between.  You may find need to
  tweak the contents of astrom.inf, change MAGLIM, or more depending on
  the situation.  Sometimes the center is no good.  One of two things will
  happen, (1) the wrong star overlay is plotted on the image, or (2) no
  stars are plotted.  In the latter case, you will be prompted for a new
  image center.  If you're lucky, this will allow you to proceed.

  Assuming all goes well, you now must establish the correspondence between
  the overlay and the image.  At this step you must identify two stars
  in the image and the same two stars in the overlay.  The prompts from ASTROM
  will indicate what information it next desires.  Just remember that at
  any time ASTROM is looking for a mouse click to proceed, a right click will
  exit the program directly at that point.  After you identify the first star,
  the overlay is replotted so that the overlay star sits over the image.
  After you identify the second star ASTROM has enough information to predict
  the location of all the other catalog stars and can proceed to measure
  their locations.  Once all the catalog stars are measured, an astrometric
  function is fit to the positions.  See, ASTTERMS for all the possible
  terms.  The default is a linear solution which is usually pretty good for
  most CCD images.  At this step you may need to fiddle with the aperture
  radius used to measure the stars.  A radius (OBJRAD) that is too big
  or too small can lead to excessive scatter in the astrometry.  I usually
  try to set OBJRAD=fwhm or just slightly under the fwhm.  These positions
  the subsequent fit are saved to a couple of files so that if you come
  back to the image later, the fit is regenerated much quicker and you get
  directly to the next step, that of measuring unknown objects.

  Note that the fit to the star positions is done in a robust fashion.  Stars
  with large residuals, unusual fwhm, signal too weak, or signal too strong,
  are avoided in the fit.  These stars will plot as red circles in the final
  overlay while the good stars will overplot with yellow circles.  You can
  control the "too strong" threshold with MAXPHOTSIG or you can do a purely
  interactive editing of the star positions used with /EDIT.  Using /EDIT
  is required only if there just aren't that many stars (say 3-6) and there's
  no statistical basis for chucking out anything.  If there are lots of stars,
  the automatic stuff works just fine.

  If you find that the header gives consistently good predictions of the
  catalog star locations, then use the TRUSTCENTER keyword to bypass the
  2-star interactive step.  Be careful, you need to have pretty good
  for this to work effectively.  Also note that if you turn on the PHOTSTARS
  flag, ASTROM will automatically collect and save aperture photometry data
  on _all_ the catalog stars.

  At this point, you've arrived at the time you can measure new objects.
  You are prompted to click left on the object to measure.  Nothing is saved
  until you click middle (to go to next object) or click right (to quit).
  So you can feel free to poke around in the image measuring lots of objects
  without saving all of it.  When you click left it measures the location
  and computes RA,DEC, and, it puts up a small window on the object with the
  aperture location overplotted.  In this window, there is a non-linear
  stretch so that you can see the wings of the PSF as well as the core.
  You also get a radial profile for additional diagnostic information.
  If you continue with a middle click, ASTROM will step through the OBJNAME
  array (if provided) or when it runs of out names it knows, it will begin
  prompting you for a name.  This name is used to form the file name for
  all saved astrometry.  Once you have processed an entire nights worth of
  data then you can use the ASTCOL program to collection it all and save it
  to another master storage location.  The ASTCOL step is where the
  observatory code information is added to the astrometry.

  If you set /PRETTY, the very last thing done is to create a fancy postscript
  output image file.  This image has all the overlays and asteroid locations
  and is occasionally useful.

  This description is by no means exhaustive.  There are a very large number
  of options that must be tweaked to get the most out of the reduction.  I
  ususally find it useful to create a master script that contains all the
  flags and options as I develop a means to reduce some data.

  Here's one example:
      astrom,fdir,fnum,maglim=17, $
         binfac=1,objrad=objrad,path=d,key='../site.key',objname=o, $
         /noremind,noobjects=noob,gain=2.5,plastfile='none',trustcenter=trust, $
         xi=[1,1,1,0,0,0,0,0,0,0],eta=[1,1,1,0,0,0,0,0,0,0],maxphotsig=23000.0

  Here I've set the limiting magnitude for the reference stars to 17.0,
  no cosmic ray cleaning, don't ask for reminder location, set gain
  of CCD, turn off looking for field asteroids, force linear fit, and set
  saturation level of CCD.  The other options are either obvious or set
  to fixed values in the script handling this call.  Note that by splitting
  the file name into root and suffix, you can generate a loop on the suffix
  and step through all the images you have.

 MODIFICATION HISTORY:
  97/04/05, Written by Marc W. Buie, Lowell Observatory
  97/06/13, MWB, added keylist fits header reading generalization
  97/06/14, MWB, fixed line of variations plotting bug, also added saving
                 information on reference stars used.
  97/06/17, MWB, added controls over terms in Xi and Eta fits.
  97/06/18, MWB, added saving fit coeffcients and object positions.
  97/06/19, MWB, added NOREMIND keyword
  97/06/20, MWB, added TRUSTCENTER keyword
  97/09/09, MWB, added SUBEXP keyword
  97/10/08, MWB, added X,YCENTER keywords.
  97/10/16, MWB, added SPOT keyword.
  97/10/21, MWB, rewrote initial 2-star fit.
  97/11/24, MWB, added MAXSTARS keyword.
  98/01/06, MWB, added support for pre-cleaned images.
  98/03/13, MWB, some heavy rewriting.  NOCLEAN  is now CLEAN (default none)
                   plus internal cleanups, some changes to ancillary plots,
                   added support for external lists of image sources.
  98/06/24, MWB, added TWOSTAR flag.
  98/08/26, MWB, added ROAM keyword.
  98/10/07, MWB, a few optimizations and some bug fixes and enhancements
                   for multi-extension files.
  98/10/08, MWB, added DRTHRESH keyword
  98/11/04, MWB, added NOSCALE keyword
  98/12/02, MWB, changed usage of PATH so that you can append 'root' or not.
                   This now allows the image file name roots to be different
                   from the name of the directory they are stored in.

(See /host/bluemoon/usr2/idllib/contrib/buie/astrom.pro)


ASTSN2RD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astsn2rd
 PURPOSE:
  Astrometry conversion from ($\xi$,$\eta$) to ($\alpha$,$\delta$)
 DESCRIPTION:
  Standard coordinate conversion (see Smart, p283)

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  astsn2rd,xi,eta,racen,deccen,ra,dec

 INPUTS:
  xi     - Coordinate in tangent plane (radians).
  eta    - Coordinate in tangent plane (radians).
  racen  - Right ascension of tangent point between plane and celestial sphere.
  deccen - Declination of tangent point between plane and celestial sphere.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  ra     - Right ascension (radians)
  dec    - Declination (radians)

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/04/05 - Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astsn2rd.pro)


ASTSOLVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astsolve
 PURPOSE:
  Solve for astrometric transformation from image to sky coordinates.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  astsolve,x,y,xi,eta,xiterms,etaterms,renormfac,bad,cxi,ceta
 INPUTS:
  x        - Image x-coordinate  (should be "normalized" to range from -1 to 1)
  y        - Image y-coordinate  (should be "normalized" to range from -1 to 1)
  xi       - Standard tanget plane coordinate (should be in arcsec)
  eta      - Standard tanget plane coordinate (should be in arcsec)
  xiterms  - Which fitting terms to use (see ASTTERMS.PRO)
  etaterms - Which fitting terms to use (see ASTTERMS.PRO)
  renormfac - Re-normalization factor for converting from normalized x,y to
                the original x,y values.
  bad      - array of flags that mark bad data on input (modified).

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  EDIT - Flag, if set allows interactive bad point editing.
  XFLIP - Flag, if set flips x axis plot when editing bad points.
  YFLIP - Flag, if set flips y axis plot when editing bad points.

 OUTPUTS:
  cxi  - coefficients of xi fit.
  ceta - coefficients of eta fit.
  bad  - array of flags that mark bad data on output.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/03/13, Written by Marc W. Buie, Lowell Observatory
  98/11/23, MWB, added renormfac and fixed documentation

(See /host/bluemoon/usr2/idllib/contrib/buie/astsolve.pro)


ASTTERMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astterms
 PURPOSE:
  Evaulate the independent vectors to match an astrometric polynomial function.
 DESCRIPTION:

  This function is a support routine to ASTROM and handles part of the
  transformation between pixel (x,y) coordinates and the tangent plane
  coordinates (xi,eta).  The transformation from (ra,dec) to (xi,eta)
  is not handled in this routine.  The premise is that the transformation
  from the tangent plane to pixel coordinates can be done with a polynominal.
  I have implemented all of the common terms found in typical astrometric
  solutions.  In practice, the high order terms are probably not needed
  except for very large fields or for highly distorted fields caused by
  excessive optics.  Most CCD fields can be accurately modeled using just
  the linear terms.

  This function does NOT actually evaluate the transformation.  Instead,
  the indepedent values for the polynominal are computed.  The result is
  an array with (nterms,nvals) elements where nterms is the number of
  non-zero terms and nvals is the number of input x and y values (which must
  be of the same length.  The table below lists the contents of the i^th
  column in the output array.

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  val=astterms(x,y,terms)
 INPUTS:
  x     - X - coordinate (scalar or vector)
  y     - Y - coordinate (scalar or vector)
  terms - Which terms are to be built
           This must be a 10 element vector, a 1 means use the term,
                   0 means don't use it.
              0 - const (always use this)
              1 - x     (always use this)
              2 - y     (always use this)
              3 - r
              4 - x^2
              5 - y^2
              6 - x^3
              7 - y^3
              8 - xy^2
              9 - yx^2

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return value - Dependent value(s), if x,y was 1-d then this will be scalar.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/06/17, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astterms.pro)


ASTXY2RD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  astxy2rd
 PURPOSE:
  Astrometry conversion from image (x,y) to ($\alpha$,$\delta$)

 DESCRIPTION:
  This transformation is based on a simple linear transformation with
    rotation from the celestial sphere to linear CCD chip coordinates.
    This is only an approximate treatment and will not work for very large
    fields.

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  astxy2rd,x,y,info,ra,dec

 INPUTS:
  x      - X coordinate in image
  y      - Y coordinate in image
  info   - Transformation information held in an anonymous structure with
              the following tags:
                 racen  - Right ascension of center of image.
                 deccen - Declination of center of image.
                 pscale - Plate scale (arcsec/pixel).
                 rang   - Rotation angle of image (radians).
                 xflip  - -1 if image flipped in X, 1 if not.
                 yflip  - -1 if image flipped in Y, 1 if not.
                 xc     - X center of image.
                 yc     - Y center of image.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  ra     - Right ascension (radians)
  dec    - Declination (radians)

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/04/05 - Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/astxy2rd.pro)


ATMOFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	atmofit
 PURPOSE: (one line)
	Fit 1 or 2 gaussians to an astronomical image that is seeing limited.
 DESCRIPTION:
 CATEGORY:
	Function fitting
 CALLING SEQUENCE:
  atmofit,image,loc,guess,sub,resa,a,sigmaa,chisq
 INPUTS:
	image - 2-d data array to be fitted

	loc   - 4 element vector that specifies where to look in the image
	          for an object to fit.  This is passed to boxm to look for
	          the image maximum.  The components are:
	            loc(0) - X center of box.
	            loc(1) - Y center of box.
	            loc(2) - Half width of box in the X direction.
	            loc(3) - Half width of box in the Y direction.

	guess - Initial value guesses for the image fitting process.  There
	          are two possibilites:
	          1) one star (object) fit - guess is a scalar value that
	                                       is a guess at the 1/e width
	          2) two star (object) fit - guess is a three element vector
	                guess(0) = 1/e width of seeing
	                guess(1) = X location of fainter star relative to the
	                              center of the brighter object
	                guess(2) = Y location of fainter star relative to the
	                              center of the brighter object
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
	FILE   - string containing the FITS file name to read for image.
	           If read, then input parameter image is overwritten and
	           returned.
	FORCE  - If guess is set up for two stars, this forces the solution
	           for the second position relative to the first if set.
	WIDTH  - Number of pixels to attempt to extract from around the peak
	           pixel.  Subarray will be at most 2*WIDTH+1 square.
	           Extraction is truncated by the edge of the array.
		   Default is FIX( GUESS(0)*5.0 + 0.5 )
	DISPLAY - Show extraction, model fit and residual images on the
	           current display window.  Value indicates the zoom factor
	           for the displayed images.
 OUTPUTS:
	sub    - Extracted piece of image.
	resa   - Model fit to sub.
	a      - Coefficients of the fit.
	sigmaa - Uncertainties of the fitting coefficients.
	chisq  - Reduced chi-squared of the fit to sub.

 KEYWORD OUTPUTS:
	ERR    - uncertainty on MAG.
	MAG    - returns the magnitude of the object (scalar for a star,
	           three element vector for 2 gaussians [total, bigger, smaller]
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

(See /host/bluemoon/usr2/idllib/contrib/buie/atmofit.pro)


AVGCLIP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   avgclip
 PURPOSE:
   Average over a 3-D array, clipping unusual deviants.
 DESCRIPTION:
   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.
 CATEGORY:
   CCD data processing
 CALLING SEQUENCE:
   avgclip,array,average,SCALE=scale,NORMALIZE=normalize
 INPUTS:
   array = 3-D input array.  May be any type except string.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
   SCALE - 4 element vector which, if provide, defines the region of the
           array dimensions that are used to scale the mean
           of the arrays before combining.  If combined in this
           manner, the arrays are combined weighted by the means.
                 [x1,x2,y1,y2]

   NORMALIZE - Flag, if set and SCALE used, leaves the output average
                 normalized by the SCALE region.

   SILENT - Flat, if set will suppress all messages to screen.

 OUTPUTS:
   average - 2-D array that is the robust average of the stack.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
   1992 Dec 30, Marc W. Buie, Lowell Observatory, cloned from AVG
      and added average sigma clipping.
   95/03/10, MWB, extensive re-write to optimize.
   97/06/19, MWB, added SILENT keyword

(See /host/bluemoon/usr2/idllib/contrib/buie/avgclip.pro)


AVGER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   avger
 PURPOSE: (one line)
   Temporal averaging of time-series data.
 DESCRIPTION:
   This program was written to perform N point averaging of raw photometry
   data.  It will work on any temporal data streams or data that has clumpy
   independent variable values.  The data are grouped together into bin
   that are specified by the THRESH input.  Thresh specifies the size of a
   gap that will cause the group to be broken.  The value for thresh is taken
   to be a multiple of the 'normal' spacing between points.  If THRESH=2,
   then any gap twice as long as the previous point spacing will cause a
   break.  Any number equal to or less than 1 will prevent all averaging.
   To prevent too much binning for long uniform data runs, MAXBIN puts an
   upper limit on the number of points that can be grouped together and
   XSPREAD limits the xspan within a single group.

   The THRESH criterion is applied to the data first for grouping,
   then MAXBIN and XSPREAD are used simultaneously to break up long
   binning strings.

   The data are averaged together using a weighted average (see MEANERR).
   The uncertainty returned is the standard deviation of the mean.

 CATEGORY:
   Numerical
 CALLING SEQUENCE:
   pro avger,x,y,err,maxbin,thresh,avgx,avgy,sigy
 INPUTS:
      x      - Independent variable.
      y      - Dependent variable.
      err    - Uncertainty on y in units of standard deviation.
               This can be a scalar or a vector but must not be zero.
      maxbin - Maximum number of points to average together.
      thresh - Gap that will break grouping of data as a fraction of normal.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
      DATAERR - Output vector of sigma of the mean computed directly
                 from the scatter in the data.  If the number of points
                 in an output bin is one, then the output error is the
                 same as the input error.
      FORCEIT - 2xN vector, First column is a point number and the second
                 column is a flag, 0 means force this point to bin, 1 means
                 force a break at this point.  Point numbers outside of
                 the valid data range are silently ignored.  This info
                 if supplied overrides the breaking controlled by THRESH,
                 MAXBIN, and XSPREAD allowing a direct modification of
                 binning for pathalogical cases.
                    Example:
                       forceit=[[13,0],[14,1],[19,0]]
                    would force points 13 and 19 to NOT end the binning
                    and would force point 14 to be the end of a bin.
                    When using this option, VERBOSE is especially useful.
      XSPREAD - maximum range of x allowed in a single averaged point.
                 (default = no limit).
      VERBOSE - Flag, if true will cause a complete printout of how the
                 vector is being binned.
 OUTPUTS:
      avgx   - X value after binning.
      avgy   - Y value after binning.
      sigy   - New uncertainty.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
   The input vectors must have equal length and should be greater in length
   than 3.  If the vectors are of length 2 or 3, the program will return a
   straight average of all input values.  Scalar inputs are not allowed and
   will generate an error.
 PROCEDURE:
 MODIFICATION HISTORY:
    93/05/11 - Written by Marc W. Buie, Lowell Observatory.
    94/03/21, MWB, modified to output double precision if input is double.
    94/02/25, MWB, added XSPREAD control over binning.
    98/01/16, MWB, added DATAERR keyword

(See /host/bluemoon/usr2/idllib/contrib/buie/avger.pro)


AVGSPEC[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  avgspec
 PURPOSE: 
  Robust average of a set of 1-D spectra from FITS files.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  avgspec,root,outsuf,start,nspec,result
 INPUTS:
  root   - Root of file name(s) (no . at the end, may include path).
  outsuf - Suffix for the output file name.  (name will be root+'.'+outsuf)
  start  - First spectrum number of sequence to average.
  last   - Last spectrum number of sequence to average. (if negative, this
             number is interpreted to be the number of spectra to average).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  EXCLUDE   - Scalar or vector of spectrum numbers to exclude from average.
  SCALE     - range of pixels to use for scaling all spectra to each other.
              The default is to use all pixels for scaling.
  REFERENCE - Spectrum number to use as the scaling reference.  The scale
              factors are determined relative to this one.
  OUTROOT   - Root of output file name, default=root

  Values for header in output spectrum

  JD        - JD of midtime of output average spectrum (default=none)
  AIRMASS   - Effective airmass of spectrum (default=none)
  OBJECT    - Name of object (default=none)

 OUTPUTS:
  result - Final averaged spectrum.  This is also saved to a FITS file.
 KEYWORD OUTPUT PARAMETERS:
  SCFACTOR  - Vector of relative scaling factors for each spectrum.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/09/18 - Written by Marc W. Buie, Lowell Observatory
  96/05/29, MWB, changed 4th argument to LAST from NSPEC

(See /host/bluemoon/usr2/idllib/contrib/buie/avgspec.pro)


AVGSPEC[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  avgspec
 PURPOSE: 
  Robust average of a set of 1-D spectra.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  avgspec,specset,bad,avgspec
 INPUTS:
  specset - a 2-D array of spectra [pixel number,spectrum number]
  bad     - a 2-D array of badflags [pixel number,spectrum number]
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  SCALE - range of pixels to use for scaling all spectra to each other.
          The default is to use all pixels for scaling.
  REF   - Spectrum number to use as the scaling reference.  The scale
          factors are determined relative to this one.

 OUTPUTS:
  avgspec - Final averaged spectrum.
 KEYWORD OUTPUT PARAMETERS:
  SCFACTOR  - Vector of relative scaling factors for each spectrum.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  98/07/17 - Written by Chris Dalla Piazza, Lycoming College.  Extracted from
             the original avgspec program
  98/07/17 - Added denominator filter for the sf part.  Indices were also
             backwards for the badflags in that section.
  98/08/17, MWB, added return of bad flags on the average.

(See /host/bluemoon/usr2/idllib/contrib/buie/cavgspec.pro)


BACKSUB

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  backsub
 PURPOSE: 
  Background subtraction from an image.
 DESCRIPTION:
  The background is determined from a robust fit of a line to each row
     or column in the image depending on the keywords.  If neither keyword
     is set, then the robust mean is used.  These lines or means are then
     subtracted from the input image.

  For each row (or column) that is fit, the 6 most extreme points (from
     the mean) are removed from the first pass fit.  See the docs for
     GOODPOLY and the NEX keyword.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  backsub,image, [ROW,COLUMN]
 INPUTS:
     image - Image (2-d or 3-d) to subtract background from, image is
              modified in place.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     ROW    - Flag, if set, program assumes that image is flat along a row.
     COLUMN - Flag, if set, program assumes that image is flat along a column.

        Default is to assume that the image is flat along rows and columns.

     EXCLUDE- Scalar item or vector list of rows to exclude from background
                 fitting process.
  MAX_VALUE - The maximum value to be fitted.  If this keyword is provided,
                data values greater than MAX_VALUE are treated as missing
                and are not used in the fit for the background.
  MIN_VALUE - The minimum value to be fitted.  If this keyword is provided,
                data values greater than MIN_VALUE are treated as missing
                and are not used in the fit for the background.
     ORDER  - Order of polynominal to fit to background (ROW and COLUMN only),
              the default is 0 (mean of direction), 1 is linear, etc.
 OUTPUTS:
     image - Background subtracted image.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Only one of ROW and COLUMN can be set.

 PROCEDURE:
 MODIFICATION HISTORY:
  93/11/12, Written by Marc W. Buie, Lowell Observatory
  95/03/23, MWB, added ORDER keyword.
  98/06/08, MWB, Added MIN/MAX_VALUE keywords.

(See /host/bluemoon/usr2/idllib/contrib/buie/backsub.pro)


BADPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     badpar
 PURPOSE: (one line)
     Validate an input parameter against valid entries.
 DESCRIPTION:

     This is a general parameter checking function for validating input
     quantities in other procedures and functions.  This routine will
     generate an error message indicating what is wrong with the item.

     Example of use:

     pro foo,array
     if badpar(array,[4,5],2,CALLER='foo') then return
        .
        . code for foo .
        .
     end


     This would cause an immediate return to the routine that called foo
     with an error message if the input was not either floating or double
     and 2 dimensional.

     As of IDL v3.0, these are the recognized type codes (see 1-218 in
        reference guide).

        Type
        Code     Data Type
        ----    -----------------------------
          0      Undefined
          1      Byte
          2      Integer
          3      Longword integer
          4      Floating point
          5      Double-precision floating
          6      Complex floating
          7      String
          8      Structure

 CATEGORY:
  Utility
 CALLING SEQUENCE:
     val = badpar(param,goodtype,goodrank)
 INPUTS:
     param    - IDL variable to validate.
     goodtype - Scalar or vector of type codes that are valid.
     goodrank - Scalar or vector of valid ranks.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
     CALLER   - String identifying the calling routine.
     DEFAULT  - Value to return in param if undefined and undefined allowed.
     DIMEN    - Dimensions of variable.
     NPTS     - Total number of elements in variable.
     RANK     - Rank of variable.
     TYPE     - Type of variable.
 OUTPUTS:
     Return value is true if the parameter is bad.  False if good.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/24/93 - Written by Marc W. Buie, Lowell Observatory.
     4/27/93 - MWB, added TYPE and DEFAULT keywords.

(See /host/bluemoon/usr2/idllib/contrib/buie/badpar.pro)


BASPHOTE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    basphote
 PURPOSE: (one line)
    Circular aperture photometry extraction from images.
 DESCRIPTION:

 CATEGORY:
    CCD data processing
 CALLING SEQUENCE:
    Basphote,gain,image,exptime,xloc,yloc,radius,sky1,sky2,logfile[,objnum]

 INPUTS:
    gain       : Gain of the CCD.  Photons per count (DN).
    image      : CCD image array.
    exptime    : Exposure time for the image in seconds.
    xloc, yloc : Current location of the cursor in image coordinates.
    radius     : Current aperture radius in pixels.
    sky1       : Inner radius of the sky annulus (in pixels).
    sky2       : Outer radius of the sky annulus (in pixels).
    logfile    : Name of the photometry log file.

 OPTIONAL INPUT PARAMETERS:
    objnum     : Starting serial number for object in frame, default=0
                    If supplied as a scalar it will be incremented by
                    the number of positions supplied in xloc/yloc.
                 If given as a vector, will specify the exact number to
                    and there will be no incrementing when done.

 KEYWORD INPUT PARAMETERS: (default on flags is false):
    AIRMASS - Optional airmass value.
    ALTLOG  - Flag, if set, output is generated in an alternate format.
    BAD     - Flag (or array) marking data as bad, default=good
    BOXMRAD - Size of the box to look for local max in.  Default=radius.
                 If boxmrad is negative, then the call to BOXM that finds the
                 local max is suppressed.  In effect, basphote assumes that
                 the input location is already the maximum.  You still need
                 to provide a non-zero number for boxmrad so that a local
                 area is defined for the fwhm calculation.
    DT      - Delta-time, in seconds, between any two frames.
    EXACT   - Flag, if true: take position as exact; otherwise find it.
    FNAME   - File name of image.
               if ALTLOG set use the actual filename for the image on disk.
               if not set this should be an 8 character code that relates
                  to the image (Default is blank).
    FILTER  - Filter code, required if ALTLOG is set.
    JD      - Julian date of observation (mid-time), required if ALTLOG set.
    NAME    - Object name(s), required if ALTLOG set.
    NOLOG   - If set, no output logfile information is generated.
                 The default is to generate a log file.
    NOMEXT  - Optional nominal extinction.
    PRINTALL- Print all objects even if off chip (if printing enabled)
    PSCALE  - Plate scale in arc-sec per pixel, required if ALTLOG is set.
    SILENT  - Flag, if true --> Do not generate any screen output.
    ZPOINT  - Optional zero point.

 KEYWORD OUTPUT PARAMETERS:
    ERR     - Optional return of the magnitude error.
    FLERR   - Uncertainty (1 sigma) of object flux.
    FLUX    - Object flux (photons per second)
    FWHM    - FWHM of object image(s), in arcsec if PSCALE provided, otherwise
                 returned in pixels
    ONCHIP  - Byte array of flags that indicate if object was on-chip.
    OUTJD   - Optional output of Julian dates (for cubes). This will be a
              vector of length rank(image). Contents are computed from the
              input Julian date (JD=) and the input delta-time (DT=).
    MAG     - Optional return of the instrumental magnitude.
    MAX     - Optional return of peak signal in object.
    SKYMEAN - Optional return of sky signal, counts/pixel.
    SKYERR  - Optioanl return of sky signal uncertainty, counts/pixel.
    XCEN    - Optional output of centroid x-position(s).
    YCEN    - Optional output of centroid y-position(s).

 OUTPUTS:
    All output is sent to the screen and the logfile.  Selected variables are
 returned via optional keywords.

 COMMON BLOCKS:
    None.

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Ported by Doug Loucks, Lowell Observatory, 1992 Oct from the
    C-language version written by Marc Buie.

    1/6/93, Marc W. Buie, Lowell Observatory, added the alternate logfile
      format to the program.  Streamlined the required input parameters.
      Calling sequence is now different.

    1/25/93, MWB, changed default on boxmrad to be the LAST value in the
      radius vector.

    2/3/93, DWL. Moved the file format declarations outside of the main loop.
    2/4/93, DWL. Modified to accept all valid combinations of scalar and
      vector values for xloc, yloc, radius, sky1, and sky2 inputs.
    2/4/93, DWL. Added checks for 'seeing' sub-array extraction.
    2/4/93, DWL, Added keywords XCEN and YCEN to allow return of the refined
      center(s) to the calling program.  Also, xcen, ycen, xmax, and ymax
      will be vectors if xloc and yloc are vectors.
    2/10/93,DWL, Removed XMAX and YMAX keywords.
    2/10/93,DWL, Added checks for off-chip and too-near-edge conditions.
    4/21/93,DWL, Added keywords MAG and ERR.  The instrumental magnitude and
      uncertainty are returned to the caller if these keywords are present.
      If the inputs xcen and ycen are vectors, these variables will also be
      returned as vectors.
    5/21/93, MWB, Fixed variables that are undefined if off-chip condition
      is found.  Dummy values are set to prevent printouts from dying.
    5/26/93, MWB, Added FLUX, FLUXERR, and NOLOG keywords.  Fixed bug on
      computation of sky background error, errant gain factor removed.
    9/30/93, MWB, Modified usage of NAME to allow vector input.
    2/2/1994, DWL, Mods to allow 3-D image cube photometry. Also added
      OUTJD keyword.
    4/28/94, MWB, Fixed bug that recomputed a new centroid position if
      the EXACT flag was set.  This had NO effect on photometry.
    8/30/94, MWB, Added ONCHIP and PRINTALL keywords.
    5/18/95, MWB, Added FWHM optional output keyword.
    6/16/95, MWB, If PSCALE negative, fwhm not computed.
    1/8/96, MWB, Added override on serial number, objnum can now be a vector.
    7/13/96, MWB, changed FWHM calculation to remove function fitting.
   10/31/96, MWB, added BAD= keyword for flag pass through
    3/17/97, MWB, added MAX keyword
   97/09/10, MWB, removed extraneous sub-expression evaluation (5x faster).
   98/03/04, MWB, Added SKYMEAN, SKYERR return keywords.
   98/09/21, MWB, added suppression of BOXM call through a negative BOXMRAD.

(See /host/bluemoon/usr2/idllib/contrib/buie/basphote.pro)


BIDR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	bidr
 PURPOSE: (one line)
	Compute the bi-directional reflectance (old Hapke formula).
 DESCRIPTION:
 CATEGORY:
  Miscellaneous
 CALLING SEQUENCE:
	ans = bidr(w,emu,smu,g,holes,pzero)
 INPUTS:
	w     - Single scattering albedo.
	emu   - Cosine of the emission angle.
	smu   - Cosine of the incidence angle.
  g     - Phase angle, in radians.
	holes - Compaction parameter value (1981 formalism).
	pzero - Value of the single particle phase function.
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
	Return value is the bi-directional reflectance.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
       Any input may be a vector.  If more than one is a vector then the
       lengths must match.  The return will have the same dimensions as
       the input.
 PROCEDURE:
 MODIFICATION HISTORY:
       Written 1991 December, by Marc W. Buie, Lowell Observatory
       97/08/21, MWB, fixed phase angle bug, added g as input argument.

(See /host/bluemoon/usr2/idllib/contrib/buie/bidr.pro)


BIDR2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	bidr2
 PURPOSE: (one line)
	Compute the bi-directional reflectance (newer Hapke formula).  This
    is coded from equation 12.55 on page 346 in Hapke's book, "Theory of
    Reflectance and Emittance Spectroscopy".
 DESCRIPTION:
 CATEGORY:
  Miscellaneous
 CALLING SEQUENCE:
	ans = bidr2(w,emu,imu,g,holes,pzero,b0,theta)
 INPUTS:
	w     - Single scattering albedo.
	emu   - Cosine of the emission angle.
	imu   - Cosine of the incidence angle.
  g     - Phase angle, in radians.
	holes - Compaction parameter value (1986 formalism).
	pzero - Value of the single particle phase function.
  theta - Surface roughness value.  (radians)
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
	Return value is the bi-directional reflectance.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
       Any input may be a vector.  If more than one is a vector then the
       lengths must match.  The return will have the same dimensions as
       the input.
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1997/08/21
  97/09/18, MWB, added surface roughness parameter

(See /host/bluemoon/usr2/idllib/contrib/buie/bidr2.pro)


BILDMASK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  bildmask
 PURPOSE:
  Stack a set of bad pixel mask images into one master mask.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  bildmask,outfile
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:

(See /host/bluemoon/usr2/idllib/contrib/buie/bildmask.pro)


BOXM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    boxm
 PURPOSE: (one line)
    Find location of a maximum within a sub-array.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
    boxm, image, xcen, ycen, deltay, deltax, xmax, ymax
 INPUTS:
    image      : Image array.
    xcen, ycen : Center of sub-array.
    deltax     : Half-width of sub-array.
    deltay     : Half-height of sub-array.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    ABSMAX     : Flag, if set, looks for pixel with greatest absolute value.

 OUTPUTS:
    xmax, ymax : Coordinates, in image, of local maximum.

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Ported by Doug Loucks, Lowell Observatory, 1992 Oct, from the
    C-language version written by Marc Buie.
    4/1/93, DWL, Added argument validation (badpar).
    1/26/94, MWB, Added ABS argument.
    12/13/95, MWB, added support for 3-d input arrays.
    98/09/21, MWB, added NOCHECK keyword to speed up execution.

(See /host/bluemoon/usr2/idllib/contrib/buie/boxm.pro)


CALDATM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       caldatm
 PURPOSE:
       Find year, month, day, hour, minute, second from Julian Date.
 CATEGORY:
       Astronomy
 CALLING SEQUENCE:
       caldatm, jd, y, m, d, hour, min, sec
 INPUTS:
       jd = Julian day number (like 2447000.5).   in
 KEYWORD PARAMETERS:
 OUTPUTS:
       y = year (like 1987).                      out
       m = month number (like 7).                 out
       d = day of month (like 23).                out
       hour = hour of day (like 12).              out
       min = minute of day (like 0).              out
       sec = second of day (liek 0.0).            out
 COMMON BLOCKS:
 NOTES:
  This routine is based on the formulas given in "Astronomical Formulae for
    Calculators," 2nd. ed., by Jean Meeus on pages 23-29.  This algorithm
    works for any date in either the Julian calendar (before 1582 October 4)
    or the Gregorian calendar except for negative Julian Day numbers.

 MODIFICATION HISTORY:
       M. Buie, 1991 Oct 10, Lowell Observatory
       DWL, August 6, 1993, Modifications to operate with vector input.

(See /host/bluemoon/usr2/idllib/contrib/buie/caldatm.pro)


CALVAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    calval
 PURPOSE: (one line)
    Validate overscan, cropping region, and calibration file settings.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
    calval, isize, csize, mlow, mhigh, errflg
 INPUTS:
    isize  : Image size.
    csize  : Calibration file size.
    mlow   : Starting subscript in image.
    nhigh  : Ending subscript in image.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    BANNER    : Banner line printed with error report (if SILENT=0).
    CSIZELAB  : Label for csize parameter, if error condition is printed.
    MLOWLAB   : Label for mlowlab parameter, if error condition is printed.
    MHIGHLAB  : Label for mhighlab parameter, if error condition is printed.
    DELTAMLAB : Label for deltamlab parameter, if error condition is printed.
    SILENT    : If set, No error report is generated.
    ISIZELAB  : Label for isize parameter, if error condition is printed.
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, April, 1994.

(See /host/bluemoon/usr2/idllib/contrib/buie/calval.pro)


CCDGAIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   ccdgain
 PURPOSE: (one line)
   Extract and plot CCD gain transfer curve from flat field image data.
 DESCRIPTION:
 CATEGORY:
   CCD data processing
 CALLING SEQUENCE:
   ccdgain,dataset,flatname,biasname,frames
 INPUTS:
   root     - Root of the image file name (no path, with period).
   flatname - Filename of master flat field.
   biasname - Filename of bias frame.
   frames   - List of frame id's to process.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     93/04/03 - Initial conversion to procedure, Marc W. Buie, Lowell Obs.
     96/01/06 - MWB, added support for hardcopy under DOS/Windows
     97/03/15 - MWB, added use of MARKDATA

(See /host/bluemoon/usr2/idllib/contrib/buie/ccdgain.pro)


CCDPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ccdphot
 PURPOSE: (one line)
    General purpose display and processing of CCD image files (FITS).
 DESCRIPTION:
    A general purpose widget application which displays and processes CCD
 image files. This includes bias and flat field calibration and photometry
 reduction (itool).
    This procedure supports FITS files from the LCCD and LORAL instruments.
 CATEGORY:
    Widgets
 CALLING SEQUENCE:
    ccdphot[, keywords]
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    CALIBFILE=    : Calibration startup file.  Default is CALIBPATH/files.cal
    CALIBPATH=    : Path for calibration files.  Default is PATH/calib
    KEYLIST=      : Name of a file containing a correspondence list. This list
                    associates a set of standard names with the actual keyword
                    names found in a FITS file header. If this keyword is
                    omitted, a default list is used, as if a file with the
                    following contents had been supplied:
                     AIRMASS   K  AIRMASS
                     DATE      K  DATE-OBS
                     DATETMPL  T  DD-MM-YYYY
                     EXPDELTA  V  0.0
                     EXPTIME   K  EXPTIME
                     FILTER    K  FILTERS
                     FILENAME  K  CCDFNAME
                     OBJECT    K  OBJECT
                     UT        K  UT 
                    The middle column is a flag. It may be K, for Keyword,
                    T, for Template, or V, for Value. If it is V, the contents
                    of the third field on that line should make sense for the
                    name in the first field.

    PATH=         : Optional path for image and calibration directory.
                    If not specified, the current directory is used.
    PHOTPARMFILE= : Optional photometry parameter file.  Passed to Itool.
    TMPLFILE=     : Optional template file.  Passed to Itool.
    WZOOMFACT=    : Forces the cw_itool main draw window to have a specified
                    zoom factor (passed to cw_itool).

 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, December, 1993.
    Created by combining lccd.pro, loral.pro, and ccdphot_inst_init.pro.
    Added features include: Correspondence list for FITS header keywords
       and recognition of old format calibration environment files.
    1/26/94, DWL, Added header date-parsing code to ldimage procedure.
    3/2/94,  DWL, Added keylist item EXPDELTA.
    3/3/94,  DWL, Improved the template and header date-parsing process.
    3/10/94, DWL, Bug fixes.
    4/94,    DWL, Thorough validation of all environment parameters (overscan,
       cropping region, and bias/flat size compatibility).
    3/1/95,  MWB, Added support for a dark count calibrator (optional).
    6/8/95,  MWB, Changed defaults on calibration paths.  Also, if file
                  name begins with "+", CALIBPATH will replace the "+".
    10/31/95, MWB, Added CATCH error handler to trap bad image file reads
                  using READFITS.  This prevents a crash to the IDL prompt
                  when and invalid file is read.
    3/18/96, MWB, Minor change to code that reads UT from header.  Format
                  requires two colons in string (HH:MM:SS) but also now
                  allows SS to be a floating point number (ie., SS.sss).
    6/25/96, MWB, implemented AUTO(-photometry) button.
    1/22/97, MWB, fixed AUTO infinite loop if bad template positions found.
    2/5/97, MWB, added FWHM and Mag safety shutoff in AUTO
    6/13,97, MWB, extracted keylist to external general routines.

(See /host/bluemoon/usr2/idllib/contrib/buie/ccdphot.pro)


CENTROD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    centrod
 PURPOSE: (one line)
    Compute center of mass of an object aperture.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
    centrod, image, xcen, ycen, radius, inradius, outradius, skyback, $
             xbar, ybar, counts
 INPUTS:
    image          : CCD image array.
    xcen, ycen     : Center of window.
    radius         : Radius of window.
    inradius       : Inner radius of sky annulus.
    outradius      : Outer radius of sky annulus.
    skyback        : Sky background in counts per pixel.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    xbar, ybar     : Position of center of mass.
    counts         : Mass of object in counts.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Ported by Doug Loucks, Lowell Observatory, 1992 Oct, from the C-
    language version written by Marc Buie.
    4/1/93, DWL, Added argument validation (badpar).

(See /host/bluemoon/usr2/idllib/contrib/buie/centrod.pro)


CGETRNG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cgetrng
 PURPOSE: (one line)
    How to integrate over a circle.
 DESCRIPTION:
    This procedure is called to determine how to iterate when integrating
 over a circle.  The circle's center is at (xc,yc), and its radius is r.
 For pixels with x-coordinate x, those in the intervals [y0,y1) and [y2,y3)
 are on or near the circle.  Those in the interval [y1,y2) are definitely
 inside; all others are definitely outside.
    Of course, the routine can be called to determine an interval for fixed
 y by calling it as cgetrng,yc,xc,r,y,x0,x1,x2,x3.
    The appropriate way to integrate over a circle is therefore as follows:
 cgetrng,xc,yc,r,Round(xc),y0,y1,y2,y3
 for (y = y0; y <= y3-1; y=y+1) {
    cgetrng, yc, xc, r, y, x0, x1, x2, x3;
    for (x = x0; x <= x1-1; x=x+1) sum = sum + value(x,y)*pixwt(xc,yc,r,x,y);
    for (x = x1; x <= x2-1; x=x+1) sum = sum + value(x,y);
    for (x = x2; x <= x3-1; x=x+1) sum = sum + value(x,y)*pixwt(xc,yc,r,x,y);
    }
 CATEGORY:
    CCD data processing
 CALLING SEQUENCE:
    cgetrng, xc, yc, r, x, y0, y1, y2, y3
 INPUTS:
    xc, yc : Center of the circle.
    r      : Radius of the circle.
    x      : X coordinate for the intervals to be determined.
 OPTIONAL INPUT PARAMETERS:
    None.
 KEYWORD PARAMETERS:
    None.
 OUTPUTS:
    y0, y1, y2, y3 : The endpoints of the three intervals of interest.
 COMMON BLOCKS:
    None.
 SIDE EFFECTS:
 RESTRICTIONS:
    None.
 PROCEDURE:
    Determine three intervals along the x input coordinate:  The
    intervals [y0,y1), [y1,y2), and [y2,y3).
 MODIFICATION HISTORY:
    Ported by Doug Loucks, Lowell Observatory, 1992 Sep, from the
    routine cgetrng in pixwt.c, by Marc Buie.
    4/1/93, DWL, Added argument validation (badpar).

(See /host/bluemoon/usr2/idllib/contrib/buie/cgetrng.pro)


CLEAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   clean
 PURPOSE: 
   Remove a PSF from an image via the ``clean'' algorithm.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
   clean,image,psf,xloc,yloc,maxdist,iters,new_image,resid $
       DISPLAY=display,VERBOSE=verbose
 INPUTS:
   image     - Original source image to be cleaned.
   psf       - PSF image at same sampling resolution as image.
   xloc      - X location of "object"
   yloc      - Y location of "object"
   maxdist   - Maximum distance from xyloc to look for local max.
   iters     - Number of cleaning iterations to perform.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
   CROSS     - If set to a number greater than or equal to 0, the peak at
               each iteration is found by using a cross-correlation
               of the psf against the image rather than just using raw DN.
               If 0, then the full size of the psf is used.  If 1 or greater,
               a sub-region from the center that is 2*CROSS+1 pixels square
               is used as the convolution kernal.
   DISPLAY   - Display intermediate results, if 0, this is suppressed,
                 if non-zero, this is the interval for the display, that is,
                 DISPLAY=10 would cause a display every 10th iteration.
   GAIN      - "Gain" of the clean process, the default value is 0.05 and
                 is the scaled amount of the psf removed at each step.
   VERBOSE   - Verbose printout of intermediate steps to the screen.  Just
                 like display, VERBOSE=0 suppresses output, VERBOSE=n will
                 print information every nth iteration.
 OUTPUTS:
   new_image - Clean-ed image result.
   resid     - Remains of the original image after clean-ed image is removed.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
   1/26/94, written by Marc W. Buie, Lowell Observatory, algorithmic insight
              graciously provided by Tod Lauer (NOAO, Tucson).
   2/25/94, MWB, added GAIN and CROSS keywords.
   5/19/94, MWB, changed psf normalization from peak to total.  Should
              now be strictly flux conserving.
   5/21/94, MWB, Changed CROSS to allow for only a portion of psf for
              convolution.

(See /host/bluemoon/usr2/idllib/contrib/buie/clean.pro)


CLEANDAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  cleandat
 PURPOSE: 
  Interactive program to eliminate and smooth over bad data points.
 DESCRIPTION:

  The data are plotted to window 6, then the cursor becomes active.
  Clicking right will exit the routine.  Clicking left will select a
  point for change.  After a left click, you must click again at the
  y value to give to the corrected point.  A running display helps
  identify the current point that the cursor is nearest to in X.

  Clicking the middle button will cause the point nearest the cursor
  (in X) to be replaced by the average of its nearest neighbors.

 CATEGORY:
  2-D plotting
 CALLING SEQUENCE:
  cleandat,xval,yval
 INPUTS:
  xval - Input vector of x values.
  yval - Input vector of y values (modified).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  TITLE - Optional title for plot
 OUTPUTS:
  yval - (potentially) cleaned version of y values.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
  Uses graphics window 6 and forces its size.  !p.multi is also set to 0.
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/24, Written by Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/cleandat.pro)


CLNSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  clnspec
 PURPOSE: 
  Interactive cleaning of bad pixels in an OSIRIS XD spectrum.
 DESCRIPTION:
  Plots one order at a time and allows cleaning up bad pixels.  The left
    mouse button is used to alternately mark bad pixels and then their new
    new value for visual interpolating.  The middle button causes the
    nearest point to be replaced by the average of its two nearest
    neighbors.  CLEANDAT is called on each order.
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  clnspec,calib,spec
 INPUTS:
  calib- Anonymous structure containing all pertinent calibration
           information.  This structure is usually loaded beforehand using
           the routine, "ldcalir"
  spec - 1-D spectrum vector to be cleanded (will be modified in place).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  spec - Cleaned 1-D spectrum vector
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
  Uses graphics window 6 and forces its size.  !p.multi is also set to 0.
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/09/15, Written by Marc W. Buie, Lowell Observatory
  96/05/28, MWB, added changes for new calib structure

(See /host/bluemoon/usr2/idllib/contrib/buie/clnspec.pro)


CLSCAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  clscan
 PURPOSE:
  Scan a group of raw OSIRIS XD frames and find rough spectral location.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  clscan,calib,root,start,last,frno,mate,RANGE=range,PATH=path
 INPUTS:
  calib- Anonymous structure containing all pertinent calibration
           information.  This structure is usually loaded beforehand using
           the routine, "ldcalir"
  root - string containing the root of the file name (with leading path
         if desired).  DO NOT include the . between the root and suffix.
  start  - First spectrum number of sequence to scan.
  last   - Last spectrum number of sequence to scan, if negative, this number
             is taken to be the number of spectra to scan.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  PATH - optional string that points to the directory containing the data.
           This information is not used if the root already begins with '/'.
           If root is not an absolute pathname, then PATH is prepended to
           root for READ operations.  This path is not used for saving.
           This allows reading from one directory (possible a read only area)
           and then saving to the current directory.
  XRANGE - range of column numbers to average in extracted spectral slice to
           find rough location of spectrum.  Default is all columns.
  YRANGE - range of rows that are valid locations.  Default is all rows but the
           first and last.
  EXCLUDE- List of frames in the indicated range that should be excluded from
           consideration.

 OUTPUTS:
  frno - A vector of frame numbers.
  mate - A vector that gives a suggested frame number from this set for
           a sky pair match that does not overlap the object.
  
  Also, information on location for each spectrum is printed to the console.

 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Specifically written for OSIRIS cross-dispersed spectral data.
 PROCEDURE:
 MODIFICATION HISTORY:
  95/09/27, Written by Marc W. Buie, Lowell Observatory
  96/05/29, MWB, changed 4th argument from NSPEC to LAST.
  97/08/07, MWB, removed RANGE (buggy) and added XRANGE and YRANGE
  97/12/10, MWB, fixed a really nasty bug that corrupt the location for
                   very high signal-to-noise data.
  98/07/01, MWB, added code to skip over missing files in sequence.

(See /host/bluemoon/usr2/idllib/contrib/buie/clscan.pro)


COLBIAS

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  colbias
 PURPOSE:
  Determine and subtract column-wise overscan correction with cropping.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  result=colbias(array,x1,x2,xc1,xc2,yc1,yc2)
 INPUTS:
  array - Input array to perform operation on (2-D)
  x1    - First column for overscan region
  x2    - Last column for overscan region
  xc1   - X coordinate of LLHC of sub-array to save (default=0)
  xc2   - X coordinate of URHC of sub-array to save (default=last pixel)
  yc1   - Y coordinate of LLHC of sub-array to save (default=0)
  yc2   - Y coordinate of URHC of sub-array to save (default=last pixel)
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  return value is the overscan corrected, cropped image.
 KEYWORD OUTPUT PARAMETERS:
  BIASVAL - the mean of the overscan area is returned.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/06/13 - Initial version written, Marc W. Buie, Lowell Observatory

(See /host/bluemoon/usr2/idllib/contrib/buie/colbias.pro)


COLORSOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  colorsol
 PURPOSE: 
  Find the standard color of an unknown star.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  colorsol, stand,fil,am,serial,inst,instsig, $
             color1,color2,trans1,trsig1,jdref1,trans2,trsig2,jdref2, $
             object,std1,stdsig1,std2,stdsig2,stdcol,stdcolsig, $
             [ FULL, NOPRINT ]
 INPUTS:
  stand    - String array of standard names.  (See coord.)
  fil      - String array of filter names for observations.
  jd       - Double precision array of the JD of observations.
  am       - Floating point array of the airmass of observations.
  serial   - Serial number of observation.
	inst     - Instrumental magnitude
	instsig  - Uncertainty of the instrumental magnitude
  color1   - Name of filter for the first color.
  color2   - Name of filter for the second color.
	trans1   - Transformation coefficients (vector) for first filter.
                trans1(0) = principal extinction coefficient
                trans1(1) = second order extinction coefficient
                trans1(2) = color term
                trans1(3) = zero-point
  trsig1   - Uncertainty on the transformation coefficients (vector).
  jdref1   - Time reference point for extinction (first filter).
	trans2   - Transformation coefficients (vector) for second filter.
	trsig2   - Transformation coefficients (vector) for second filter.
  jdref2   - Time reference point for extinction (second filter).
  
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  NOPRINT - Flag, if true, will inhibit the summary printout to the screen.
  FULL    - Flag, if true, will enable the complete printout, otherwise
              just the final summary for each object will be printed.
  PATH    - If SUFFIX is provided, this points to the directory where
              results should be written.
  SAVE    - Flag, if true, will save the final photometry to an output file.
              The filter names must be provided as well.
  DATE    - Date tag (6 characters, YYMMDD) to use when saving data.
  FILTER1 - Name of the first filter
  FILTER2 - Name of the second filter
  BADFLAGS - Array of flags that mark data bad (if true).
  NOEDIT  - If set, suppresses the interactive editing of the star data.
 OUTPUTS:
  object    - Name(s) of program object.
	std1      - Standard magnitude of first filter.
	stdsig1   - Uncertainty of the standard magnitude.
	std2      - Standard magnitude of second filter.
	stdsig2   - Uncertainty of the standard magnitude.
	stdcol    - Standard magnitude of second filter.
	stdcolsig - Uncertainty of the standard magnitude.
 KEYWORD OUTPUT PARAMETERS:
  BADFLAGS - Array of flags that mark data bad (if true).
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory
  96/11/25, MWB, added PATH, SAVE, FILTER1, and FILTER2 keywords
  97/02/11, MWB, added new transformation support (k(t))
  97/02/25, MWB, added NOEDIT keyword and actions

(See /host/bluemoon/usr2/idllib/contrib/buie/colorsol.pro)


COORD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     coord
 PURPOSE: (one line)
     Given a list of names and JD, return coordinates (RA and Dec).
 DESCRIPTION:
 CATEGORY:
     Photometry
 CALLING SEQUENCE:
     coord,jd,obs,object,namefile,ra,dec
 INPUTS:
     jd       - Julian date (scalar or vector).
     obs      - Observatory code, Marsden's IAUC codes (scalar).
     object   - Object name (scalar string or string array).
     namefile - Correspondence file to match up to standard names.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     LAND1   - Optional name for the Landolt 1983 Standards Catalog.
     LAND2   - Optional name for the Landolt 1992 Standards Catalog.
     PRICAT  - Name of private star catalog file for X star catalog.
                 Default = 'private.cat'  in current directory.
     B1950    - If set, will return B1950 equinox coordinates (def=of date).
     J2000    - If set, will return J2000 equinox coordinates (def=of date).
 OUTPUTS:
     ra  - Right ascension of object in radians.
     dec - Delination of object in radians.
 KEYWORD OUTPUT PARAMETERS:
     STANDARD - string array of standard names that match up to object.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/31/93 - Written by Marc W. Buie, Lowell Observatory
     10/5/93, MWB, added support for two Landolt catalogs.

(See /host/bluemoon/usr2/idllib/contrib/buie/coord.pro)


CPUTIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cputime
 PURPOSE: (one line)
    Return the accumulated user and system times since an arbitrary time.
 DESCRIPTION:
    The overhead in using this procedure is about 3 milliseconds per call.
 CATEGORY:
    Utility
 CALLING SEQUENCE:
    cputime, utime, stime
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
    utime : CPU user time in seconds.
    stime : CPU system time in seconds.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    The CALL_EXTERNAL function of IDL is used to communicate with a function
  written in C.  This function is cputime.c which, compiled and linked, has
  entry point 'cputime' in the Shareable Object Library file 'cputime.so' in
  /gryll/data1/dwl/idl.
    See /gryll/data1/dwl/idl/cputime.c for further information.
 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, April, 1993.

(See /host/bluemoon/usr2/idllib/contrib/buie/cputime.pro)


CRMATCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    crmatch
 PURPOSE: (one line)
    Create a standard name --- non-standard name correspondence file.
 DESCRIPTION:
    Creates, from a photometry log file (alternate format) and a standard
 name --- non-standard name correspondence file, a new standard name ---
 non-standard name correspondence file.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
    crmatch, in_logfile, in_namesfile, out_namesfile
 INPUTS:
    in_logfile    : Photometry log file (alternate format).
    in_namesfile  : Any existing correspondence file.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    out_namesfile : The new correspondence file.
 COMMON BLOCKS:

 SIDE EFFECTS:
    Calls external routines badpar, rdphalt and exists.
 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, September 30, 1993.
    10/15/93, DWL, Added existence checks for the input file names and
 type validation for all parameters.
    5/11/94, DWL, Changed call to rdphotalt to rdphalt.

(See /host/bluemoon/usr2/idllib/contrib/buie/crmatch.pro)


CW_IPMGR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_ipmgr
 PURPOSE: (one line)
    Display and edit itool image parameters.
 DESCRIPTION:

 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    result = cw_ipmgr( parent )
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    UVALUE = Optional user value.
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory.
    June 17, 1994, DWL, Converted to Compound Widget.

(See /host/bluemoon/usr2/idllib/contrib/buie/cw_ipmgr.pro)


CW_ITOOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_itool
 PURPOSE:
    General purpose image display.
 DESCRIPTION:
 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    result = cw_itool( parent )
 INPUTS:
    parent : The parent application base (Should be a Top Level Base).
 OPTIONAL INPUT PARAMETERS:
    image : The image array to be displayed.
 KEYWORD PARAMETERS:
  FVISIBLE       :  Size of the full-view window (128 pixels).
  NODISMISS      :  If set, the Dismiss button is not sensitive.
  PHOTPARMFILE   :  Optional photometry parameters file.
  XSIZE          :  The image X-size (required).
  YSIZE          :  The image Y-size (required).
  WXVISIBLE      :  Creates work window with explicit x-size (500).
  WYVISIBLE      :  Creates work window with explicit y-size (500).
  WZOOMFACT      :  Ceiling for work-view zoom factor (unlimited).
  ZVISIBLE       :  Size of the zoom window (128 pixels).

 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, June 1994.
    This version is a major re-write, employing the compound widget design
 introduced in Version 3 of IDL.
 94/10/27, MWB, Lowell Observatory, fixed ZOON bug on line 1144.
 95/01/24, MWB, xcen,ycen size mismatch storing back to template if array is
           3-d.  Fixed to copy *last* position from Basphote return.
 95/06/12, MWB, Fixed bug in stretch range computation for large cubes of
           small images.
 95/09/07, MWB, Changed auto-stretch computation to make it more robust.
 95/10/31, MWB, Fixed widget layout problem caused by IDL v4.0 changes.
 96/01/06, MWB, Changed W*VISIBLE default to recognize smaller screens.
 96/01/16, MWB, Fixed !order=1 bug in mouse event handling.
                Fixed Stretch Menu operational bugs for handling image cubes.
 96/06/25, MWB, Added autophot support
 97/12/12, MWB, changed display to include more image info on main window.

(See /host/bluemoon/usr2/idllib/contrib/buie/cw_itool.pro)


CW_OSIPL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  cw_osipl
 PURPOSE:
  Display the various spectra generated by xdavg 
 DESCRIPTION:

  This program takes spectra, badflags, and profiles and displays them via a
    multiple page format.  Several spectra can be plotted at once by selecting
    the number of columns and rows to use to display the spectra.  If profiles
    are provided then they are plotted alongside the spectra.  A smoothing
    factor can also be applied to the spectra to reduce the effects of noise.
    The y-range of the plots can be specified by switching to the "fixed"
    option.  The automatic y-range is a min-max range.  The current page can
    also be printed out or all pages and the printer to which they go be
    specified

 CATEGORY:
  Compound widget
 CALLING SEQUENCE:
  cw_osipl,leader,type
 INPUTS:
  leader - the Id of the mainbase of the calling widget
  type   - a flag indicating whether or not the the plot is called from the top
           or the bottom of the xdavg tool.  Different defaults are implied by
           this for the number of rows and columns as well as the size cw_osipl
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  TITLE - Optional title of widget, default = 'OSIRIS XD PLOT'
 OUTPUTS:
  Spectra and profiles are plotted to the screen and can be printed
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  
  This plot widget is used by creating it as a compound widget from within the
    calling program and recording its Id.  Plots are then displayed by the
    program by setting its value to the following data structure in a
    widget_control statement:

  data={

        *Required information*

        nspecs:  The number of spectra that need to be plotted
        calib:   The calibration structure for the spectra
        pref:    The index of the spectrum that is prefered to be displayed
        filenam: The filename of the spectrum, this added to the objname field
                 is displayed as the title of the plot
        objname: The name of the object
        display: The array of spectra to be plotted
        badflag: The array of badflags to be plotted
        pflag:   Flag indicating whether profiles are to be hidden
        cflag:   Flag indicating whether a each order of the spetrum should be
                 plotted in a different color
        pageflg: Flag to indicate that the plotter should only replot if the
                 prefered spectrum is not on the current page

        *Optional information*

          (required if pflag is set)
        prof:    The array of profiles values
        index:   The indices for the profile points
        upbnd:   The upper bound values for the sky level for the profiles
        lwbnd:   The lower bound values for the sky level for the profiles
        relsig:  The signal relative to the brightest spectrum in the set
        mate:    The mate used in the extraction by xdspec

        airmass: The airmass for each spectrum
        juldate: The Julian date of the exposure
        exptime: The exposure time of the spectrum
        ncoads:  The # of coadds used to make the spectrum

        } - UVALUE of state.mainbase

 MODIFICATION HISTORY:
  98/06/12 - Written by Chris Dalla Piazza, Lycoming College

(See /host/bluemoon/usr2/idllib/contrib/buie/cw_osipl.pro)


CW_PFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_pfile
 PURPOSE: (one line)
    Widget application for plots and profiles of an image.
 DESCRIPTION:

 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    result = cw_pfile( parent )

 INPUTS:
    parent : Widget id of parent.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    HCTITLE    = Title of Hard Copy.
    PLATESCALE : Plate Scale in arcseconds per pixel (used at display time).
                 If supplied and non-zero, display the bottom axis in
                 arcseconds and the top axis in pixels, else display the
                 bottom axis in pixels.
    UVALUE     = Optional user value.

 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    After placing this compound widget on a base, that base must then be
 realized. After realization, the image array and set-point coordinates are
 supplied via the WIDGET_CONTROL procedure and the SET_VALUE keyword.
    The 'value' of cw_pfile is a structure having three tags: image, xset,
 and yset.

    The following illustrates the procedure:

    array      = some portion of a larger 2-D array.
    xset, yset = set-point of the lower portion of the extracted array.

    result = cw_pfile( parent )
    Realize the hierarchy of parent.
    WIDGET_CONTROL, result, SET_VALUE={image:array, xset:xset, yset:yset}

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, April, 1994.
    June, 1994, DWL, Converted to Compound Widget.
    March 1996, MWB, added print support for DOS

(See /host/bluemoon/usr2/idllib/contrib/buie/cw_pfile.pro)


CW_PIXED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_pixed
 PURPOSE: (one line)
    Pixel editor.
 DESCRIPTION:
    This compound widget may be used to edit a grid of pixels in an array.
 Unless near the edge of the image, the grid is centered on (xpos, ypos).
 The left column and the bottom row display the y and x coordinates,
 respectively, for the grid. Xpos and ypos are enclosed in brackets,
 for identification.
 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    result = cw_pixed( parent, image, xpos, ypos )
 INPUTS:
    parent      : The id of the parent widget.
    image       : The array to be edited.
    xpos, ypos  : The pixel at this location in the array, along with a
                  collection of its neighbors, will be displayed as a grid of
                  editable text widgets.

 OPTIONAL INPUT PARAMETERS:

 INPUT KEYWORD PARAMETERS:
    GRIDSIZE = The size of the grid of surrounding pixels. Default
               is 7 pixels (7X7 grid). Note: In order to maintain symmetry
               about the center pixel, the grid size needs to be odd.
               Therefore, even values will be increased by 1 pixel.

 OUTPUTS:
    result : The id of the compound widget.
 COMMON BLOCKS:

 SIDE EFFECTS:
    This compound widget generates events with the following structure:
    { id:0L, top:0L, handler:0L, type:0, count:0, x:0, y:0, value:v }
    where,
       type    The event type (0=Done, 1=single pixel changed).
       count   Specifies the number of elements in the remaining three tags
       x and y Coordinates of changed pixel(s).
       value   Value(s) for changed pixel(s).

    The zero values in the above structure indicate the data types for the
 those tags, not the actual values. The 'value' tag will be the same type
 as the data in the array being edited.

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, April 28, 1994.
 95/10/31, MWB, Fixed widget layout problem caused by IDL v4.0 changes.

(See /host/bluemoon/usr2/idllib/contrib/buie/cw_pixed.pro)


CW_PPMGR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_ppmgr
 PURPOSE: (one line)
    Display and edit itool photometry parameters.
 DESCRIPTION:

 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    result = cw_ppmgr( parent )
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    UVALUE = Optional user value.
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory.
    June 17, 1994, DWL, Converted to Compound Widget.

(See /host/bluemoon/usr2/idllib/contrib/buie/cw_ppmgr.pro)


CW_TPLAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_tplat
 PURPOSE: (one line)
    Create a photometry template widget.
 DESCRIPTION:
    Th