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:
    This compound widget is invoked on a Top Level Base (from The Template
 Manager) and represents an individual template.
    Each template managed by The Template Manager has its own TLB and
 appears as a separate widget.
    The template structure for each template is stored in the user-value of
 its TLB.
 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:

 INPUTS:
    parent : ID of parent base.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    UVALUE = Optional user-value.
    VALUE  = The 'value' of the widget. Defined to be the template structure.
             This value may be obtained, or set, by using the widget_control
             procedure with its appropriate keywords. The value structure is:
                {numobj:0, mode:0B, modified:0B, new:[1B], $
                 objnam:[''], x:[0.0], y:[0.0] }
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, June 24, 1994. Adapted from
 a previous section of code in the main template manager procedure.
    96/01/16 - MWB, fixed bug that crashed template manager after deleting
                 objects from template.

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


CW_TPMGR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    cw_tpmgr
 PURPOSE: (one line)
    Photometry template manager for itool.
 DESCRIPTION:

 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    result = cw_tpmgr( parent )
 INPUTS:
    parent = ID of parent base.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    TMPLFILE = Name of file containing templates.
    UVALUE   = Optional user value.
 OUTPUTS:

 COMMON BLOCKS:
 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, July, 1994. This version
 is completely new.
  97/12/12, MWB, Changed behavior to sort the template list by name.

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


DECPARSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  decparse
 PURPOSE:
  Convert Declination string to radians.
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  dec=decparse(str)
 INPUTS:
  str - String (or array) to parse as a declination
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return value is scalar or vector value of Dec in radians
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  1997/06/04, Written by Marc W. Buie, Lowell Observatory

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


DECSTR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    decstr
 PURPOSE: (one line)
    Convert declination in radians to an ASCII string.
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    decstr, declination, places, str
 INPUTS:
    declination - Declination, in radians, to be converted to a string.  May
                  a vector, in which case the output will be a vector.
    places      - Resolution of output string.
             = -7     nearest hour.                    +DD
             = -6     nearest 30 minutes.              +DD:(00,30)
             = -5     nearest 15 minutes.              +DD:(00,15,30,45)
             = -4     nearest 10 minutes.              +DD:M0
             = -3     nearest 5 minutes.               +DD:M(0,5)
             = -2     nearest minute.                  +DD:MM
             = -1     nearest ten seconds.             +DD:MM:S0
             =  0     nearest second.                  +DD:MM:SS
             =  1     nearest tenth of a second.       +DD:MM:SS.s
             =  2     nearest hundredth of a second.   +DD:MM:SS.ss
             =  3     nearest thousandth of a second.  +DD:MM:SS.sss
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    str         - Output string for the converted declination.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    Declination (in the range [-pi/2,pi/2]) is converted to a string.
    The sign of the declination is always provided and there are no imbedded
    blanks.  PLACES indicates the reported precision of the string.
    Calls external routine radtodms.
 MODIFICATION HISTORY:
  Copyright (C) 1987,91, by Marc W. Buie
  Version dated 91/8/5
  Ported by Doug Loucks, Lowell Observatory, August 11, 1993, from the
 C-Language version written by Marc Buie.

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


DERIV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    deriv
 PURPOSE: (one line)
    Compute the step-wise derivative of a function of one variable.
 DESCRIPTION:
      Calculates the step-wise derivative of a function by computing
  deltaf / deltax.  This requires that f and x be vectors with at least
  two elements.
      The uncertainties associated with the dependent variable of the
  function may be supplied via a keyword, in which case the uncertainties
  associated with the derivative are returned to the caller via another
  keyword parameter.
 CATEGORY:
    Mathematical
 CALLING SEQUENCE:
    deriv, x, f, newx, fprime, [, FERR=in_ferr, FPERR=out_fperr]
 INPUTS:
    x    : Independent variable.
    f    : Dependent variable.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    FERR   = Uncertainty in f (optional input).
    FPERR  = Uncertainty in fprime (optional output).
 OUTPUTS:
    newx   : The centered x-values corresponding to fprime.
    fprime : The computed derivative of the dependent variable.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, July, 1993.

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


DEWP

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  dewp
 PURPOSE: 
  Compute dew point temperature give temperature and relative humidity
 DESCRIPTION:
 CATEGORY:
  Miscellaneous
 CALLING SEQUENCE:
  dewp,temp,rh,dp,CELCIUS=celcius
 INPUTS:
     temp - Air Temperature
     rh   - Relative Humidity
 OPTIONAL INPUT PARAMETERS:
     celcius - Flag, if true, all temperatures in Celcius, otherwise Farenheit
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
     dp   - Dew point temperature
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by: Marc W. Buie, Lowell Observatory, 1995 April 28

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


DIFREF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	difref
 PURPOSE: (one line)
	Compute amount of atmospheric refraction relative to 5000 Angstroms.
 DESCRIPTION:
	this function is based on the formulas in Filippenko, PASP, v. 94,
	pp. 715-721 for the index of refraction of air (routine REFRAC).
 CATEGORY:
  Miscellaneous
 CALLING SEQUENCE:
	ans = difref(wave,pressure,temp,water,zenith)
 INPUTS:
	wave     - Wavelength of light, in microns.
	pressure - Atmospheric pressure, in mm of Hg.
	temp     - Atmospheric temperature, in degrees C.
	water    - Water vapor pressure, in mm of Hg.
	zenith   - Angle from the zenith, in radians.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Returns the amount of differential refraction in arcseconds.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1991 Feb, by Marc W. Buie, Lowell Observatory

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


DIGIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    digit
 PURPOSE: (one line)
    Digitize from a displayed gif file.
 DESCRIPTION:
 CATEGORY:
    Image display
 CALLING SEQUENCE:
    digit, image, outfile
 INPUTS:
    image   : Image to be displayed.  May be a string scalar containing the
              name of a GIF file to be loaded and displayed, or an image
              array to be displayed.
    outfile : File into which collected points are saved.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
    NATURAL    = If set, the natural screen coordinates are used.  No
                 control points are solicited and no coordinate
                 transformations are computed.
    NOSCALE    = If set, the image is displayed without being scaled.
    ROTATE     = Rotation angle (in degrees) for the gif image.  Allowed
                 values are 90, 180, and 270 counterclockwise.
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
    XVEC, YVEC = If both of these keywords are present, the collected
                 coordinates are returned as vectors to the variables
                 specified in the keywords.  The collected coordinates are
                 always written to the output file.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
    Unless the 'NATURAL' keyword is specified, four control points and four
 associated values are requested in order to define the x and y axes and
 scale factors.
    The first two points are the x-axis control points (and their values) and
 the second two are the y-axis control points (and their values).
    Control vectors are computed from the requested control points and
 coordinate transformations are computed using simple vector algebra.
 MODIFICATION HISTORY:
  Written by Doug Loucks, Lowell Observatory, April, 1993.
  94/10/04 - MWB - moved cr to front of print statement (v3.6 bug workaround)

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


DISPHASE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  disphase
 PURPOSE: 
  Apply distance and phase angle correction to observed magnitudes.
 DESCRIPTION:
  Apply IAU standard asteroidal-law corrections to observed magnitudes
     given the distance, phase angle, and the G coefficient.  Magnitudes
     are corrected to 1 AU from Sun and Earth and to 0 degrees phase angle.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  disphase,mag,r,d,phang,g,hmag
 INPUTS:
     mag   - Observed magnitude.
     r     - Sun-object distance in AU.
     d     - Earth-object distance in AU.
     phang - Phase angle of observation in degrees.
     g     - IAU standard G value (phase angle coefficient).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
     hmag  - Magnitude corrected for distance and phase angle.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


DISPLAY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	display
 PURPOSE: (one line)
	IDL procedure for initializing the X window display for plotting.
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
 INPUTS:
	None.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


DMSTORAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    dmstorad
 PURPOSE: (one line)
    Convert from degrees, minutes, and seconds to radians.
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    dmstorad, sign, deg, min, sec, radians
 INPUTS:
    sign : Sign associated with the inputs.  Must be -1, or +1.
    deg  : Degrees.  No restrictions.
    min  : Minutes.  0   <= min < 60.
    sec  : Seconds.  0.0 <= sec < 60.0.
    If more than one of these are vectors, they must be the same length.
    A mixture of scalar and vector input parameters is equivalent to all three
 inputs being vectors: The scalar inputs are treated as replicated vectors.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    radians  : Converted angle in radians.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    The input declination is in four parts.  The sign is carried as a separate
 value, to make angles near zero behave correctly.
 MODIFICATION HISTORY:
    Copyright (C) 1987, by Marc W. Buie
    Version dated 87/6/3
    Ported by Doug Loucks, Lowell Observatory, August 12, 1993, from the
 C-Language version written by Marc Buie.

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


EDGEFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  edgefit
 PURPOSE:
  Fit an edge between two signal levels
 DESCRIPTION:
 CATEGORY:
  Function fitting
 CALLING SEQUENCE:
  edgefit,x,y
 INPUTS:
  x - independent variable (vector)
  y - dependent variable (vector)
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  Two plots are generated and the fitted values are printed to the screen.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/12/23, Written by Marc W. Buie, Lowell Observatory

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


EPH4MOVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  eph4move
 PURPOSE:
  Generates ephemeris files for use by the MOVE computer.
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  eph4move,objfile,outfile,TIME=time
 INPUTS:
  objfile - String containing file name of objects to generate ephemerides
              for.  This file is a correspondence list between offical
              object codes (see EPHEM.PRO) and common names.  RDMATCH
              Gives a description of the format of this file.
  outfile - String containing file name for output, this is the file you
              will give to the MOVE program.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  TIME    - By default, the program will read the system clock and generate
              an output file consistent with the current date.  However,
              if you wish to override the date, you give a time vector
              here such as [1995,11,30,0,0,0].  You can also specify a
              Julian date (scalar) for the starting time.
  NDAYS   - Number of days to run ephemeris for, default = 1
  DT      - Spacing between ephemeris points, default = 1 hour.
 OUTPUTS:
  All information is written to the output file.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  This is setup to work for Anderson Mesa only.
 PROCEDURE:
 MODIFICATION HISTORY:
  95/11/30, Written by Marc W. Buie, Lowell Observatory
  95/12/20, MWB, Added NDAYS and DT keywords.
  96/05/02, MWB, Fixed pipe overflow problem when doing to many position.
  98/07/03, MWB, added JD option to TIME

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


EPHCHECK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  ephcheck
 PURPOSE:
  Compare a set of astrometry observations against an ephemeris.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  ephcheck,objcode,obs,astfile
 INPUTS:
  objcode - Standard object code for ephemeris to check against.  See EPHEM.
  obs     - Standard observatory code (see RDOBSCOD)
 OPTIONAL INPUT PARAMETERS:
  astfile - Raw astrometry file to read and compare to ephemeris, default
              is "objcode.ast"  where the input objcode is first stripped of
              the leading prefix character.
 KEYWORD INPUT PARAMETERS:

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

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

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

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


EPHEM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     ephem
 PURPOSE: (one line)
     Ephemeris generator for solar system objects.
 DESCRIPTION:
     This program pipes the input data to an external FORTRAN program
     written by Larry Wasserman.  The external program looks up the orbital
     elements of each object and computes the positions requested by the
     output code.  The output code options are:

        Code  Meaning
        -----------------------------------------------------------------------
         0    Topocentric RA, Dec, of date of object.
         1    Topocentric RA, Dec,  B1950  of object.
         2    Topocentric RA, Dec,  J2000  of object.
         3    Topocentric x, y, z, of date of object.
         4    Topocentric x, y, z,  B1950  of object.
         5    Topocentric x, y, z,  J2000  of object.
         6    Topocentric x, y, z, of date of Sun.
         7    Topocentric x, y, z,  B1950  of Sun.
         8    Topocentric x, y, z,  J2000  of Sun.
         9    B1950 x, y, z, of object with respect to solar system barycenter.
        10    J2000 x, y, z, of object with respect to solar system barycenter.
        11    J2000 osculating orbital elements for the object
                 M, arg peri, node, i, e, a, q, Q, Period, epoch,
                 VRA, VDec, Epherr, JDlast, arc, nobs
                 (16 values)
                 VRA, VDec, line of variations for +1 deg change in M (radians)
                 JDlast - date of last astrometric measurement (nearest day)
                 arc - Arc length of astrometric observations (days)
                 nobs - Number of observations used to generate orbit.

        20    Code 0 and Code 3 and Code 6 information.
        21    Code 1 and Code 4 and Code 7 information.
        22    Code 2 and Code 5 and Code 8 information.
        23    Code 2, 5, 8, and 11 information.

     The object code depends on the type of object requested.
     All asteroids are preceeded by A, comets by C, planets and satellites
     by P, and topocentric locations by T.  For asteroids, either the number
     of the asteroid or its provisional designation will work.  Comets
     are recognized by either provisional or final designations, not names.
     Planets and satellites use the NAIF coding scheme for objects.  For
     example, the Pluto-Charon barycenter is 9, Charon is 901 and the
     center of Pluto is 999.  Topocentric locations use the same code as
     for the observatory codes, for example, Anderson Mesa would be T688.
     None of the names allow spaces.  If the object isn't recognized or
     supported by the external databases, RA and Dec values (if requested)
     are returned as -99 and the x,y,z values are returned as 0.  Elements
     will return as zero for invalid input.

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
     ephem,jd,obs,code,object,ephemeris
 INPUTS:
     jd     - Julian Date (UT) of position to calculate (scalar or vector).
     obs    - Observatory code, Marsden's IAUC codes (scalar).
     code   - Output format code (see description) (scalar).
     object - Object code (see description) (string or string array).

 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
     epehemeris - 2-D double precision array of values requested by code.

 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/24/93 - IDL interface written by Marc W. Buie, Lowell Observatory.

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


EXISTS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     exists
 PURPOSE: (one line)
     Check for file (or directory) existence.
 DESCRIPTION:
 CATEGORY:
     File I/O
 CALLING SEQUENCE:
     flag = exists(file)
 INPUTS:
     file - string containing file name to look for.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
     Return value is 1 (true) if file exists.  0 if it doesn't.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
     Calls OPENR recasts answer for a simple boolean flag.
 MODIFICATION HISTORY:
    93/03/29 - Written by Marc W. Buie, Lowell Observatory
    96/10/17, MWB, modified to use OPENR for Unix
    97/02/16, MWB, fixed DOS bug for dirs with trailing \

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


FIELDOBS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  fieldobs
 PURPOSE:
  Real-time display of standard star locations in the sky
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  fieldobs,file,AMCRIT=amcrit,OBSFILE=obsfile,OBSCODE=obs
 INPUTS:
  file - List of objects (for file format see LOADSTARS) to display

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  AMCRIT  - Maximum airmass for plotted display (default = 3.0)
  OBSFILE - Location of observatory information file, default is
              /pub/sac0/elgb/data/obscode.dat
  OBSCODE - Observatory code, default = 688, Lowell Observatory

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/05/28, Written by Marc W. Buie, Lowell Observatory
  98/04/30, MWB, added some items to the plot.

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


FINDMAX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    findmax
 PURPOSE: (one line)
    Find the interpolated local maximum in a 2-D array.
 DESCRIPTION:

 CATEGORY:
    Numerical
 CALLING SEQUENCE:
    findmax, x, y, f, xmax, ymax, fmax, $
             DELTA=in_delta, EPS=in_eps, GOLD=in_gold
 INPUTS:
    x, y   : Position of the initial guess.
    f      : The 2-D function array.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    DELTA   = Half-width of the box containing the desired maximum.
              Default is 1.0 pixel.
    EPS     = Stop criterion. Default=1.0E-5.
    GOLD    = Pad value on DELTA.  Default is 1.0E-4.
 OUTPUTS:
    xmax, ymax  : Position of computed maximum.
    fmax        : Computed function maximum.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    Binary search (2D).
    A guess for the location of the maximum is chosen.  The external function
 sint2d is called to obtain interpolated function values at two symmetric
 points along each axis (x and y).  For each axis, the two points are used
 to determine which way to shift the location of the maximum.  IF the
 function values at the two points are not equal, the location of the
 maximum is shifted by half the previous amount in the indicated direction,
 and a new set of four points are computed at half the offset used previously.
 This process continues until the offset falls below some small threshold
 value (epsilon).
 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, September, 1993.

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


FINDOBJ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  findobj
 PURPOSE:
  Locate image changes with 3-plane color overlays
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  findobj,root,image1,image2,image3,NOCLEAN=noclean
    -or-
  findobj,image1,image2[,image3]

 INPUTS:

  First input format:
     root - String containing the root of the file name (no path).
     image1 - Image number (integer) to load into the red image plane.
     image2 - Image number to load into the green image plane.
     image3 - Image number to load into the blue image plane (default=image2)

  Second input format:
     image1 - File name of image to load into red image plane.
     image2 - File name of image to load into green image plane.
     image3 - File name of image to load into blue image plane (default=image2).

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  EXTEN   - Extension number of subimage to read (default=0, primary)
  NOCLEAN - Flag, if set will suppress the automatic removal of cosmic rays.
              Note: this step can take a very long time if you don't have
              a fast machine.  On an Ultra 1/170 I find I will occasionally
              supress cleaning.
  PATH    - Path where data is to be found, default = current directory
  QUEUE   - Printer queue for hardcopy, default is chani for color and
              office for b/w
  SAVECLEAN - Flag, if set will cause the cleaned image to be saved alongside
              the original image.  The new file will have 'c' appended to the
              root of the file name.

 OUTPUTS:
  No explicit outputs but you are prompted for a final hardcopy in either
    color or black and white.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:
  You must have a 24-bit color display to use this program.

 PROCEDURE:

 MODIFICATION HISTORY:
  97/04/17 - Written by Marc W. Buie, Lowell Observatory
  97/07/11, MWB, added PATH keyword
  98/01/05, MWB, added QUEUE keyword
  98/01/06, MWB, added SAVECLEAN keyword
  98/03/03, MWB, added second input option
  98/03/25, MWB, added EXTEN keyword

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


FINDSRC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  findsrc
 PURPOSE:
  Automatic source detection and photometry from a digital image.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  findsrc,file
 INPUTS:
  file - Name of image file to search for sources.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

  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.

  GAIN      - Gain of image, in photons/DN, default=1.0

  GAP       - This is a number used to avoid looking at pixels near the
                 object.  It should be set to a value that is roughly equal
                 to the FWHM of a typical stellar image.  Default=2 pixels.

  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.

  MAXPHOTSIG- Maximum DN value for a useful signal.  Any source with a peak
                above this level is passed over.  Default=60000.0 DN

  NODISPLAY - Flag, when set will suppress all image display allowing program
                to be run in background or batch mode.  This will be somewhat
                faster as well.  The display steps take a small but non-trivial
                amount of time.

  OBJRAD    - Radius of object aperture, in pixels, for photometry extraction.
                Default=GAP

  PATH      - Optional path for original image directory.
                If not specified, the current directory is used.

  SIGTHRESH - Sigma threshold for source detection.  Anything brighter
                than this many sigma above sky will be considered a source.
                Default = 2.5

  WINDOW    - Size of region to average over in each direction, default=6

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
   98/03/11, Written by Marc W. Buie, Lowell Observatory
   98/03/22, MWB, added OBJRAD keyword
   98/03/23, MWB, added EXTLIST keyword

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


FLAGSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  flagspec
 PURPOSE: 
  Interactive marking of bad pixels in an OSIRIS XD spectrum.
 DESCRIPTION:
  Plots one order at a time and allows marking bad pixels.  See MARKDATA
    for operation of the widget used to mark data.  No attempt is made to
    repair the spectrum.  MARKDATA is called on each order.
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  flagspec,calib,root,fileno
 INPUTS:
  calib- Anonymous structure containing all pertinent calibration
           information.  This structure is usually loaded beforehand using
           the routine, "ldcalir"
  root   - Root of file name(s) (no . at the end, may include path).
  fileno - Number of spectrum (suffix).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  The bad flags file for this spectrum is potentially modified.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  97/03/23, Written by Marc W. Buie, Lowell Observatory

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


FLX2MAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     flx2mag
 PURPOSE: (one line)
     Convert from flux units to magnitudes with errors.
 DESCRIPTION:
 CATEGORY:
     Photometry
 CALLING SEQUENCE:
     flx2mag,flux,fluxerr,mag,magerr
 INPUTS:
     flux    - Flux values for the magnitudes.
     fluxerr - Uncertainties on the fluxes.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     ZEROPT  - Magnitude that corresponds to a flux of 1. (default=0)
 OUTPUTS:
     mag    - Magnitudes.
     magerr - Uncertainties on the magnitudes.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


FOURFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  fourfit
 PURPOSE: 
  Fit one or more fourier terms to discrete (periodic) data.
 DESCRIPTION:
 CATEGORY:
  Function fitting
 CALLING SEQUENCE:
  fourfit,phase,data,sig,nterms,c,csig,YFIT=yfit,CHISQ=chisq
 INPUTS:
  phase  - Fraction of period (mod or linearly increasing).
  data   - Measured values.
  sig    - Uncertainties of the data.
  nterms - Number of fourier terms to fit.  (2*nterms+1 unknowns)
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  c - fourier series coefficients (see fourfunc)
  csig - uncertainties of the coefficients
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/10, Written by Marc W. Buie, Lowell Observatory

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


FOURFUNC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  fourfunc
 PURPOSE: 
  Compute a Fourier series function (called by fourfit)
 DESCRIPTION:
  This is to be used in cases where you already know the fundamental period.
  The input independent variable is assumed to be reduced to phase of a
  fundamental period already.  The integer part of the number is not
  to the function.
 CATEGORY:
  Mathematical
 CALLING SEQUENCE:
  fourfunc,x,c,f,pder
 INPUTS:
  x - independent variable (phase, between zero and one)
  c - fourier series coefficients
        0 - a(0)    -> constant term
        1 - a(1)    -> cos(x2pi)
        2 - b(1)    -> sin(x2pi)
        3 - a(2)    -> cos(2x2pi)
        4 - b(2)    -> sin(2x2pi)
     and so on for as many elements as in c
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  f    - Evaluated function value
  pder - (Optional) partial derivatives
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/10, Written by Marc W. Buie, Lowell Observatory

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


FUTUREOB

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  futureob
 PURPOSE: 
  Plot geometric circumstances for a solar system object for some years.
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  futureob,start,length,obs,object,FULLNAME=fullname
 INPUTS:
  start  - Start time for plotting window, (year,month,day,hour)
  length - Length of time to plot, in years.
  obs    - Observatory code, Marsden's IAUC codes (scalar).
  object - Object code (see description in EPHEM.PRO).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  FULLNAME - Full name or designation for the object (default=object)
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/02/23 - Written by Marc W. Buie, Lowell Observatory
  96/01/23 - MWB, Added getinfo call that gets Name, H, G

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


FXTM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	fxtm
 PURPOSE: (one line)
	Fix bad time codes from Anderson Mesa CCD software.
 DESCRIPTION:
	This is a special purpose routine for fixing bad times that are
	generated from using MGO with the Hendon CCD control software at
	Anderson Mesa.  For a string of times, this is what it looks like:
	Frame      Stored time      Actual time
         n           t(n+1)          t(n)
	  n+1         t(n+2)          t(n+1)
	  n+2         t(n+3)          t(n+2)
	  n+3         t(n+3)          t(n+3)
	for a four frame sequence.  The times for n to n+2 are actually the
	times for the next frame, the n+3 time is correct.   The time for
	the first frame is lost.

	This program copies the times that are out of place and computes
	the first time by backing up from the n+1 frame by the mean of the
	difference between all the other frames.
 CATEGORY:
	CCD data processing
 CALLING SEQUENCE:
 INPUTS:
	vec - Time vector to be repaired (MODIFIED).
	i1  - First point in sequence within the vector.
	i2  - Last point in sequence within the vector.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	vec - Time vector with i1 to i2 points repaired.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Jan 28, by Marc W. Buie, Lowell Observatory

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


GARTH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  garth
 PURPOSE:
  Visual inspector of moving target triplet detections.
 DESCRIPTION:

  First, some vocabulary:

  Object - Putative detection of a moving source.  Consists of three positions
              measured from three images taken at different times.

  Field  - A single location in the sky that has been imaged at three
              different times.  Each field has a name and three files names
              for the three images.  Each field also has an assocated list
              of objects.

  Triplet List - This is a list of fields, ie., a list of field names and
                    the file names for the images.

  To begin processing the object list(s), there must be a triplet list file.
  These files end with a .match suffix.  For every entry in the .match file
  there must be an object list file.  These are named FLDNAM.obj where FLDNAM
  is the name of the field found in the first column of the .match file.
   ex:
        field_1  980115.001 980115.051 980115.101
        field_2  980115.002 980115.052 980115.102

  could be two list from a .match file, perhaps named 980115.match.  There
  would then be two related files, field_1.obj and field_2.obj that would
  have the object list.  The object list files are created by the program
  LINKOBJ and are not intended to be directly edited (though with care, this
  is possible).

 CATEGORY:
  Widgets
 CALLING SEQUENCE:
  garth
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
    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 original image directory.
                If not specified, the current directory is used.

  SUBSIZE   - Size of the sub-images to show (default = 249 pixels)

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:
  This widget tool must be run on a 24-bit color display.

 PROCEDURE:

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


GAUSS2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  gauss2d
 PURPOSE: 
  Compute a two dimensional gaussian within an array.
 DESCRIPTION:
 CATEGORY:
  Mathematical
 CALLING SEQUENCE:
  pro gauss2d,nx,ny,x,y,fwhm,array
 INPUTS:
  nx   - X size of output array
  ny   - Y size of output array
  x    - X location of gaussian in array
  y    - Y location of gaussian in array
  fwhm - Full width at half-maximum of gaussian.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  array - Result array with gaussian inserted.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/04/07, Written by Marc W. Buie, Lowell Observatory

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


GETANNUL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    getannul
 PURPOSE: (one line)
    Extract an annulus from a 2-D array.
 DESCRIPTION:

 CATEGORY:
    CCD data processing
 CALLING SEQUENCE:
    Getannul, image, xcen, ycen, inradius, outradius, data

 INPUTS:
    image       : CCD image array.
    xcen,ycen   : Center of annulus.
    inradius    : Radius of inner circle.
    outradius   : Radius of outer circle.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
 OUTPUTS:
    data        : Array of data from the image array.
    idx         : Optional output of 1D indices (in image) of data.

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, April, 1993.
    Reference: getannul.c by Marc Buie.
    This version is completely different than the previous version and
    somewhat faster.
    5/12/93, DWL, Fixed a bug involving fringe pixels.  In certain cases,
                  the determination of the row indices led to a bad array
                  subscript range.
    1/5/94, DWL, Added optional output parameter idx.
    95/06/12, MWB, Fixed bug, base needed to be LONG for large sky apertures

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


GETCOLOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     getcolor
 PURPOSE: (one line)
     Given a list of names and JD, return B-V and V-R colors.
 DESCRIPTION:
 CATEGORY:
     Photometry
 CALLING SEQUENCE:
     getcolor,stand,filler,bmv,vmr
 INPUTS:
     stand    - Standard object name (scalar string or string array).
     filler   - Color values to insert if object not in star catalogs.
 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.
 OUTPUTS:
     bmv  - Catalog B-V color of object.
     vmr  - Catalog V-R color of object.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
    93/10/12 - Written by Marc W. Buie, Lowell Observatory

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


GETPAIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  getpair
 PURPOSE:
  Read two OSIRIS XD data files and return the difference strip image.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  getpair,calib,root,i1,i2,diff,hdr,RAW=raw
 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).
  i1   - Frame id (integer) of first image.
  i2   - Frame id (integer) of second image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  RAW  - Flag, if true will inhibit the column-wise background subtraction.
           The default is to fit the background in each column (along the
           slit) and subtract the fitted background.  Use a linear function
           for the background.
 OUTPUTS:
  diff - i1-i2 after XD spectra extracted to strip image. (see getstrip)
  hdr   - FITS header for image.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Specifically written for OSIRIS cross-dispersed spectral data.
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/24, Written by Marc W. Buie, Lowell Observatory
  95/09/15, MWB, added usage of calib structure and return of header.

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


GETSALB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   getsalb
 PURPOSE: (one line)
   Solve for single scattering albedo given bi-directional reflectance
 DESCRIPTION:
 CATEGORY:
   Miscellaneous
 CALLING SEQUENCE:
   ans = salb(bidref,emu,smu,holes,pzero)
 INPUTS:
   bidref - The bi-directional reflectance.
   emu    - Cosine of the emission angle.
   smu    - Cosine of the incidence angle.
   holes  - Compaction parameter value (1981 formalism).
   pzero  - Value of the single particle phase function.
 OPTIONAL INPUT PARAMETERS:
   None.
 KEYWORD PARAMETERS:
   None.
 OUTPUTS:
   returns the single scattering albedo.
 COMMON BLOCKS:
   None.
 SIDE EFFECTS:
   None.
 RESTRICTIONS:
   This works on scalar input only.
 PROCEDURE:
 MODIFICATION HISTORY:
   Written 1995 Jan 13, by Marc W. Buie, Lowell Observatory

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


GETSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  getspec
 PURPOSE:
  Extract a point source spectrum from OSIRIS XD data.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  getspec,calib,root,i1,i2,spec,all,
     RAW=raw,NONEG=noneg,AUTO=auto,MASK=mask
 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.
  i1   - Frame id (integer) of first image.
  i2   - Frame id (integer) of second image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  AUTO - Flag, if true, enables automatic aperture location for extracting
         the spectra.   The image is collapsed into a single column.  Any
         pixel more than 3 sigma from the background is flagged for
         extraction.  Default is to require clicking on the image displayed
         in window 0.  Three rows centered on the clicked location are
         extracted for the spetrum.  /AUTO is the preferred option.
  APLOC- Override to specify the positive object location.  Overrides AUTO.
  APSIZE-Override to force the size of the extraction aperture.  The
           will extend from the location (auto or APLOC) + and - by APSIZE.
           Thus the total aperture is 2*APSIZE+1 rows.
  NONEG - Flag, if true, inhibits using the "negative" spectrum in the
          background image (i2).  Default is to extact the negative
          spectrum, negate it, and add to the positive spectrum.
  RAW  - Flag, if true will inhibit the column-wise background subtraction.
           The default is to fit the background in each column (along the
           slit) and subtract the fitted background.  Use a linear function
           for the background.
  MASK - Indicies in strip image.  These pixels will be replaced by the
           average of their nearest neighbors in the x direction.
  SAVE - Flag, if true, final spectrum will be saved to a file.  The output
           file name is root+'s'+suffix.  Thus 950911.003 would be saved to
           the file 950911s.003
  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.
  CLEAN - Flag, if set, calls clnspec to allow removing bad points before
           saving spectrum.

 OUTPUTS:
  spec - 1-D spectrum extracted from spectral image.
  all  - i1-i2 after XD spectra extracted to strip image. (see getpair)
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Specifically written for OSIRIS cross-dispersed spectral data.  MASK
  does not work particularly well.
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/24, Written by Marc W. Buie, Lowell Observatory
  95/06/21, MWB, modified aperture algorithm.
  95/09/14, MWB, added calib structure pass through, added SAVE flag, added
                 PATH keyword, added CLEAN flag.
  95/09/18, MWB, improved auto-aperture locating algorithm
  95/09/21, MWB, added APLOC and APSIZE keywords

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


GETSTARS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  getstars
 PURPOSE: (one line)
  Retrieve coordinates from the master star catalog
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  getstars,name,ra,dec,found,EPOCH=epoch,EQUINOX=equinox
 INPUTS:
     name   - Name of the star.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     FILE    - Name of star catalog file.  Default is:
                 '/gryll/data1/buie/starcat/starcat.dat'
     EPOCH   - Decimal year of epoch to correct for proper motion to.
                 Default = catalog epoch.  (Scalar or vector).
     B1950   - Coordinates should be referred to equinox of B1950.
     J2000   - Coordinates should be referred to equinox of J2000 (default).
     OFDATE  - Coordinates should be referred to equinox of date.
                 If selected, EPOCH must be provided.

 OUTPUTS:
     ra     - Right Ascension in radians. J2000
     dec    - Declination in radians.     J2000
     found  - Flags, 1=star found, 0=star not found

 KEYWORD OUTPUT PARAMETERS:
     STDNAME - Actual standard name from file, resolves the aliases.

 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/getstars.pro)


GETSTRIP

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  getstrip
 PURPOSE: 
  Extract a 2-d rectangular strip image from a OSIRIS XD image.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  getstrip,calib,root,frno,strip,hdr
 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).
  frno - Frame id (integer) of image to read.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  OFF_CHIP - Value to assign to output array for pixels that do not map
                to the original array (default=0.0)
 OUTPUTS:
  strip - 2-d rectangular strip image pulled from raw data (see getstrip).
  hdr   - FITS header for image.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:

 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/24, Written by Marc W. Buie, Lowell Observatory
  95/09/15, MWB, added usage of calib structure and return of header.
  98/06/08, MWB, added OFF_CHIP keyword
  98/08/17, MWB, added fix to get actual Exposure time from image.

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


GOODPOLY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  goodpoly
 PURPOSE: (one line)
  Robust fitting of a polynomial to data.
 DESCRIPTION:
  This is a multi-pass fitting routine that fits a fixed order polynomial
  to the input data.  After each pass, the scatter of the fit relative
  to the fitted line is computed.  Each point is examined to see if it
  falls beyond THRESH sigma from the line.  If is does, it is removed
  from the data and the fit is tried again.  This will make up to two
  attempts to remove bad data.
 CATEGORY:
  Function fitting
 CALLING SEQUENCE:
  coeff = goodpoly(x,y,order,thresh,yfit,newx,newy)
 INPUTS:
  x      - Input dataset, independant values.
  y      - Input dataset, dependant values.
  order  - Order of the polynomial fit (linear = 1).
  thresh - Sigma threshold for removing outliers.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  BAD     - Vector of flags, same length as x and y, that indicate bad values
              in the y vector.  The default is that all points are considered
              good at the stars.  If supplied, any additional bad values found
              will be marked as bad in this vector upon output.  Also, any
              NaN values found in either the x or y vector will be trimmed
              from the data (and marked bad) prior to any processing.
  EXCLUDE - Number of points to exclude from initial pass fit.  This number
              is rounded up to the next even number.  Then EXCLUDE/2 of the
              highest and lowest points are removed before the first fit.
              If these numbers are reasonable, they will not be excluded
              in the second pass.  This helps prevent biasing the first fit
              with the worst points in the array.  Default is to not exclude
              any points on the first pass.
  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 at any pass.
  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 at any pass.
  SIGMA   - Standard deviation of difference between good points and the
              fitted curve.
 OUTPUTS:
  yfit   - Fitted values for y that match the input vector.
  newx   - X values from input that were considered good.
  newy   - Y values from input that were considered good.
  Return value is the set of polynomial coefficients.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 1991 Feb., Marc W. Buie, Lowell Observatory
  93/11/12, MWB, Program fixed to return a computed y for all input x.
  95/09/20, MWB, Added EXCLUDE keyword.
  98/02/09, MWB, Added SIGMA keyword.
  98/06/08, MWB, Added MIN/MAX_VALUE keywords.
  98/08/12, MWB, Revamped some logic plus added direct support for badflags.
                    The new version is probably a tad faster and more robust
                    than the old version.

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


GPSPROC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
   gpsproc
 PURPOSE: 
   Process and average a single day GPS record.
 DESCRIPTION:
 CATEGORY:
   Miscellaneous
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
   94/08/15 - Written by Marc W. Buie, Lowell Observatory

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


GRIDWT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  gridwt
 PURPOSE:
  Compute circle overlap weights in a circle within an array.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  gridwt,xc,yc,radius,xsize,ysize,wtarr
 INPUTS:
  xc     - X center of circle.
  yc     - Y center of circle.
  radius - Radius of the circle in pixels.
  xsize  - X size of array
  ysize  - Y size of array
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  wtarr  - Output array filled with overlap area of each pixel with given
            circle.  Values range from 0 to 1.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  97/11/12 - Written by Marc W. Buie

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


GXPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    gxpar
 PURPOSE: (one line)
    General purpose FITS file header keyword extraction.
 DESCRIPTION:
   This procedure is a 'front-end' to SXPAR and may be used to extract the
 value of a keyword from a FITS file header.
   Because there is so much variation of the keywords found in FITS file
 headers, the idea is to have and use a set of 'standard' keywords in
 programs that load and display FITS files.
   To facilitate this, gxpar uses a correspondence list to associate a
 standard keyword with a keyword found in a given FITS file header (or with
 a value different from that which might be in the header).
   This correspondence list consists of three linear arrays of the same
 length.  The first array contains standard keywords, the second contains
 flags which indicate the type of correspondence, and the third contains
 the items corresponding to the standard names in the first array:

           stdkeywords   flags   hdrkeywords

   The flags are single letters from the set 'K', 'D', 'F', 'L', or 'S',
 indicating a keyword, floating, double, longword, or string, respectively.
 Flags having the letter 'K' associate standard keywords with header keywords.
 All other flag letters associate standard keywords with 'direct' values.

   Standard keywords in use are:
           airmass
           date
           exptime
           filter
           jd
           mjd
           object
           time

   Examples:
      airmass k  airmass
      airmass f  1.73
      filter  k  filtnam1
      filter  s  f555w

   Note: This procedure treats the correspondence list as case-insensitive,
 except for the third field of a record having a flag of 'S'.

 CATEGORY:
    File I/O
 CALLING SEQUENCE:
    gxpar, header, keyword, stdkeywords, flags, hdrkeywords, value, error
 INPUTS:
    header      : A FITS file header array (as returned from READFITS).
    keyword     : The standard keyword whose value is to be obtained.
    stdkeywords : List of standard keywords (first correspondence field).
    flags       : List of flags (second correspondence field).
    hdrkeywords : List of header keywords (and values) (third correspondence
                  field).
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    SILENT = If set, suppresses all message output.
 OUTPUTS:
    value : The returned value.
    error : Non-zero, if an error is encountered.  Incremented on each call
            which detects an error.  The caller should set this to zero before
            any sequence of calls to this procedure.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, November, 1993.

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


HANGLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	hangle
 PURPOSE: (one line)
	Compute the local hour angle of an object.
 DESCRIPTION:
 CATEGORY:
	Astronomy
 CALLING SEQUENCE:
	hangle,jd,ra,dec,lat,lon,lha,lst [,UT=ut]
 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:
	None.
 KEYWORD INPUT PARAMETERS:
  UT  - Time, in hours to add to JD to get the correct Universal Time.
           That the same as Universal Time minus the Local Time.
 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.
 OUTPUTS:
  LHA - Return of the local hour angle.
  LST - Return of the local sidereal time.
 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:
	
  94/05/05 - Written by Marc W. Buie, Lowell Observatory

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


HARDIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  hardim
 PURPOSE: (one line)
  Create a postscript image and/or print from an image.
 DESCRIPTION:

  This program will take an image and create a hard copy image via
  Postscript.  Color tables will work only with a color printer.

  If the plot device is not PS upon entry, this program will temporarily
  switch devices if the file is printed.  If the file is not printed,
  the device is left active and open so that additional information
  can be added to the plot.

 CATEGORY:
  Image display
 CALLING SEQUENCE:
  hardim,image,min,max
 INPUTS:
  image - Input array to convert to a postscript image.
  min   - Input array value to scale to output value of 0.
  max   - Input array value to scale to !d.n_colors-1 (peak color).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  AUTOSIZE     - Automatic output image size setting:
                    0 - no automatic action (default).
                    1 - resize if too big.
                    2 - make image as large as possible.
  BITS         - Number of output bits for image, default=8.
  CTABLE       - Color table number to use for print.  Default is 0
                   for the B/W lookup table.  If 0, behavior will default
                   to non-color printing.
  DELPOS       - Position offset (x,y) in centimeters for image.
  ENCAPSULATED - Flag, if true ==> generate encapsulate postscript.
                   This will automatically set NOPRINT.
  FILE         - Name of postscript file, default is idl.ps
  LANDSCAPE    - Flag, if true ==> landscape mode output orientation.
                        Default is portrait.
  NEGATIVE     - Invert the color table if set.
  NOCLOSE      - If true, prevents closing the output device in
                    encapsulated mode.
  NOBOX        - When set will suppress the pixel axes around image.
  NOPRINT      - Flag, if true ==> do not send the postscript file to the
                   the printer.  Default to FALSE.
  POSITION     - 2 element vector specifying the location of the lower
                   left hand corner of the image relative to the page
                   setup origin.  The default is to center the image
                   on the page (less 3-hole punch margin).  Values are
                   in centimeters.
  QUEUE        - Name of the print queue to send postscript file to.
                   Defaults to the default printer.
  TITLE        - Title to put over image.
  TRUE_COLOR   - Indicates 24-bit color input image if set, values are
                    1 - pixel interleave (3, width, height)
                    2 - row interleave   (width, 3, height)
                    3 - image interleave (width, height, 3)
                    sets bits=8 automatically.
  XBORDER      - Two element vector with x border to put around image.
                    Values are in cm, default = [0,0], used only for
                    encapsulated output.
  YBORDER      - Two element vector with y border to put around image.
                    Values are in cm, default = [0,0], used only for
                    encapsulated output.
  WIDTH        - Width of image in cm.  Default = 15cm.
 OUTPUTS:
  A postscript file is created.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  This program knows about two kinds of printers, HP Laser Jet IIIsi
  and a Tektronix Phaser IIsd color printer.  The color printer is
  known by the queue name of 'chani'.  Error checking is in place to
  make sure the image is not scaled off the page for each device.
  If the queue is not chani, it is assumed to point at an HP printer.

  The print queueing is specific to Unix and Win32.

 PROCEDURE:
 MODIFICATION HISTORY:
  3/3/93, written by Marc W. Buie, Lowell Observatory
  3/15/93, MWB, encapsulated output was forced to be full page, modified
     so that output matches the image size.
  94/10/05, MWB, added DELPOS keyword
  96/01/06, MWB, added support for auto-spool for DOS/Windows
  96/08/24, MWB, added AUTOSIZE
  97/05/29, MWB, changed COLORTABLE to CTABLE and added COLOR keyword.

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


HATOJD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  hatojd
 PURPOSE: (one line)
  Find the nearest Julian date for a given hour angle and date.
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
 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/hatojd.pro)


HGP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	hgp
 PURPOSE: (one line)
	Compute a single parameter Henyey-Greenstein phase function.
 DESCRIPTION:
 CATEGORY:
	Mathematical
 CALLING SEQUENCE:
	ans = hgp(phase,c)
 INPUTS:
	phase - Angle between the incident and emitted flux (in degrees).
	c     - Henyey-Greenstein functional value.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Return value is the phase function value(s).  Same dimension as
	the inputs.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1991 Feb.,by Marc W. Buie, Lowell Observatory

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


HMSTORAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    hmstorad
 PURPOSE: (one line)
    Convert from hours, minutes, and seconds of Right Ascension to radians.
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    hmstorad, hour, min, sec, radians
 INPUTS:
    hour : Hour.    0   <= hour < 24.
    min  : Minute.  0   <= min  < 60.
    sec  : Second.  0.0 <= sec  < 60.0.
    If more than one of these are vectors, they must be the same length.
    A mixture of scalar and vector input parameters is equivalent to all three
 inputs being vectors: The scalar inputs are treated as replicated vectors.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    radians  : Converted angle in radians.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Copyright (C) 1987, by Marc W. Buie
    Version dated 87/6/3
    Ported by Doug Loucks, Lowell Observatory, August 12, 1993, from the
 C-Language version written by Marc Buie.

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


HSTPSF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    hstpsf
 PURPOSE: (one line)
    Find or create a HST PSF file using Tiny Tim.
 DESCRIPTION:
    See Tiny Tim User's Manual, Version 2.4, for details.
 CATEGORY:
    Miscellaneous
 CALLING SEQUENCE:
    hstpsf, x, y, date, filter, bmvnum, psf, xmax, ymax
 INPUTS:
    x, y    : Chip position.
    date    : Date of observation (YYMMDD format).
    filter  : Filter name in the form Fxxx(W,LP,M,N).
    bmvnum  : B-V list value:
                1) -0.297 (Type O)
                2) -0.155 (Type B)
                3)  0.126 (Type A)
                4)  0.395 (Type F)
                5)  0.619 (Type G)
                6)  1.110 (Type K)
                7)  1.590 (Type M)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    FLUSH    = If set, flushes the local cache before begining PSF search.
    GRID     = Grid spacing for nearest PSF location.  Default=50 pixels.
    HSTPATH  = The starting directory path for the location of the PSF'S.
               Used, primarily, for maintenance.
    VERBOSE  = If set, displays informational messages.

 OUTPUTS:
    psf : The generated PSF array.
    xmax : Interpolated maximum x-location.
    ymax : Interpolated maximum y-location.

 COMMON BLOCKS:
    hstpsf_com  : Local.  Holds one copy of a PSF array and its full name.
 SIDE EFFECTS:

 RESTRICTIONS:
    Presently, only the Planetary Camera, Chip 6 (P6), and filters F555W
 and F439W are supported.
    This version generates PSF'S with 7.5 micron spacing (2X over-sampling)
 and 5 arcsecond diameters.
 PROCEDURE:
    A nearest grid position is computed from the input chip position using the
 specified, or default, grid spacing.
    If a PSF has been previously computed at that grid position (matching the
 other input parameters), that file is loaded into the caller's array.
    Otherwise, a new PSF is created, placed into the appropriate
 sub-directory, and loaded into the caller's array..

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, August, September, 1993.
    12/1/93, DWL, Modified to work with Tiny Tim Version 2.4.
    12/9/93, DWL, Modified to hold one copy of a PSF in common.  If the
 requested PSF is the same as that in common, a disk-access is avoided and
 the memory copy is returned.
    12/16/93, DWL, Added VERBOSE keyword.  If set, displays informational
 messages.
    1/12/94, DWL, Added cache for two psf's.
    1/21/94, DWL, Added cache for n psf's. See local variable ncache.
    1/21/94, DWL, Added code to compuite and store each psf's interpolated
 maximum. Also, added FLUSH keyword.

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


IMQUAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  imqual
 PURPOSE:
  Generate a ``grade'' for image quality of input image.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  imqual,im,thresh,smofac,grade,usmim
 INPUTS:
  im     - The input image, 2-D only thus far.
  thresh - Fraction of peak in image that is considered for grading.
  smofac - Smoothing factor for the unsharp masked image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  grade  - Grade, 0 is bad, bigger is better.  Units are arbitrary
  usmim  - The unsharp masked image.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/08/16 - Written by Marc W. Buie, Lowell Observatory.

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


INSLIT

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	inslit
PURPOSE: (one line)
	Compute flux passing through a slit assuming a gaussian image.
CATEGORY
       Spectroscopy
DESCRIPTION:

CALLING SEQUENCE:
	inslit,width,height,fwhm,offset
INPUTS:
	width  - Width of slit.
	height - Height of slit.
	fwhm   - Full-width at half-maximum of the gaussian image.
	offset - Offset of the image from center of the slit.

	Note: the units are arbitrary but they must be the same within
	all of the input quantities.  The object is also assumed to
	be perfectly centered in the vertical direction.
OUTPUTS:
	Returned is the fraction of the total gaussian included in the slit.
REVISION HISTORY:
	Written 1991 Mar., Marc W. Buie, Lowell Observatory
COMMENTS:

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


INST2STD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	inst2std
 PURPOSE: (one line)
	Apply photometric transformation from instrumental to standard mags.
 DESCRIPTION:
  The formula for applying transformation to a photometric measurement
  follows the basic formalism (including signs) from Hardie.  A time
  dependent term has been added.  The formula looks like this:

    m0 = m - kX - n(t-t0)X - k"CX + eC + Z

     where
        m  = instrumental magnitude
        k  = extinction coefficient, mag/airmass
        X  = airmass
        n  = coefficient of the 1st order expansion of extinction as a
               function of time
        t  = Time of observation (in hours)
        t0 = Reference time for n, time dependent correction is zero at
               this time, usually is the middle of the observation set.
        k" = second order extinction coefficient
        C  = Standard system color of the object
        e  = color term
        Z  = zero point
        m0 = Standard magnitude

 CATEGORY:
	Photometry
 CALLING SEQUENCE:
	inst2std,jd,am,inst,instsig,color,colorsig, $
     tran,transig,jdref,std,stdsig
 INPUTS:
  jd       - Julian date of observation for each entry.
  am       - Floating point array of the airmass of observations.
	inst     - Instrumental magnitude
	instsig  - Uncertainty of the instrumental magnitude
	color    - Standard system color for object.
	colorsig - Uncertainty on the standard color
	tran     - Transformation coefficients (vector)
                tran(0) = principal extinction coefficient
                tran(1) = second order extinction coefficient
                tran(2) = color term
                tran(3) = zero-point
                tran(4) = time-dependent extinction term
  transig  - Uncertainty on the transformation coefficients (vector).
                (no uncertainty on reference time)
  jdref    - Time reference point for extinction
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 KEYWORD OUTPUT PARAMETERS:
 OUTPUTS:
	std      - Standard magnitude.
	stdsig   - Uncertainty of the standard magnitude.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written: 1992 Mar 31, Marc W. Buie, Lowell Observatory.
  97/2/10, MWB, total rewrite

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


INTERP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	interp
 PURPOSE: (one line)
	One dimensional interpolation onto a new x grid (both irregular)
 DESCRIPTION:
 CATEGORY:
	Mathematical
 CALLING SEQUENCE:
	interp,x1,y1,e1,x2,y2,e2
 INPUTS:
	x1 - Input X array.
	y1 - Matching input Y array.
	x2 - New X array to interpolate Y to.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
	E1 - Array of uncertainties for Y.  Default=equal uncertainties.
 OUTPUTS:
	y2 - Interpolated values of y1 that match the x2 array.
	e2 - Array of uncertainties for interpolated values.  For each
          interpolation point, uncertainties are calculated using the
          left and the right uncertainties.  The minimum of these
          becomes the final uncertainty.  Returned only if E1 is specified.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1992 Sep 28.
    5/19/93, DWL, Modified the uncertainty computation.
   97/11/13, MWB, Moved e1 to a keyword, uncertainties are now optional.
   98/4/2, MWB, Fixed bug in returned e2 value.

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


INTRSECT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  intrsect
 PURPOSE: 
  Find the intersection or its inverse between two arrays.
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  intrsect,a,b,c,nfound, [NNOT]
 INPUTS:
     a - First set.
     b - Second set.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     NNOT - Flag, if true will invert the intersection operations, that is,
            the entries that do NOT appear in both sets will be returned.
 OUTPUTS:
     c      - Intersection (or NOT) of sets A and B.
     nfound - Number of items in the intersectoin (or NOT).
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  93/12/16 - Marc W. Buie, Lowell Observatory, original version.

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


ITOOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    itool
 PURPOSE: (one line)
    General purpose image display (front-end for cw\_itool).
 DESCRIPTION:

 CATEGORY:
    Image display
 CALLING SEQUENCE:

 INPUTS:
    image : The image array.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    SCLMIN = Stretch range minimum.
    SCLMAX = Stretch range maximum.
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, July 29, 1994. This is a small
 'front-end' for the new compound widget version of itool (cw_itool).

  94/09/27 - Marc W. Buie, Lowell Observatory.  Modified exit on itool_eve
               to eliminate crash on exit if photometry or template parms
               were changed.

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


IT_INIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    it_init
 PURPOSE:
    Itool initialization.
 DESCRIPTION:

    The contents of the image parameter structure is:
      These usually come from image header information.
        airmass  - float,  airmass of image
        date     - string, UT date of image at start
        exptime  - float,  exposure time of image in seconds
        expdelta - float,  time between frames in seconds for image cubes
        filter   - string, filter used for image
        imfile   - string, name of file where image came from
        jd       - double, Julian Date of middle of exposure for image.
        object   - string, Descriptive name of object
        ut       - string, UT time of image at start

        xsize    - int,    width of image(s) in pixels
        ysize    - int,    height of image(s) in pixels
        nframes  - long,   Number of frames in image cube
        imageptr - Pointer to image cube

        asis     - boolean array
                     false --> call autostrech computer, if NOT ready, then
                               scl is computed and set to cur, if ready, then
                               there is no change.
                     true  --> cur is valid, use it.
        autophot - int,    Flag, set when auto photometry requested.
        frame    - long,   Current frame being displayed
        curmin   - float array, actual display min
        curmax   - float array, actual display min
        lastfwhm - float, Last FWHM of object or anchor object
        lastmag  - float, Last magnitude of object or anchor object
        lastpos  - intarr(2), Last photometry position
        lasttype - int, type of last click 0=none, 1=left, 2=right
        minvalue - float array, minimum in each frame
        maxvalue - float array, maximum in each frame
        ready    - boolean array, true --> autoscale values are valid
        sclmin   - float array, autoscale display min
        sclmax   - float array, autoscale display max
        title    - string, name for structure
 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    it_init, image, im_parms
 INPUTS:
    image : The image array.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
 OUTPUTS:
    im_parms : The image parameters structure.
 OPTIONAL OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, July 29, 1994.
    1996 Jun 24, MWB, added items for automatic photometry operation

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


IT_PPLOD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    it_pplod
 PURPOSE: (one line)
    Load itool photometry parameters from a file.
 DESCRIPTION:

 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    it_pplod, ph_parms
 INPUTS:
    ph_parms : The photometry parameters structure (See itool.pro).
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, May 20, 1994. Formerly
 in it_ppmgr.

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


IT_PPSAV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    it_ppsav
 PURPOSE: (one line)
    Save itool photometry parameters to a file.
 DESCRIPTION:

 CATEGORY:
    Compound Widgets
 CALLING SEQUENCE:
    it_ppsav, ph_parms
 INPUTS:
    ph_parms : The photometry parameters structure (See itool.pro).
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, May 20, 1994. Formerly
 in it_ppmgr.

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


JD2YEAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    jd2year
 PURPOSE: (one line)
    Convert Julian date to decimal year.
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    jd2year, jd, year
 INPUTS:
    jd     : Julian Date (double precision ONLY)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    year   : Decimal year
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, September 30, 1993.

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


JDSTR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    jdstr
 PURPOSE: (one line)
    Convert Julian date into an ASCII string.
 DESCRIPTION:

 CATEGORY:
    Numerical
 CALLING SEQUENCE:
    jdstr, jd, places, str
 INPUTS:
    jd     - Julian Date to be converted to a string.  May be a vector, in
             which case the output is a vector.
    places - Integer scalar.  Format and resolution of output string.  The
             units, tens, and hundreds positions of this parameter control
             the output format.  If this parameter is negative, the sign
             is applied only to the units place.  Thus the following
             possibilities:
      units  = -7  nearest hour.                    +HH
             = -6  nearest 30 minutes.              +HH:(00,30)
             = -5  nearest 15 minutes.              +HH:(00,15,30,45)
             = -4  nearest 10 minutes.              +HH:M0
             = -3  nearest 5 minutes.               +HH:M(0,5)
             = -2  nearest minute.                  +HH:MM
             = -1  nearest ten seconds.             +HH:MM:S0
             =  0  nearest second.                  +HH:MM:SS
             =  1  nearest tenth of a second.       +HH:MM:SS.s
             =  2  nearest hundredth of a second.   +HH:MM:SS.ss
             =  3  nearest thousandth of a second.  +HH:MM:SS.sss

       tens  =  0  month is numeric (ex 1993/08/06)
             =  1  month is three-character abbreviated name (ex 1993 Aug 06)
             =  2  month is full name (ex 1993 August 06)

       hundreds =  0  append time using the units position code.
                =  1  time is not appended.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    str         - Output string for the converted date.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
   Convert a time as a Julian date into a string.  The time is first
 rounded to the requested digit.  Then the date (after
 rounding) is converted to a string.  Thus, a time of 23:59:59.9
 rounded to the nearest second would actually cause the day to be
 incremented by one and generate a time of 00:00:00.  PLACES indicates
 the reported precision of the string, see INPUTS for posibilities.
   Calls external routines: caldatm, jdcnv, and rastr.
 MODIFICATION HISTORY:
  Copyright (C) 1991, by Marc W. Buie. Version dated 91/9/9
  Ported by Doug Loucks, Lowell Observatory, August, 1993, from the
 C-Language version written by Marc Buie.

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


JUPLOC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  juploc
 PURPOSE:
  Find and extract Jupiter in images and create PDS FITS headers on output.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  juploc,root,imnum, $
       PATH=path, OUTPATH=outpath, PANG=in_pang, PSCALE=pscale
 INPUTS:
  root  - String, contains the date root of the file name to be read.
  imnum - Integer value or array of image number to process.
             File names are root+'m.'+imnum  (imnum converted to 3 digit string)
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  BORDER  - Border around Jupiter for extracted image (default=15).
  LATITUDE - String containing latitude for observatory, this value overrides
             the value expected in the header.  Format MUST exactly match this
             example:      '+37:20:36.0'
  LONGITUDE - String containing longitude for observatory, this value overrides
              the value expected in the header.  Format MUST exactly match this
              example:      'W 121:38:12.0'    (use E for East longitude)
  ALTITUDE  - String containing altitude for observatory, this value overrides
              the value expected in the header.  Format MUST exactly match this
              example:      '1290.0'    (in meters)
  PATH    - Directory in which to look for data (default = current directory)
  OUTPATH - Directory in which to write data (default = current directory)
  PANG    - Position angle of Jupiter's north pole on image, this is the
             standard astronomical position angle measured eastward from
             North but in this case, take the top of the image as "north"
             and image must have the proper handedness on input.
  PSCALE  - Plate scale of image in arcsec/pixel.  Default=0.5 but this
             default is fairly meaningless.  This needs to be the right
             value or cropped image will be the wrong size.
  AUTO    - Flag, if true suppresses request for mouse confirmation.
             Be careful with this, there is no clean way to interrupt
             things if something goes wrong.
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/07/14, Written by Marc W. Buie, Lowell Observatory
  96/08/12, MWB, added BORDER, LATITUDE, LONGITUDE, ALTITUDE  keywords.
  96/09/18, MWB, invert PCCD images, plus /AUTO keyword.

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


KBOPLAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  kboplan
 PURPOSE:
  KBO observing planning table generation
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  kboplan,objcode,obs,date
 INPUTS:
  objcode - String array of standard object codes (see ephem.pro), if the
              input is a single string with @ as the first character, then
              the rest of the string is interpreted as a file to read the
              object codes from.
  obs     - Integer Marsden code of the observatory
               688 - Lowell Observatory
               500 - Geocentric
               If you provide an invalid code, 688 is assumed.
  date    - UT date and time vector near midnight for night,
                 [year,month,day,hour]
     
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  FILE - Override on file name where observatory codes are to be found.

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1997/05/23

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


LANDSCAP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	landscap
 PURPOSE: (one line)
	Procedure for initializing the PS device for plotting.
 DESCRIPTION:
	Output plotting device is change to PS in landscape mode with a
	Helvetica font.
 CATEGORY:
	Utility
 CALLING SEQUENCE:
	landscape
 INPUTS:
	None.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	None.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory.

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


LCFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  lcfit
 PURPOSE: 
  Fit a lightcurve function (Fourier series plus phase coefficient).
 DESCRIPTION:
 CATEGORY:
  Function fitting
 CALLING SEQUENCE:
 INPUTS:
  lon    - Longitude of sub-earth point (0 to 360).
  phang  - Phase angle (Sun-Object-Earth angle in degrees).
  data   - Measured values.
  sig    - Uncertainties of the data.
  nterms - Number of fourier terms to fit.  (2*nterms+1 unknowns)
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  c - fourier series coefficients (see fourfunc)
  csig - uncertainties of the coefficients
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/10, Written by Marc W. Buie, Lowell Observatory

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


LCFITSVD

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  lcfitsvd
 PURPOSE: 
  Fit a lightcurve function (Fourier series plus phase coefficient).
 DESCRIPTION:
 CATEGORY:
  Function fitting
 CALLING SEQUENCE:
 INPUTS:
  lon    - Longitude of sub-earth point (0 to 360).
  phang  - Phase angle (Sun-Object-Earth angle in degrees).
  data   - Measured values.
  sig    - Uncertainties of the data.
  nterms - Number of fourier terms to fit.  (2*nterms+1 unknowns)
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  c - fourier series coefficients (see fourfunc)
  csig - uncertainties of the coefficients
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/10, Written by Marc W. Buie, Lowell Observatory
  95/08/01, cloned from LCFIT by MWB

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


LCFUN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  lcfun
 PURPOSE: 
  Compute a lightcurve function (Fourier series plus phase coefficient).
 DESCRIPTION:
  This is to be used in cases where you already know the fundamental period.
  The input independent variable is assumed to be reduced to phase of a
  fundamental period already.  The integer part of the number is not used
  by the function.
 CATEGORY:
  Mathematical
 CALLING SEQUENCE:
 INPUTS:
  x - independent variable (longitude, between 0 and 360)
  c - fourier series coefficients
        0 - beta    -> linear phase coefficient
        1 - a(0)    -> constant term
        2 - a(1)    -> cos(x2pi)
        3 - b(1)    -> sin(x2pi)
        4 - a(2)    -> cos(2x2pi)
        5 - b(2)    -> sin(2x2pi)
     and so on for as many elements as in c
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  f    - Evaluated function value
  pder - (Optional) partial derivatives
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/10, Written by Marc W. Buie, Lowell Observatory

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


LCFUNF

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  lcfunf
 PURPOSE: 
  Compute a lightcurve function (Fourier series plus phase coefficient).
 DESCRIPTION:
  This is to be used in cases where you already know the fundamental period.
  The input independent variable is assumed to be reduced to phase of a
  fundamental period already.  The integer part of the number is not used
  by the function.
 CATEGORY:
  Mathematical
 CALLING SEQUENCE:
 INPUTS:
  x - independent variable (longitude, between 0 and 360)
  c - fourier series coefficients
        0 - beta    -> linear phase coefficient
        1 - a(0)    -> constant term
        2 - a(1)    -> cos(x2pi)
        3 - b(1)    -> sin(x2pi)
        4 - a(2)    -> cos(2x2pi)
        5 - b(2)    -> sin(2x2pi)
     and so on for as many elements as in c
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  return value - Evaluated function value
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/10, Written by Marc W. Buie, Lowell Observatory
  95/08/01, cloned from LCFUN by MWB

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


LCLXTREM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  lclxtrem
 PURPOSE:
  Find local minima or maxima in a 1-d vector.
 DESCRIPTION:

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  idx=lclxtrem(vec,width,[/MAXIMA])
 INPUTS:
  vec - Input vector of data points.
  width - size of zone to search, minima (or maxima) separated by less than
            width are never returned.  (Default = 5)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  MAXIMA  - Flag, if set, causes program to search for local maxima, the default
            is to search for local minima
 OUTPUTS:
  Returns indicies into vec that give local extrema.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/12/5, Written by Marc W. Buie, Lowell Observatory

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


LDCALIB

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  ldcalib
 PURPOSE: 
  Load calibration frames and information as instructed by calib file.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  ldcalib,calibfile,calib,valid
 INPUTS:
  calibfile - Name of calibration file to read.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  calib - anonymous structure with calibration information
           tag contents and usage:
              xl     - overscan left boundary (-1 means no overscan).
              xr     - overscan right boundary (-1 means no overscan).
              x1     - LLHC (x) of cropping region.
              x2     - URHC (x) of cropping region.
              y1     - LLHC (y) of cropping region.
              y2     - URHC (y) of cropping region.
              bias   - Bias image.
              dark   - dark image (scalar 0 if no dark correction needed).
              flat   - Array of flat images.
              filter - String array of filter names for flat array.
  valid - Flag, if true indicates a valid calibration set was loaded.  The
            contents of calib are unreliable if this flag is false.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  This program reads the given calibration file, decodes the information into
    a structure with all the was in the file.  It handles reading all the
    supported version of calibration files with the hope that all older
    versions can always be read and made (in some way) to be upward
    compatible.  The organization of the returned structure is, however,
    subject to future change and expansion as the need arises.

  The following describe the file format for the supported versions.

  Version 1 files:
     Line 1 - ID line, "calib_file_v01"
     Line 2 - Instrument  (rest of file depends on this).

     LCCD
        Line 3 - Name, including path, of bias frame.
        Line 4 to end - Filter code, and file name of flat field
                       image for this filter.

     LORAL
        Line 3 - overscan limits (x1, x2)
        Line 4 - cropping region (x1:x2,y1:y2)
        Line 5 - Name, including path, of bias frame.
        Line 6 to end - Filter code, and file name of flat field
                     image for this filter.

  Version 2 files:
     Line 1 - ID line, calib_file_v02
     Line 2 - overscan limits (x2,x2), if none, use -1 -1
     Line 3 - cropping region (x1:x2,y1:y2)
     Line 4 - Name, including path, of bias frame.
     Line 5 to end - Filter code, and file name of flat field
                       image for this filter.

  Version 3 files:
     Line 1 - ID line, calib_file_v03
     Line 2 - overscan limits (x2,x2), if none, use -1 -1
     Line 3 - cropping region (x1:x2,y1:y2)
     Line 4 - Name, including path, of bias frame.
     Line 5 - Name, including path, of dark frame.  [none] means not needed.
     Line 6 to end - Filter code, and file name of flat field
                       image for this filter.

 MODIFICATION HISTORY:
  95/08/08, Written by Marc W. Buie, Lowell Observatory

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


LDCALIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  ldcalir
 PURPOSE: 
  Load calibration information for OSIRIS XD data from a calib file.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  ldcalir,calibfile,calib,valid
 INPUTS:
  calibfile - Name of calibration file to read.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  CALIBPATH - Path to location to look for calibration files (flat).
                 The default is the current directory.
  SILENT    - Flag, if true suppresses all informational output.
  NOFLAT    - Flag, if true suppresses loading the flat field image.
 OUTPUTS:
  calib - anonymous structure with calibration information
           tag contents and usage:
              height - height of slit in pixels.
              nor    - number of orders in spectral image.
              por    - maximum polynomial order for wavlength calibration.
                         quadratic=2
              slope  - slope of each order (dy/dx).
              x1     - starting x value of each order.
              x2     - ending x value of each order.
              y0     - y value at bottom of slit for x=0 for each order.
              flat   - Strip format flat image.
              flatname- Name of flat field image loaded.
              cof    - Wavelength calibration poly coeffs [nor,por].
              npts   - Total number of points (all orders)
              w      - Wavelength values for each order [npts].
              o      - Range of points in each order [nor,2].
  valid - Flag, if true indicates a valid calibration set was loaded.  The
            contents of calib are unreliable if this flag is false.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/09/14, Written by Marc W. Buie, Lowell Observatory
  96/05/27, MWB, changed structure organization and added a new, improved
                 file format.
  97/12/18, MWB, added NOFLAT keyword

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


LIMBCEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  limbcen
 PURPOSE: 
  Find center of body from centroid of limb points (Designed for Jupiter).
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  limbcen,image,xcen,ycen,DISPLAY=display
 INPUTS:
  image   - Image (or cube) to find limb-centers for.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  DISPLAY - window number for optional display (not 0), default no display.
 OUTPUTS:
  xcen    - Centroided position in X
  ycen    - Centroided position in Y
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/08/16 - Written by Marc W. Buie, Lowell Observatory.

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


LINKOBJ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  linkobj
 PURPOSE:
  Cross check three source lists from one field and identify moving objects.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  linkobj,tag,fna,fnb,fnc,CANDIDATE=cand,NODISPLAY=nodisplay
 INPUTS:
  tag - name of the field, should not contain any blanks
  fna - file name for the earliest image (Frame A)
  fnb - file name for the middle image (Frame B)
  fnc - file name for the last image (Frame C)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

  BADCOL    - Array of column numbers, any source found within 2.5 pixels of
                these columns will be discarded.  Default = no bad columns.

  CANDIDATE - Flag, used for testing, when set will plot all detected sources
                in all images.  If you think a triplet should have been picked
                up, set this to see if all three images were actually in the
                original source list.

  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.

  MAXRATE   - Maximum motion rate permitted for a tripet, in pixels/hour.
                The default is 50.0 pixels/hour.

  MINRATE   - Minimum motion rate permitted for a tripet, in pixels/hour.
                The default is 1.0 pixels/hour.

  NODISPLAY - Flag, when set will suppress all image display allowing program
                to be run in background or batch mode.  This will be somewhat
                faster as well.  The display steps take a small but non-trivial
                amount of time.

  PATH      - Optional path for original image directory.
                If not specified, the current directory is used.

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
   98/03/11, Written by Marc W. Buie, Lowell Observatory

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


LOADKEYS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  loadkeys
 PURPOSE:
  Load FITS header keyword correspondence list from file.
 DESCRIPTION:

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  loadkeys,keyfile,keylist
 INPUTS:
  keyfile - string with file name to load, if '[[default]]', doesn't load
              a file but will return a default list.
  keylist - string array
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  keylist - 3,n element string array.  For each key, there are three elements:
                0 - "standard" key name
                1 - item descriptor, K - keyword, T - template, V - value
                2 - information (contents match what descriptor indicates)

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/06/12, Written by Marc W. Buie, Lowell Observatory
  97/07/21, MWB, added RA, DEC

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


LOADSTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  loadstar
 PURPOSE: (one line)
  Load the master star catalog file
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  loadstar
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 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

 OUTPUTS:
   common block is 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/loadstar.pro)


LOGMANIP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  logmanip
 PURPOSE:
  Widget for editing and manipulating photometry log files.
 DESCRIPTION:
 CATEGORY:
  Widgets
 CALLING SEQUENCE:
  logmanip,logfile
 INPUTS:
  logfile - String, file name of log file to work on.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  GROUP:  The widget ID of the widget that calls LOGMANIP.  When this
          ID is specified, a death of the caller results in the death of
          the LOGMANIP widget application.

  TITLE:  A scalar string to be used for the window title.  If it is
          not specified, the default title is "Photometry Log File Editor"
  JUSTCLEAN: Flag, if set supresses the interactive widget operation.  All
                that is done is to scan for duplications and remove them.
                Output is also sorted.
  DELETEFILE: If supplied, will mark the first batch of observations in this
                file for deletion.  (Remember, first column in log file is
                the file name where the observation came from.)

 OUTPUTS:
  modified log file is written out to logfile
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
  This function initiates the XMANAGER if it is not already running.
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/2 - Written by Marc W. Buie
  97/04/06, MWB, added DELETEFILE keyword

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


LOOKER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  looker
 PURPOSE:
  Visual identification and measurement of moving objects in digital images.
 DESCRIPTION:

  This program handles visually inspecting large digital images and permiting
     measuring positions of the objects found.  The object lists created
     by this program are compatible with similar files used by ASTROM,
     GARTH, and FINDSRC.

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  looker
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

    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.

  OBJRAD    - Radius of the object aperture to use when centroiding objects.
                Default is 6 pixels.

  PATH      - Optional path for original image directory.
                If not specified, the current directory is used.

  PSCALE    - Nominal plate scale of images in arcsec/pixel (default=0.26)

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 PROCEDURE:

  This program is intended to work with a collect of images taken on a single
    night of observing.  Generally it will be best to work in a directory
    separate from the raw (or processed) image data.   The optional keyword,
    PATH, is used to point to the directory containing the images.  You
    will also need to provide a keyword correspondence file for decoding the
    FITS headers.

  The images can either be in a simple format of one image per file or can
    be collections under the multi-group FITS format as used by the KPNO
    MOSAIC camera.

  Images that cover the same region of sky are considered to be a group
    identified by the "field name" which is taken from the OBJECT keyword
    in the FITS header.  If the images are multi-group files then the group
    being processed is identified by an extension tag of the form "xN" where
    N is the extension number being processed.

  You start using this program by creating a "new" field (under the File
    menu option).  To start a new field you will need to select an image
    that serves as the first epoch view of the field.  If you have images
    of varying quality it would be wise to make the first image selected be
    one of the best.  However, under most circumstances you will pick the
    earliest image.  After selecting the first frame it will be displayed as
    a red image.  This image is always loaded into the red display channel.

  To begin looking for moving objects, you must have at least two images
     of the field.  Add the second (or third, ...) to the list for this field
     with the appropriate File menu option.  If you already have multiple
     images identified then you can simply select the appropriate "secondary"
     image.  The secondary image is another image of the same field at a
     different time from the first image loaded.  The secondary image is
     always loaded into the blue and green planes of the display.  Any object
     that appears in both epochs at the same place will look white.  An
     object that moves will show as a red/cyan pair of images.

  Before you can effectively identify object, you must register the secondary
     frame relative to the first image.  In the Object status area of the
     tool it will indicate "Updating Offset" if image registration is in
     progress.  This mode is automatically entered when adding a new image to
     the list.  You can also enter this mode on your own with the "Adjust
     Frame Registration" option on the File menu.  In this mode, click left
     on a red (first epoch) star image.  Then, click middle on the same
     star in the blue (second epoch) image.  The relative offset will be
     computed and the second frame will be shifted to align with the first
     frame.  When you are done with the registration click the right button
     to exit the registration mode.

  The three mouse buttons are used for different functions in all three "image"
     windows.  These windows are called "Main" -- the largest window which
     shows the aligned image pair; "Zoom" -- small, square window in the lower
     right that shows a logrithmic stretch on the image just measured; and
     "Score" -- window in the upper right that is used for navigating and
     keeping track of what you've looked at so far.  The score window shows
     a minified schematic of the full sized image.  Areas that have been
     looked at are marked in green with the intensity increasing for each
     time the area is viewed.  The current display area is highlighted with
     a purple border.

  Here are the principle mouse function in each window:
     Score -
        Left: Center Main window at location of cursor.
        Middle: Move by half a image window in the direction of greatest
                 offset (vertical or horizontal) between the cursor and
                 the location of the current display area.
        Right:  Center Main window on the "slot" whose center is closest
                 to the cursor.  The "slots" are integral mappings of the
                 main window into the full image and are highly quantized.
                 Clicking right on a black region will always give you new
                 areas to view.

     Main -
        Left:   Measure object nearest cursor in first epoch (red) image.
                 The location clicked is used as a starting point for the
                 measurement and eventual position comes from a centroid
                 centered on the object even if you don't click precisely
                 on the object.  This action will cause the Zoom window to be
                 updated with an extraction centered on the centroided
                 location and a red circle will overdrawn on the object.
        Middle: Same as the left button except the second epoch (cyan) image
                 is measured.
        Right:  Select the nearest object (by its first epoch position)
                 to be the current object.  You can see this position on
                 the main image by the red circles and associated object
                 number label.  You must click within 50 pixels of the 
                 object to select it.  When an object is selected, the
                 last known centroid location on the first epoch image
                 is used to update the zoom window as if you had just clicked
                 left on the object.

        Note, there is are a few protections built into this window.  If
        the main window location changes and the current object is no longer
        on the window, the object changes to be a NEW object.  If you click
        too far from a previous measurement on the same object you will get
        a warning box in case you meant to start a new object.

     Zoom -
        Left:   Re-locate the object position to the cursor position without
                 changing the zoom window view.  The overdrawn circle will
                 move, but not the image.  Use this feature to override an
                 automatic centroid position that is corrupted from field
                 stars, cosmic rays, or chip defects.
        Middle: Same as left except the zoom window is re-centered on the
                 location where you clicked.  The display stretch is also
                 recomputed using the pixel at the center as the peak
                 intensity for the object.
        Right:  Not used.

  There is a pattern to the measurement process.  On the first pair of images
     you will generally click left then middle on each new object.  You
     will either click "New Object" or this will be automatic if object is
     on a new piece of the image.  Once all the objects are found and measured
     in the first pair of images you will then look at the second pair (or
     third, ...)  Click left in the score window to center the main window,
     then click right on the red circle then click middle on the cyan image
     for that object.

  If you happen to click on a pair of objects that really are just chip
     defects that look like a moving object, you will get a warning.  Unless
     you are very, very sure it is real you should not keep such objects.

 RESTRICTIONS:

  Even though you appear to be able to browse to a different directory
  for the raw data, don't.  All the raw frames should be in the same directory
  and pointed to by the PATH keyword.  Also, all the field names (aka, object
  lists) should be kept in the same directory as well.

  It is assumed that images from the same night are the same size.

  For multi-group images, it is assumed that all the relevant exposure
  information can be culled from the extension header.  In other words,
  the bulk of the primary header must be found in each of the extension
  headers.

  This entire scheme is predicated on there being just a "few" images on
  each field.  In theory there is no upper limit to the number of images
  on a field but in practice too large a number gets to be rather cumbersome
  in looking at the .obj files.  Basically things get really cluttered if
  there are too many related frames.  This isn't too bad since you don't
  need that many frames to get good astrometry anyway.  Three frames tells
  you just as much as 100 frames as long as the time span from first to
  last is the same.

 MODIFICATION HISTORY:
  98/10/27, Written by Marc W. Buie, Lowell Observatory
  98/11/20, MWB, added OBJRAD keyword

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


LOWESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  lowess
 PURPOSE:
  Lowess smoothing of data.
 DESCRIPTION:

  This algorithm was gleaned from a description of LOWESS, standing
  for LOcally WEighted Scatterplot Smoother, found in "The Elements of
  Graphing Data", by William S. Cleveland, Wadsworth Advanced Books and
  Software.  This implementation is probably not the same as the one
  described.  I have tried to include the provision for using different
  weighting functions.  At the time of writing I don't know what effect
  different functions have upon the smoothing process.  This procedure
  in itself is not intended to be robust (as defined by Cleveland). By
  including the possiblity of varying weights for the data points it is
  possible to acheive robustness by multiple calls of this routine.

 CATEGORY:
  Numerical
 CALLING SEQUENCE:
  lowess,x,y,width,ysmoo,WEIGHT=weight
 INPUTS:
  x      - Independant variable values.
  y      - Dependant variable values.
  width  - Width of smoothing function (in same units sa X).
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  NEWX   - If provided, the smoothed curve is computed over this input
             range of x values rather than the input x range.  ysmoo
             will have the same length as NEWX if it is provided.
  ORDER  - Order of polynomial fit during the lowess smoothing. (default=1)
  WEIGHT - Weight to use for each point (default is to have equal weight)

 OUTPUTS:
  ysmoo  - Smoothed version of Y, same number of points as input x and y.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
  By default, the weighting function is triangular where the weight is
  1 at the output point location, and drops linearly to zero +/- width from
  the output point.

 MODIFICATION HISTORY:
  98/06/16, Written by Marc W. Buie, Lowell Observatory

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


LPLASTCHK

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

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  lplastchk,matchfile
 INPUTS:

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/04/27, Written by Marc W. Buie, Lowell Observatory

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


LSIDTIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  lsidtim
 PURPOSE: 
  Compute local sidereal time at a given longitude and time.
 DESCRIPTION:
  This routine is based on the algorithms from p. 39 of "Astronomical
  Formulae for Calculators" by J. Meeus.
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  lsidtim,jd,lon,sidtim [,UT=ut]
 INPUTS:
  jd  - Julian Date (double precision), scalar or vector.
  lon - West longitude of observatory in radians (scalar).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  UT  - Time, in hours to add to JD to get the correct Universal Time.
           That the same as Universal Time minus the Local Time.
 OUTPUTS:
  lst - Local sidereal time for each of the input times (radians).
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/05/05 - Written by Marc W. Buie, Lowell Observatory

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


LTCRV

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  ltcrv
 PURPOSE: 
  Photometric lightcurve reductions against a single comparison star.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  pro ltcrv,stand,fil,jd,am,serial,mag,err,object,objno,comp,dofil, $
       jdobs,redmag,rederr, $
       NOPRINT=noprint, NOPLOT=noplot, BINFAC=binfac, FORCE=force
 INPUTS:
  stand  - String array of standard names.  (See coord.)
  fil    - String array of filter names for observations.
  jd     - Double precision array of Julian dates.
  am     - Floating point array of the airmass of observations.
  serial - Serial number of observation.
  mag    - Raw instrumental magnitudes.
  err    - Uncertainties on the raw magnitudes.
  object - Standard name of program object to reduce against comp star.
  objno  - Serial number of program object.  (Usually 0)
  comp   - Standard name of comparison star.
  dofil  - Name of filter to reduce.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  BAD     - Set of flags that will mark data bad (if 1), good if 0.
  BINFAC  - Maximum amount of comparison star point to bin (default=6)
  FILTNAME- Proper name of filter, should be just one or two characters.
              if not given, 1=B, 2=V, 3=R is used for the default
  OBJNAME - Proper name of object, default = object:objno
  FORCE   - Two element vector that contains override values for the
              mean extinction and its uncertainty.  This replaces the
              initial fit for mean extinction.
  NOPLOT  - Flag, if true will inhibit the summary plot.
  NOPRINT - Flag, if true, will inhibit the summary printout to the screen.

  K2      - Second order extinction coefficient and error (default=[0,0])
  CTERM   - Color term and error (default=[0,0])
  OCOLOR  - Standard color and error for object (default=[0,0])
  SCOLOR  - Standard color and error for star (default=[0,0])
  STDMAG  - Standard magnitude and error for star (default=[0,0])

 OUTPUTS:
  jdobs  - Final Julian date of reduced observation of program object.
  redmag - Final reduced magnitude of object compared to comp star.
  rederr - Final uncertainty.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  93/07/28 - Written by Marc W. Buie.  Patterned after a similiar program
              of David Tholen's.
  93/10/25, MWB, added optional transformation coefficients.
  93/12/10 - MWB, added extinction override (FORCE)
  96/02/21 - MWB, total rewrite, added BAD flags

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


LTCRV2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  ltcrv2
 PURPOSE: (one line)
  Photometric lightcurve reductions with known transformation.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
     ltcrv2,stand,fil,jd,time,am,serial,inst,instsig,color,colorsig, $
        doobj,doser,dofil,tran,transig,jdref,jdobs,tobs,std,stdsig
 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.
  time     - Floating point array of the UT time 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
  color    - Standard system color for object.
  colorsig - Uncertainty on the standard color
  doobj    - Name of object to reduce.
  doser    - Serial number of object to reduce.
  dofil    - Name of filter to reduce.
  tran     - Transformation coefficients (vector)
                tran(0) = principal extinction coefficient
                tran(1) = second order extinction coefficient
                tran(2) = color term
                tran(3) = zero-point
  transig  - Uncertainty on the transformation coefficients (vector).
  jdref    - Time reference point for extinction
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  NOPLOT   - Flag, if set, suppresses a plot of the final lightcurve.
  FILTNAME - String name for selected filter, default for 2=V and 3=R.
  FILE     - If supplied, the reduced lightcurve will be saved to this file.
  APPEND   - Flag, if true, data will be appended to FILE
  BADFLAGS - Array of flags that mark data bad (if true).
  NOEDIT - Flag, if set inhibits final interactive editing of fitted points.
             This keyword has no effect and is not necessary if the current
             plotting device is 'PS'.
 KEYWORD OUTPUT PARAMETERS:
  BADFLAGS - Array of flags that mark data bad (if true).
 OUTPUTS:
  jdobs    - JD of observation for each point.
  tobs     - UT Time of observation for each point.
  std      - Standard magnitude.
  stdsig   - Uncertainty of the standard magnitude.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written: 1992 Mar 31, Marc W. Buie, Lowell Observatory.
  96/10/16 - MWB - added NOPLOT keyword
  96/01/24, MWB, added BADFLAGS

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


MAG2FLX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     mag2flx
 PURPOSE: (one line)
     Convert from magnitudes to flux units with errors.
 DESCRIPTION:
 CATEGORY:
     Astronomy
 CALLING SEQUENCE:
     mag2flx,mag,magerr,flux,fluxerr
 INPUTS:
     mag    - Magnitudes.
     magerr - Uncertainties on the magnitudes.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     ZEROPT  - Magnitude that corresponds to a flux of 1. (default=0)
 OUTPUTS:
     flux    - Flux values for the magnitudes.
     fluxerr - Uncertainties on the fluxes.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


MAPSEQ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mapseq
 PURPOSE: (one line)
	Animate a seqence of PLUTOMEM maps.
 DESCRIPTION:
 CATEGORY:
       Miscellaneous
 CALLING SEQUENCE:
	mapseq,root,frame1,frame2,scale,step=step
 INPUTS:
	root   - String containing a four character root for the map file name.
	frame1 - Starting frame number to animate.
	frame2 - Ending frame number to animate.
	scale  - Zoom factor for the image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
	step   - Step size between frames to be displayed (default = 1).
 OUTPUTS:
	Visual output only.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
	The number of frames to animate (frame2-frame1)/step must be less than
	256.  This is a limitation imposed by Xinteranimate as of Jan. 1992.
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Jan. by Marc W. Buie, Lowell Observatory.

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


MARKDATA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  markdata
 PURPOSE:
  Widget for marking/unmarking bad data.
 DESCRIPTION:
  Mouse click and drag will define a selection of points.  Newly selected
  points will be marked in green.  To mark these as bad, click the 'Bad'
  button.  To mark these green points as good, click the 'Good' button.
  Bad points are plotted in red.  The rest of the control buttons should
  be self-explanatory.
 CATEGORY:
  Widgets
 CALLING SEQUENCE:
  markdata,y,bad
  markdata,x,y,bad
  markdata,x,y,err,bad
 INPUTS:
  y   - Dependent variable.
  bad - Flag array, 0 --> good data, 1 --> bad data.
 OPTIONAL INPUT PARAMETERS:
  x   - (3 or 4 arg input) Independent variable (if not supplied, ordinal
           point number is used instead.
  err - (4 arg input) Uncertainty on y.
 KEYWORD INPUT PARAMETERS:
  GROUP:  The widget ID of the widget that calls MARKDATA.  When this
          ID is specified, a death of the caller results in the death of
          the MARKDATA widget application.

  TITLE:  A scalar string to be used for the window title.  If it is
          not specified, the default title is "Data Editor"

  XTITLE: X title for plot, default='x'

  YTITLE: Y title for plot, default='y'

  PTITLE: Title string for plot.

  XSIZE:  ysize of plot window, default=600

  YSIZE:  ysize of plot window, default=400

  SCALING: 0 -> start with Scale Good (default)
           1 -> start with Scale Good (default)

  XFLIP:  Flag, true means to flip the x-axis
  YFLIP:  Flag, true means to flip the y-axis
  CONNECT: flag, true means to connect data points with lines

 OUTPUTS:
  bad - modified flag array.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
  MWB_MARKDATA: COMMON block that holds the new vector for the bad values
                  during the time it takes to exit the routine.
 SIDE EFFECTS:
  This function initiates the XMANAGER if it is not already running.
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/10/29 - Written by Marc W. Buie, Lowell Observatory
  97/2/5, MWB, added Clear, and All Bad buttons.

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


MATCHOBJ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     matchobj
 PURPOSE: (one line)
     Find matches for non-standard names in a correspondence list.
 DESCRIPTION:

     This program compares the items in the input list against the known
     names that are in a correspondence list and returns a matched list
     for the input.

 CATEGORY:
  Utility
 CALLING SEQUENCE:
     matchobj,proper,informal,rawname,goodname
 INPUTS:
     proper   - String array of proper ephemeris names.
     informal - String array of informal object names.
     rawname  - String array of informal names to match up.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
     goodname - String array of proper ephemeris names that match rawname.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/26/93 - Written by Marc W. Buie, Lowell Observatory.
     98/4/2, MWB, renamed to avoid conflict with Astron Lib routine.

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


MATCHUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  matchup
 PURPOSE:
  Read a batch of FITS files and create a list of common object exposures.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  matchup,root
 INPUTS:
  root - String, root of file name for the FITS files.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  OUTFILE - Name of output match file, default = root+'.match'
  PATH - Path of where to find the source images, default=current directory.
 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
 98/06/23, Written by Marc W. Buie, Lowell Observatory

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


MAXLOC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     maxloc
 PURPOSE: (one line)
     Find the column-wise, row-wise, or point location of the image maximum.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
     maxloc,array,xpos,ypos,start,stop
 INPUTS:
     array - Input array to be scanned.
 OPTIONAL INPUT PARAMETERS:
     start - starting location in array to begin scanning (def=0)
     stop  - ending location in array for scan (def=end of array)
 KEYWORD INPUT PARAMETERS:
     X     - FLAG, find maxima as a function of x in the image.
     Y     - FLAG, find maxima as a function of y in the image.
     POINT - FLAG, find location of absolute maximum in the image (default).
 OUTPUTS:
     xpos  - x index for maximum location.
     ypos  - y index for maximum location.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     93/04/27 - Written by Marc W. Buie, Lowell Observatory
     95/03/24, MWB, added start and stop optional inputs.

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


MAXMIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	maxmin
 PURPOSE:
	Return vector [max,min] of input array or vector.

 DESCRIPTION:
	Return a 2 element array giving the maximum and minimum of a vector
	or array.  This is faster than doing a separate MAX and MIN.

 CATEGORY:
	Utility
 CALLING SEQUENCE:
	value = maxmin( array )
 INPUTS:
	array - an IDL numeric scalar, vector or array.

 OUTPUTS:
	value = a two element vector, 
		value(0) = maximum value of array
		value(1) = minimum value of array

 EXAMPLE:
	Print the maximum and minimum of an image array, im
 
         IDL> print, maxmin( im )

 PROCEDURE:
  The MIN function is used with the MAX keyword.  This function is "opposite"
  of the MINMAX function and is useful for automatic yrange for plots that
  need an inverted range (from max to min).

 REVISION HISTORY:
	Cloned from MINMAX by Marc Buie,     July 1995
    original verision written by W. Landsman,  January, 1990

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


MEANERR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	meanerr
 PURPOSE: (one line)
	Calculate the mean and estimated errors for a set of data points
 DESCRIPTION:
	This routine is adapted from Program 5-1, XFIT, from "Data Reduction
	and Error Analysis for the Physical Sciences", p. 76, by Philip R.
	Bevington, McGraw Hill.  This routine computes the weighted mean using
	Instrumental weights (w=1/sigma^2).
 CATEGORY:
	Statistics
 CALLING SEQUENCE:
	meanerr,x,sigmax,xmean,sigmam,sigmad
 INPUTS:
	x      - Array of data points
	sigmax - array of standard deviations for data points
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
	xmean  - weighted mean
	sigmam - standard deviation of mean
	sigmad - standard deviation of data
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1992 Feb 20

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


MEDARR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	medarr
 PURPOSE: (one line)
	Combine arrays with a median average.
 DESCRIPTION:
       This will combine a series of arrays into a single array by filling each
       pixel in the output array with the median of the corresponding pixels
       in the input arrays.
 CATEGORY:
	CCD data processing
 CALLING SEQUENCE:
       medarr, inarr, outarr
 INPUTS:
       inarr  -- A three dimensional array containing the input arrays to
                 combine together.  Each of the input arrays must be two
                 dimensional and must have the same dimensions.  These arrays
                 should then be stacked together into a single 3-D array,
                 creating INARR.
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
       outarr -- The output array.  It will have dimensions equal to the
                 first two dimensions of the input array.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	This will run VERY slow if inarr and outarr won't fit into real memory
	on your computer.  Don't try this using virtual memory.
 PROCEDURE:
       The output array is created and then each pixel is extracted from the
	cube.  Once extracted, the pixel stack is sorted and the middle value
	is put into the output array.
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 17 January 1992

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


MKBIAS

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  mkbias
 PURPOSE: 
  Collect and combine CCD bias frames into a superbias frame
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  mkbias,root,outsuf,start,nframes
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/09 - Initial crude version written, Marc W. Buie, Lowell Observatory
  95/06/13, MWB, added OVERSCAN and CROP keywords
  95/11/22, MWB, add EXCLUDE keyword

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


MKCALIB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  mkcalib
 PURPOSE:
  Interactive program for creating CCD calibration files.
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  mkcalib
 INPUTS:
  Everything is asked for interactively
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
   FILKEY = String - FITS keyword to read to get filter code, default = FILPOS
   EXPKEY = String - FITS keyword to read to get exposure time, default = EXPTIME
   OVERSCAN = column overscan region to use for frame bias level,
                 default=[515,531]
   CROP     = region of original image to save, default=[0,511,0,511]
   DDIR     = String, name of directory where data exists.  If not provided,
                 the program will ask for it interactively.
   ROOT     = String, root of file name for data, usually YYMMDD (ut date).
                 Program will ask for this if not provided.
   SCALE    = Passed to MKFLAT.  (Flat field scaling region.)
 OUTPUTS:
  All output is confined to files.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/01/07 - Marc W. Buie, Lowell Observatory
  96/05/24 - MWB, added PICKFILE support, various bug fixes, improvements
               to the files.cal file creation.
  96/06/08 - MWB, added DDIR and ROOT

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


MKDARK

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  mkdark
 PURPOSE: 
  Collect and combine CCD dark frames into a superdark frame
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  mkdark,root,outsuf,start,nframes,bias,dark
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/09 - Initial crude version written, Marc W. Buie, Lowell Observatory
  95/08/30, MWB, added OVERSCAN and CROP keywords
  95/11/22, MWB, add EXCLUDE keyword

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


MKFLAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  mkflat
 PURPOSE: 
  Collect and combine CCD flat frames into a superflat frame
 DESCRIPTION:
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  mkflat,root,outsuf,start,nframes,bias,dark,flat
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/10 - Initial crude version written, Marc W. Buie, Lowell Observatory
  95/06/04, MWB, added EXCLUDE keyword
  95/06/13, MWB, added SCALE, OVERSCAN, CROP keywords

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


MOMENT4

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	moment4
 PURPOSE: (one line)
	Compute various statistical moments of the data.
 DESCRIPTION:
	This routine computes the average, average deviation, standard
	deviation, variance, skew and kurtosis of the input data.  The various
	output quantities are always returned as floating point scalars.
	The statistics are compute with no regard for the dimensionality of
	the input data.
 CATEGORY:
	Statistics
 CALLING SEQUENCE:
	moment4,data,avg,avgdev,stddev,var,skew,kurt
 INPUTS:
	data - Input data to be analyzed.
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
	avg    - Sample mean.
	avgdev - Average deviation of the data from the mean.
	stddev - Standard deviation of the data from the mean.
	var    - Variance of the data from the mean.
	skew   - Skewness, third statistical moment.
	kurt   - Kurtosis, fourth statistical moment.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Standard techniques, see section 13.1 in Numerical Recipies.
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1992 Jan 20
  1997/09/06, MWB, changed name from moment to avoid name conflict.

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


MYSVDFIT

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

 PURPOSE:
   Perform a general least squares fit with optional error estimates.

 DESCRIPTION:
   This version uses SVD.  A user-supplied function or a built-in
   polynomial is fit to the data.

 CATEGORY:
   Function fitting

 CALLING SEQUENCE:
   Result = SVDFIT(X, Y, M)

 INPUTS:
   X:   A vector representing the independent variable.  If this an array,
           the columns are taken to be the precomputed independant vectors
           and no actual function is computed here.

   Y:   Dependent variable vector.  This vector should be same length 
      as X.

   M:   The number of coefficients in the fitting function.  For 
      polynomials, M is equal to the degree of the polynomial + 1.

 OPTIONAL INPUTS:
   Weight:   A vector of weights for Y(i).  This vector should be the same
      length as X and Y.

      If this parameter is ommitted, 1 is assumed.  The error for 
      each term is weighted by Weight(i) when computing the fit.  
      Frequently, Weight(i) = 1./Sigma(i) where Sigma is the 
      measurement error or standard deviation of Y(i).

   Funct:   A string that contains the name of an optional user-supplied 
      basis function with M coefficients. If omitted, polynomials
      are used.

      The function is called:
         R = FUNCT(X,M)
      where X is an N element vector, and the function value is an 
      (N, M) array of the N inputs, evaluated with the M basis 
      functions.  M is analogous to the degree of the polynomial +1 
      if the basis function is polynomials.  For example, see the 
      function COSINES, in the IDL User Library, which returns a 
      basis function of:
         R(i,j) = cos(j*x(i)).
      For more examples, see Numerical Recipes, page 519.

      The basis function for polynomials, is R(i,j) = x(i)^j.
      
 OUTPUTS:
   SVDFIT returns a vector of M coefficients.

 OPTIONAL OUTPUT PARAMETERS:
   NOTE:  In order for an optional keyword output parameter
   to be returned, it must be defined before calling SVDFIT.
   The value or structure doesn't matter.  For example:

      YF = 1            ;Define output variable yf.
      C = SVDFIT(X, Y, M, YFIT = YF)    ;Do SVD, fitted Y vector is now
                  ;returned in variable YF.

   YFIT:   Vector of calculated Y's.

   CHISQ:   Sum of squared errors multiplied by weights if weights
      are specified.

   COVAR:   Covariance matrix of the coefficients.

    VARIANCE:   Sigma squared in estimate of each coeff(M).

    SINGULAR:   The number of singular values returned.  This value should
      be 0.  If not, the basis functions do not accurately
      characterize the data.

 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   None.

 MODIFICATION HISTORY:
   Adapted from SVDFIT, from the book Numerical Recipes, Press,
   et. al., Page 518.
   minor error corrected April, 1992 (J.Murthy)
   93/10/12, Marc W. Buie, Lowell Observatory.  Added option to make this
             work similar to "regress".
   97/03/20, MWB, Changed to use SVDC and SVSOL and everything is now in
               double precision.

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


NAIFNAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  naifname
 PURPOSE:
  Convert an ephem standard name to a common name (NAIF name scheme)
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  propername = naifname(standardname)
 INPUTS:
  standardname = string, standard name code (see EPHEM)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return is the proper string name, or, the input if standard name isn't
    recognized.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/02/12 - Written by Marc W. Buie, Lowell Observatory

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


NEGATIVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	negative
 PURPOSE: (one line)
	Invert the current display lookup table.
 DESCRIPTION:
	The current lookup table is fetched, rotated end-for-end, and put
	re-loaded.
 CATEGORY:
       Image display
 CALLING SEQUENCE:
	negative
 INPUTS:
	None.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Modifies current lookup table.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1991 Oct 29.

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


NOBNAME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	nobname
 PURPOSE: (one line)
	Replace all blanks in a string with an underscore character.
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
	outstr = nobname(instr)
 INPUTS:
	instr - Input string to massage.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Return is the input string with blank converted to underscore.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1991 Feb 26.

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


OBJRATIO

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

 PURPOSE:
  Ratio object spectra to one or more comp star spectra.

 DESCRIPTION:
  Ratio object spectra to comp stars, combined appropriately to
  match object airmasses.  For a single comp star, obviously you
  just get a simple ratio - no real airmass correction.  For two
  or more comp stars, an extinction is derived, and used to correct
  each comp star spectrum to the object airmass, prior to averaging
  the comp stars and performing the ratio.  If the /NOEXT keyword
  is set, no extinction correction is derived or applied.

 CATEGORY:
  Spectroscopy

 CALLING SEQUENCE:
  objratio, calib, object, o_am, o_times, comps, c_am, c_times, ratio

 REQUIRED INPUTS:
   object:  Array of object spectra [spectrum number, pixel number].
   o_am:    Array of object airmasses.
   o_times: Array of object mid-point exposure times.
   comps:   Array of comp star spectra [spectrum number, pixel number].
   c_am:    Array of comp star airmasses.
   c_times: Array of comp star mid-point exposure times.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
   O_BAD:  Array of badflags for the object spectra.
   C_BAD:  Array of badflags for the comp star spectra.
   NOEXT:  Force simple averaging (disable airmass correction).

 OUTPUTS:
   ratio:  Array of ratioed object spectra, same size as object array.

 KEYWORD OUTPUT PARAMETERS:
   R_BAD:  The resulting badflags in the ratio spectra.

 OPTIONAL OUTPUT PARAMETERS:

 COMMON BLOCKS:
  None.

 SIDE EFFECTS:
  Extinction plot is plotted to window 0.

 RESTRICTIONS:

 PROCEDURE:
  Currently, the times are ignored, but including them gives us the
  option of later doing an elaborate solution for extinction changing
  as a function of time, with a whole slew of comp stars, by changing
  only this single routine.  Otherwise we'd later have to track down
  and change all the instances where this routine is invoked.

 MODIFICATION HISTORY:
  1998/07/12 WG   Created by Will Grundy, Lowell Observatory
  1998/07/15 CDP  Changed program to accept the spectra as [pixel number,
                       spectrum number]
  1998/07/17 CDP  Added badflag filtering and creation for ratios
  1998/08, MWB, Rewrote extinction calculation.
  1998/09/08 WG   Generalized so that more than 2 comp stars can be
        used and added /NOEXT keyword.
  1998/09/09, MWB, Rewrote error checking and changed calling sequence.

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


OBSPLAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  obsplan
 PURPOSE:
  Generate a graphical summary of object location(s) for a given night.
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  obsplan,objcode,obs,date
 INPUTS:
  objcode - String array of standard object codes (see ephem.pro)
              -or-
            String containing file name of the list of objects but you
              must preceed the file name with @ to mark it as a file
              and not the name of an object.
            If supplied as a file, this file is a correspondence list
              of the type read by rdmatch.  Column 1 contains the standard
              object code and column 2 has a full or common name.  The
              columns are separated by a  character and the common name
              column MUST begin with a single quote (').  See RDMATCH
              for more details about this file format.
  obs     - Integer Marsden code of the observatory
               688 - Lowell Observatory
               500 - Geocentric
               If you provide an invalid code, 688 is assumed.
  date    - UT date and time vector near midnight,
                 [year,month,day,hour,minutes,seconds]
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  ALLDAY  - Flag, if set generates a plot for a full 24 hour period.
  AMLIMIT - Cutoff airmass for plot, default = 2.6
  FILE - Override on file name where observatory codes are to be found.
  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.
 OUTPUTS:
  Generates a plot to the current graphics device.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/10/07, Initial version written by Marc W. Buie, Lowell Observatory
  96/02/08, MWB, added parameter validation, airmass limit option,
                    and file option on objcode
  96/02/15, MWB, added support for star lookup and plotting.  Also, now
                    computes object position throughout night instead of
                    just at midnight.
  96/03/19, MWB, allow JD for input date.
  96/10/18, MWB, fixed bug that ignored h,m,s in input date.
  96/11/1,  MWB, Added ALLDAY keyword
  98/09/28, MWB, Fixed a coordinate interpolation bug.

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


OBSPROP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  obsprop
 PURPOSE:
  Observing proposal planning table generation
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  obsprop,objcode,obs,date1,date2
 INPUTS:
  objcode - String array of standard object codes (see ephem.pro)
  obs     - Integer Marsden code of the observatory
               688 - Lowell Observatory
               500 - Geocentric
               If you provide an invalid code, 688 is assumed.
  date1   - UT date and time vector near midnight for first night,
                 [year,month,day,hour]
  date2   - UT date and time vector near midnight for last night,
     
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  FILE - Override on file name where observatory codes are to be found.

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1997/02/18

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


OBSWIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  obswind
 PURPOSE:
  Compute possible observing window for a celestial object.
 DESCRIPTION:

 This routines determines the possible observing window for an object.
 The times of sunrise and sunset are left as input parameters to help
 speed up the computations.  It is expected that this routine will be called
 many times for a given date (LST0), but for different objects.
 RTIME and STIME denote the earliest time and the latest time that the object
 can be observed.  Note that if RTIME > STIME then the range passes through
 0 hours.  RKIND and SKIND tell what limits the ends of the window as follows:
        RKIND  will be either 'sunset' or 'rises' for TYPE = 0
        RKIND  will be 'sunset' for TYPE =  1
        RKIND  is undefined for TYPE = -1
        SKIND  will be either 'sunrise' or 'sets' for TYPE = 0
        SKIND  will be 'sunrise' for TYPE = 1
        SKIND  is undefined for TYPE = -1
        if TYPE = 2 then object is not available when sun is down.

 CATEGORY:
  Astronomy

 CALLING SEQUENCE:
  obswind,lst0,lat,ra,dec,srise,sset,rtime,rkind,stime,skind,type
 INPUTS:
  lst0  - Local Sidereal Time at local midnight (radians).
  lat   - Latitude of observatory (radians).
  ra    - right ascension of object (radians), should be of date.
  dec   - declination of object (radans), should be of date.
  srise - Time of sunrise (JD).
  sset  - Time of sunset (JD).
  
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  AMLIMIT - Air Mass limit to denote rise and set of object.  Default=3.0

 OUTPUTS:
  rtime - Time of opening of observing window (at rise or sunset)
  rkind - String that identifies limit, either 'sunset' or 'rises'
  stime - Time of closing of observing window (at rise or sunset)
  skind - String that identifies limit, either 'sunset' or 'rises'
  type  - Indicator of type of window
           2 - Object not available when sun is down.
           1 - Object always up.
           0 - Object rises and sets.
          -1 - Object always down.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  1997/9/3, Written by Marc W. Buie, Lowell Observatory

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


OCCPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	occplot
 PURPOSE: (one line)
	Plot small pieces of stellar occultation data.
 DESCRIPTION:
	This procedure is intended to be used in plotting a very large 1-d
	vector as a function of time in which you are only interested in
	plotting a small subset of the data.  The time calibration is specified
	through the tstart and dt input parameters and the time axis is
	assumed to be strictly linear.  All time calculations are done in
	double precision to ensure the full precision of the time axis is
	saved.  Single precision gives out at the few millisecond level.

	The current plotting device is used for output.  Some attempt has
	been made to see that sensible plots come out even when using the
	!p.multi system variable to make multiple plots on a page.
 CATEGORY:
       2-D plotting
 CALLING SEQUENCE:
	occplot,data,tstart,dt,tmid,width[,yspan]
 INPUTS:
	data    - Vector containing the time-series occultation data.
	tstart  - Time, in double precision hours, of the first data point
	           or a three element vector [h,m,s]
	dt      - Time increment between points in milliseconds.
	tmid    - Mid-point of the plot in days or as a three element
	           vector [h,m,s]
	width   - Full width of the plot in seconds.
 OPTIONAL INPUT PARAMETERS:
	yspan   - yrange of the plot (centered on the mean).  If not supplied
	           the plot runs from the max to the min of the portion plotted.
	           If yspan is two-element vector, the two values are used
	           as the actual yrange on the plot.
 KEYWORD PARAMETERS:
	connect - When set, the points are connected by a line.
	over    - When set, the plot is done as an overlay on the current plot.
	psym    - Symbol to use for plot.
	title   - Title for plot
 OUTPUTS:
	Plot goes to the current graphics device.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 MODIFICATION HISTORY:
	12/29/92 - Written by Marc W. Buie, Lowell Observatory.  Patterned
	             after the zodiac function, 'occgraf'

	2/9/93   - Added option for yspan to allow direct specification of
	             y plotting range.  MWB

	2/10/93  - Fixed bug with top axis, axis cannot handle long or double
	             precision numbers.

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


ONCHIP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  onchip
 PURPOSE: (one line)
  Extract and optionally plot differential on-chip photometry.
 DESCRIPTION:
  This program will read an altlog photometry file as generated by
  basphote and extract one object from the file, compute differential
  photometry for the program object (Serial #0000) against the field
  stars.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  onchip,logname,objname,filter,object,primary,others,jd,time,mag,err
 INPUTS:
  logname - Name of the altlog format photometry file to read.
  objname - String with the exact name of the object to extract.
  filter  - String containing the filter code to extract.
  object  - Serial number of the object to extract.
  primary - Serial number of the on-chip reference star to use as
                   the primary reference.
  others  - Serial number(s) of the other on-chip stars to use as a
            check of the primary reference.  Scalar or vector.
            If set to -1, no secondary references are used.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  BARS    - Flag, if true, extend major ticks across plot (default=false)
  MAGPRI  - Magnitude of primary reference star (default=0).
  NOPLOT  - When set will inhibit generating a plot to the current
            plot device. (same as /NOPOS and /NOPHOT together).
  NOPOS   - No plot of the positions.
  NOPHOT  - No plot of the photometry.
  COLORS  - Colors to use for the plot.
                colors(0) = axis, program object, (primary standard)
                              default = !d.n_colors-1
                colors(1) = primary standard, default = 1
                colors(2) = secondary standard 1, default = 2
                colors(3) = secondary standard 2, default = 2
                   and so on.  COLORS should have as many elements as
                   needed for the object, primary standard, and all
                   secondary standards.
  NOERRBAR - Flag, if set suppresses error bars on star check mag plot
  SHOWALL  - Flag, if set, prints out all the relevant mangitudes to
               allow seeing which mags are being used.
  TIMEUNIT - Select time units to plot on x-axis,
              0 - UT hours (default)
              1 - JD (decimal days)
  UPPERCASE - Flag, if true, forces object names and filter names to upper case.
 OUTPUTS:
  jd   - Julian date of observation.
  time - UT of observation, decimal hours. (or JD, depending on TIMEUNIT)
  mag  - reduced magnitude of program object.
  err  - Uncertainty of the magnitude.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  2/4/93, Written by Marc W. Buie, Lowell Observatory.
  6/29/93, MWB, added filter argument.
  96 Mar, MWB, added MAGPRI keyword
  96/06/15, MWB, improved the plotting output for the photometry plot.
  96/08/24, MWB, added TIMEUNIT and BARS keywords
  96/10/31, MWB, added "bad" flag support from rdphalt
  97/09/20, MWB, added UPPERCASE flag.

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


OPLERR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	oplerr
 PURPOSE:
	Overplot data points with accompanying x or y error bars.
 CATEGORY:
  2-D plotting
 CALLING SEQUENCE:
	OPLERR, [ X ,]  Y , ERR [, DIR= ] [, PSYM= ] [, SYMSIZE= ] [, COLOR= ]
 INPUTS:
	Y = array of Y values.
	ERR = array of error bar values.
 OPTIONAL INPUT PARAMETERS:
	X = optional array of X values.  The procedure checks whether or not
	    the third parameter passed is a vector to decide if X was passed.
	    If not passed, then INDGEN(Y) is assumed.
	DIR = direction to put error bar (default = 6)
	PSYM = plotting symbol (default = +7)
	SYMSIZE = symbol size (default = 1.0)
	COLOR = color for the symbols (default = !P.COLOR)
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	Arrays must not be of type string.  There must be enough points to
	plot.
 PROCEDURE:
	A plot of X versus Y with error bars drawn from the point in the
	direction specified by DIR.  Recognized values for DIR are:

	1	X + ERR
	2	Y + ERR
	3	X - ERR
	4	Y - ERR
	5	X - ERR and X + ERR
	6	Y - ERR and Y + ERR     (default)

	Plot is written to the output device over any plot already there.
 MODIFICATION HISTORY:
	William Thompson	Applied Research Corporation
	July, 1986		8201 Corporate Drive
				Landover, MD  20785

	Marc Buie		Lowell Observatory
	1991 October 11
	Modified to allow specifying the direction for the error bars.
	Change PSYM to a keyword parameter
	1992 June 24, Add SYMSIZE as a keyword parameter
  94/09/14, MWB, added NOCLIP keyword parameter

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


OPTSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  optspec
 PURPOSE:
  Optimal extraction of a point source spectrum from OSIRIS XD data.
 DESCRIPTION:
  This program is custom built to extract spectra from OSIRIS XD data.
    The spectral images contain usually 3 or 4 cross-dispersed orders.
    Because of the high and variable sky background signal, all images are
    reduced as image pairs to permit excluding most sky signal at the
    very first step.

  As the program progresses, numerous plot and display windows are opened.
    Window 0: Image window that contain 4 rows of strip images.  The strip
              images come from extracting the relevant portions of the
              original image such that the object spectrum will be
              parallel to a row in the resampled image.  All pixels outside
              the slit are discarded.  The 4 rows contain:
                0 (top)    - Original image, scaled from image min to max.
                1          - Original image, scaled from +/- 3 sigma about the
                                robust mean of the image.
                2          - Image after final sky subtraction scaled on same
                                range and row #1.  This strip should have no
                                remnant sky structure if everything works.
                3 (bottom) - Image from row #2 after subtracting out the
                                postive spectrum.  Ideally, you should not
                                see a remnant of the positive spectral image.

    Window 1: Trivial sum over the positive image aperture.

    Window 2: Average column profile computed by summing all columns.  This
                 summation is robust against bad pixels, no data, etc.
                 Superimposed on the profile are (1) the +/- threshold
                 that is used to locate the positive and negative image.
                 The lines are drawn at +/- 3 sigma from the background (fit
                 by a linear fuction). (2) red diamonds show those pixels
                 identified as pure sky. (3) orange '*' show the positive
                 image pixels. (4) brownish-green '*' show the negative image
                 pixels.

    Window 5,6,7,8: Plot of the residuals of pixel location of spectrum vs.
                 column.  Each order is plotted in a different window.

    Window 10: Plot of the optimally extracted spectrum.  It's most useful
                 to compare this against the plot in window 1.

    Window 11: Ratio of the optimal spectrum to the summation spectrum.

    Window 12: Plot of spectrum location in all orders in the original
                 image coordinates.  White points are those considered good
                 during the process of tracing the centerlines.  Red points
                 are those flagged as bad because the position was outside
                 the positive aperture.  The brownish-green points
                 are those flagged as bad because the FWHM at that column
                 was abberant.
    Window 13: Plot of the true image profiles in each order.  If not FINAL
                 this shows the actual profile with the gaussian approximation
                 overlain.  When FINAL is set, you will also see an overlay
                 of the actual numerical image profile that was generated.

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  optspec,calib,root,i1,i2,spec,all
 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.
  i1   - Frame id (integer) of first image.
  i2   - Frame id (integer) of second image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  FINAL   - Flag, if set, indicates that this is a final pass extraction.
              If it is not "final" then the optimal extractor uses a
              gaussian profile fitted to the data.  This option is most
              often used when the bad pixel mask does not yet exist.
              When FINAL is set, a full numerical profile is generated and
              used for the optimal extraction.  In this case, the gaussian
              profile is used to help with locating the centerline but not
              for the spectral extraction.
  FINDBAD - Flag, if set causes program to look for bad pixels in the sky
              region.  Upon completion, a strip array is written to disk with
              the file name, mask.NNN, where the bad pixels have been set to 1.
  GAUSSCOR- Correction factor from the directly computed image FWHM (per order)
              to the final optimal weighting profile.  (Default = 1.3, this
              number is only approximately correct but seems to be pretty
              close.  A number smaller than this will often lead to spurious
              periodic noise, often quite a lot of noise.  A number that is
              too large will add a small amount of extra noise.  Ideally this
              should be set for each and every spectrum but this has not yet
              proved tractable.)
  NONEG   - Flag, if true will inhibit all treatment of the negative image.
              This should only be used if you know that there is no negative
              spectral image and will preserve the maximum amount of sky in
              the process.
  RAW     - Flag, if true will inhibit the column-wise background subtraction.
              The default is to fit the background in each column (along the
              slit) and subtract the fitted background.  Use a linear function
              for the background.
  MASK    - Strip image mask.  Good pixels are 1, bad pixels are 0.  Bad pixels
              are passed over during the profile weighting summation.
  SAVE    - Flag, if true, final spectrum will be saved to a file.  The output
              file name is root+'s'+suffix.  Thus 950911.003 would be saved to
              the file 950911s.003.  Also, a file with the average spatial
              profile is saved to root+'p'+suffix.
  OUTPATH - The path to the location where data is to be saved, default is
              the current directory.
  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.
  PLOTS   - Which plots to show.
              0 - Show them all (default).
              1 - Don't show any plots or images.
              2 - Just show windows 0, 2, and 13 (strip image, average column
                     profile, actual profile of each order).
  CLEAN   - Flag, if set, calls clnspec to allow removing bad points before
              saving spectrum (this is actually obsolete but left in for now).

 OUTPUTS:
  spec - 1-D spectrum extracted from spectral image.
  all  - i1-i2 after XD spectra extracted to strip image. (see getpair)
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Specifically written for OSIRIS cross-dispersed spectral data.  MASK
  does not work particularly well.
 PROCEDURE:
 MODIFICATION HISTORY:
  97/03, Written by Marc W. Buie, Lowell Observatory, cloned from getspec
  97/08/07, MWB, massive reworking and debugging.
  97/12/10, MWB, finalize new version, added OUTPATH keyword
  98/06/09, MWB, added GAUSSCOR keyword.  Also numerous additions for
                   improved bad pixel flagging.
  98/08/11, MWB, removed obsolete keywords and updated the documentation.
  98/08/25, MWB, added PLOTS=2 option.  Added NONEG flag.

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


OSICLEAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  osiclean
 PURPOSE:
  Automatic cleaning of bad and low signal data from OSIRIS XD spectrum
 DESCRIPTION:

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  osiclean,calib,spec,bad
 INPUTS:
  calib - Calibration structure (see ldcalir for description).
  spec  - Input spectrum to be cleaned up.
  bad   - Array of flags for each point.  0=good, 1=bad.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  DVAL  - Used for cleaning a set of spectra.  This is the threshold relative
           to unity for clipping the ratio of a spectrum against the set
           average.  (default=10)

  SILENT - Flag, if set suppresses the conversational printout.

 OUTPUTS:
  bad   - Array of flags for each point.  0=good, 1=bad.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/07/08, Written by Marc W. Buie, Lowell Observatory
  98/07/22, MWB, added protection against NaN values (automatically bad).
  98/07/24, MWB, added set cleaner (when given more than one spectrum).

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


OSIDVFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  osidvfit
 PURPOSE:
  Find the linear fit coefficients for a spectrum for each order
 DESCRIPTION:
  The spectrum and a reference to be divided by are input.  The spectrum is
  divided by the reference and this divided spectrum is then filtered for noise
  and deviant points.  A linear fit is then applied to each order of the
  filtered divided spectrum.
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  osidvfit,calib,divspec
 INPUTS:
  calib    - The calibration information for the spectrum
  spectrum - The spectrum to be fit
  avgspec  - The spectrum to be used as a divisor
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  BAD - The bad flags associated with the average spectrum
 OUTPUTS:
  fit - The linear fit coefficients for each order; this is in the form of a
        2-d array with the fit[0,i]=yint and fit[1,i]=slope where i is the
        order of the spectrum
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  98/06/24 - Written by Chris Dalla Piazza, Lycoming College

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


OSISLOPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  osislope
 PURPOSE:
  Correct an IR OSIRIS spectrum for the slope problem.
 DESCRIPTION:
  Each order of an IR spectrum from OSIRIS is corrected for the "sloping"
  problem given the linear fit coefficients for each order of the spectrum.
  The origin of this linear fit for each order is column 128 of the CCD
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  osislope,calib,spec,fit,bad
 INPUTS:
  calib - Calibration structure variable
  spec  - Spectrum to be slope corrected
  fit   - Linear fit information to be applied to spectrum
  bad   - Badflags for the spectrum
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  outspec - Slope corrected spectrum
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  98/06/05, Written by Chris Dalla Piazza, Lycoming College
  98/07/17, CDP Added the badflags for the spectrum

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


OSISMEAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  osismean
 PURPOSE:
  Compute mean of a set of OSIRIS XD spectra.
 DESCRIPTION:
  Given a set of spectra, this will perform a straight average of the
    provided spectra.  First, the relative signal level (relsig) is
    computed between all members of the set.  This relative level is
    normalized to 1.0 for the individual spectrum with the highest
    signal level.  Then, only those spectra with relsig >= 0.8 will be
    used for the set mean.  If there aren't 4 spectra in this clase, then
    the brightest 4 spectra will be used, unless there aren't 4 spectra.
    In this latter case, all spectra will be averaged.
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  osismean,spec,bad,specmean
 INPUTS:
  spec  - Input spectrum to be cleaned up.
  bad   - Array of flags for each point.  0=good, 1=bad.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  REF       - If provided, the relative signal levels are measure relative to
                 this spectrum out of the stack.
  ALL       - Flag, if true, forces averaging all spectra regardless of relsig.
  NORMALIZE - Flag, if true, will renormalize all the spectra to REF prior to
                 averaging.

 OUTPUTS:
  relsig   - Relative signal levels among set of input spectra.
  specmean - Average spectrum from the set of spectra.
  badmean  - Bad flag vector for the average spectrum.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

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

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


P6MODEL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    p6model
 PURPOSE: (one line)
    Generate synthetic PSF images for the HST Planetary Camera, Chip 6.
 DESCRIPTION:
    A generated PSF is added to the output array.  If the array is not
 defined, it is created with dimensions 800 by 800.  Successive calls
 will add objects (PSF's) to the array.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
    p6model, x, y, inten, date, filter, bmvnum, back, image
 INPUTS:
    x, y    : Position of the PSF in the output array.
    inten   : Intensity of PSF relative to TinyTim output PSF
    date    : Date of observation (YYMMDD format).
    filter  : Filter name in the form Fxxx(W,LP,M,N).
    bmvnum  : B-V list value:
                1) -0.297 (Type O)
                2) -0.155 (Type B)
                3)  0.126 (Type A)
                4)  0.395 (Type F)
                5)  0.619 (Type G)
                6)  1.110 (Type K)
                7)  1.590 (Type M)
    back    : Background to be added.
 OPTIONAL INPUT PARAMETERS:

    JITTER  : If set contains the gaussian smearing to apply to the image.
                This is in units of 1/e half width.  If not set, no smearing
                is applied.

    OBJRAD  : Radius of object in pixels.  If not set, assumed to be a point
              source.  If set and radius is greater than 0.5, then PSF is
              convolved with a circular function of this radius.  This models
              the object as a Lambert disk, crude but useful for barely
              resolved objects.

 KEYWORD PARAMETERS:
    NEW     : If set, clears the output array to zeros before building the
              PSF image(s).
    HSTPATH : Alternate path for HST PSF's.
    VERBOSE : If set, prints informational message.
 OUTPUTS:
    image  : The image array into which the PSF is placed.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    The Tiny Tim programs are used, via the procedure HSTPSF, to generate
 a 2X (7.5 micron spacing) PSF at the nearest grid location to the requested
 position. (This grid is defined in hstpsf).
    From the interpolated maximum returned by hstpsf, shift amounts for x
 and y are computed.
    The PSF is shifted by these amounts and then compressed to a 1X
 (15 micron spacing) PSF.
    Finally, the resulting PSF is multiplied by the intensity parameter and
 added into the output array.
    Calls external procedures BADPAR, BOXM, HSTPSF, and SSHIFT2D.
 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, December, 1993.
    12/10/1993, DWL, Modified to allow the first three parameters to be
 vectors.
    12/16/1993, DWL, Added VERBOSE keyword.
    1/19/94, DWL, Added HSTPATH keyword.
    1/21/94, DWL, Added x-maximum and y-maximum parameters to hstpsf call.

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


PARSEKEY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  parsekey
 PURPOSE:
  Extract FITS header information by parsing supplied keys
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  parsekey,hdr,keylist,info
 INPUTS:
  hdr     - String array containing the FITS header to "read"
  keylist - 3,n element string array.  For each key, there are three elements:
                0 - "standard" key name
                1 - item descriptor, K - keyword, T - template, V - value
                2 - information (contents match what descriptor indicates)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  info    - Anonymous structure containing information gleaned from header.
             tags:
                 airmass - float value for airmass as read from header
                 jd      - Double, julian date of middle of exposure
                 date    - String containing the UT date.
                 ut      - String containing the UT start time of the image.
                 expdelta - Time, in seconds between successive frames if
                               the image is 3-d, not relevant otherwise
                 exptime  - Exposure time in seconds.
                 imfile   - Original filename of image.
                 filter   - String that identifies the filter used.
                 object   - String that identifies the object imaged.
                 ra       - Right ascension of object (radians) (< 0 if invalid).
                 dec      - Declination of object (radians) ( < -100 if invalid).
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:

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


PDM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pdm
 PURPOSE: (one line)
	Period search by phase dispersion minimization ($\theta$ based).
 DESCRIPTION:
	This routine computes the Theta statistic for period searching
	in time-series data using the technique described by Stellingwerf,
	ApJ, 224, pp. 953-960 (1978).
 CATEGORY:
       Photometry
 CALLING SEQUENCE:
	pdm,t,x,freq1,freq2,dfreq,freq,period,theta
 INPUTS:
	t     - independent variable (usually time)
	x0    - dependent variable (usually magnitude or intensity)
	sigx0 - Uncertainty on x.
	freq1 - Lower limit to frequency to compute statistic  (units=[1/t])
	freq2 - Upper limit to frequency to compute statistic  (units=[1/t])
	dfreq - Frequency interval.  (units=[1/t])
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	freq  - Frequency vector.
	period - inverse frequency.
	theta - PDM statistic (1 ==> insignificant, 0 ==> significant).
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Feb 11, by Marc W. Buie, Lowell Observatory

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


PDM2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  pdm2
 PURPOSE: (one line)
  Period search by phase dispersion minimization ($\chi^2$ based)
 DESCRIPTION:
  This routine computes a Chi^2 statistic for period searching
  in time-series data loosely based on the technique described by
  Stellingwerf, ApJ, 224, pp. 953-960 (1978).
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  pdm2,t,x0,sigx0,freq1,freq2,dfreq,freq,period,chi2
 INPUTS:
  t     - independent variable (usually time)
  x0    - dependent variable (usually magnitude or intensity)
  sigx0 - Uncertainty on x.
  freq1 - Lower limit to frequency to compute statistic  (units=[1/t])
  freq2 - Upper limit to frequency to compute statistic  (units=[1/t])
  dfreq - Frequency interval.  (units=[1/t])
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  NBINS - Number of bins (default = 80)
  SILENT - Flag, if set, inhibits all printed output.
 OUTPUTS:
  freq   - Frequency vector.
  period - inverse frequency.
  chi2   - Chi^2 statistic.
  avgyes  - Average number of points contained within non-empty bins.
  nempty  - Total number of empty bins.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 1992 Feb 11, by Marc W. Buie, Lowell Observatory
  94/08/26 - MWB - added NBINS keyword
  94/10/04 - MWB - moved cr to front of print statement (v3.6 bug workaround)
  96/07/01 - MWB - added SILENT keyword

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


PDM2DIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pdm2dis
 PURPOSE: (one line)
	Phase disconnect shift search by phase dispersion minimization ($\theta$ based).
 DESCRIPTION:
	This routine computes the Theta statistic to look for the optimum
	zero-point shift between two datasets for a given period.
	The theta statistic is the same as used for period searching
	in time-series data using the technique described by Stellingwerf,
	ApJ, 224, pp. 953-960 (1978).  The shift reported is that which
	is added to the phase of x2 to register with respect to x1.
 CATEGORY:
       Photometry
 CALLING SEQUENCE:
	pdm2dis,t1,x1,sig1,t2,x2,sig2,period,shif1,shif2,dshif,shiftv,chi2
 INPUTS:
	t1    - independent variable for first dataset (usually time)
	x1    - dependent variable for first dataset
                   (usually magnitude or intensity)
	sig1  - Uncertainty on x for first dataset.
	t2    - independent variable for first dataset (usually time)
	x2    - dependent variable for first dataset
                   (usually magnitude or intensity)
	sig2  - Uncertainty on x for first dataset.
	period - Lightcurve period. (same units as t1 and t2).
	shif1 - Lower limit to phase shift in fractional rotations
	shif2 - Upper limit to phase shift in fractional rotations
	dshif - phase shift interval.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	shiftv  - Zero-point shift vector.
	chi2    - PDM statistic (1 ==> perfect, >>1 is bad).
	avgyes  - Average number of points contained within non-empty bins.
	nempty  - Total number of empty bins.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Feb 13, by Marc W. Buie, Lowell Observatory
  95/02/23 - MWB - added NBINS keyword
  95/08/03 - MWB, cloned from pdm2shif

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


PDM2SHIF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pdm2shif
 PURPOSE: (one line)
	Zero-point shift search by phase dispersion minimization ($\theta$ based).
 DESCRIPTION:
	This routine computes the Theta statistic to look for the optimum
	zero-point shift between two datasets for a given period.
	The theta statistic is the same as used for period searching
	in time-series data using the technique described by Stellingwerf,
	ApJ, 224, pp. 953-960 (1978).  The shift reported is that which
	is added to x2 to register with respect to x1.
 CATEGORY:
       Photometry
 CALLING SEQUENCE:
	pdm2shif,t1,x1,sig1,t2,x2,sig2,period,shif1,shif2,dshif,shiftv,chi2
 INPUTS:
	t1    - independent variable for first dataset (usually time)
	x1    - dependent variable for first dataset
                   (usually magnitude or intensity)
	sig1  - Uncertainty on x for first dataset.
	t2    - independent variable for first dataset (usually time)
	x2    - dependent variable for first dataset
                   (usually magnitude or intensity)
	sig2  - Uncertainty on x for first dataset.
	period - Lightcurve period. (same units as t1 and t2).
	shif1 - Lower limit to zero-point shift (units=[x1])
	shif2 - Upper limit to zero-point shift (units=[x1])
	dshif - Frequency interval.  (units=[1/t])
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	shiftv  - Zero-point shift vector.
	chi2    - PDM statistic (1 ==> insignificant, 0 ==> significant).
	avgyes  - Average number of points contained within non-empty bins.
	nempty  - Total number of empty bins.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Feb 13, by Marc W. Buie, Lowell Observatory
  95/02/23 - MWB - added NBINS keyword

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


PDMSHIF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pdmshif
 PURPOSE: (one line)
	Zero-point shift search by phase dispersion minimization ($\theta$ based).
 DESCRIPTION:
	This routine computes the Theta statistic to look for the optimum
	zero-point shift between two datasets for a given period.
	The theta statistic is the same as used for period searching
	in time-series data using the technique described by Stellingwerf,
	ApJ, 224, pp. 953-960 (1978).  The shift reported is that which
	is added to x2 to register with respect to x1.
 CATEGORY:
       Photometry
 CALLING SEQUENCE:
	pdmshif,t1,x1,sig1,t2,x2,sig2,period,shif1,shif2,dshif,shiftv,theta
 INPUTS:
	t1    - independent variable for first dataset (usually time)
	x1    - dependent variable for first dataset
                   (usually magnitude or intensity)
	sig1  - Uncertainty on x for first dataset.
	t2    - independent variable for first dataset (usually time)
	x2    - dependent variable for first dataset
                   (usually magnitude or intensity)
	sig2  - Uncertainty on x for first dataset.
	period - Lightcurve period. (same units as t1 and t2).
	shif1 - Lower limit to zero-point shift (units=[x1])
	shif2 - Upper limit to zero-point shift (units=[x1])
	dshif - Frequency interval.  (units=[1/t])
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	shiftv  - Zero-point shift vector.
	theta - PDM statistic (1 ==> insignificant, 0 ==> significant).
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Feb 13, by Marc W. Buie, Lowell Observatory
  95/02/23 - MWB - added NBINS keyword

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


PERSER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  perser
 PURPOSE:
  Automated asteroid period search tool.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  perser
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
   Written by Marc W. Buie, 96/10/18, Lowell Observatory

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


PHASEBIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	phasebin
 PURPOSE: (one line)
	Compute a phase binned average lightcurve
 DESCRIPTION:
	This routine bins lightcurve data as a function of time into a
	binned composite lightcurve.  Bins with no data are not returned.
 CATEGORY:
       Photometry
 CALLING SEQUENCE:
	phasebin,t,x0,sigx0,t0,period,nbins,rotphase,x,sig
 INPUTS:
	t     - independent variable (usually time)
	x0    - dependent variable (usually magnitude or intensity)
	sigx0 - Uncertainty on x.
	t0    - Reference time for 0 phase.
	period- Rotational period to use when binning (same units as t).
	nbins - Number of bins to break rotation into.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	rotphase - Rotational phase for composite lightcurve.
	x        - composite lightcurve.
	sig      - Standard deviation of the mean in each bin.
	chi2     - Goodness of fit to data within bin.
	pop      - Number of points in each bin.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1992 Apr 22, by Marc W. Buie, Lowell Observatory

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


PHOTRED

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  photred
 PURPOSE: 
  Reduction of non-variable point source absolute photometry.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  pro photred,stand,fil,jd,am,serial,mag,err,comp,dofil, $
           object,redmag,rederr, $
           NOPRINT=noprint, PLOT=plotit, BINFAC=binfac, FORCE=force
 INPUTS:
  stand  - String array of standard names.  (See coord.)
  fil    - String array of filter names for observations.
  jd     - Double precision array of Julian dates.
  am     - Floating point array of the airmass of observations.
  serial - Serial number of observation.
  mag    - Raw instrumental magnitudes.
  err    - Uncertainties on the raw magnitudes.
  comp   - Standard name of comparison star.
  dofil  - Name of filter to reduce.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  ALL     - Flag, if true reduces non-stars as well and returns a single
              average value for non-stars.
  BINFAC  - Maximum amount of comparison star point to bin (default=6)
  FORCE   - Two element vector that contains override values for the
              mean extinction and its uncertainty.  This replaces the
              initial fit for mean extinction.
  NOPRINT - Flag, if true, will inhibit the summary printout to the screen.
  PLOT    - Flag, if true will enable the summary plot of the comp star.
  STDMAG  - Standard magnitude of comparison star (default=0).
 OUTPUTS:
  object - Name(s) of program object reduced against comp star.
  redmag - Final reduced magnitude of object compared to comp star.
  rederr - Final uncertainty.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  93/07/28 - Written by Marc W. Buie, Lowell Observatory
  93/12/09 - MWB, added extinction override (FORCE)
  93/12/12 - MWB, added ALL flag

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


PICKER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  picker
 PURPOSE:
  Widget for selecting a text item from a list.
 DESCRIPTION:
  This widget provides a simple mechanism for selecting a single item
  from a list.  The items are all strings and the return from this call
  is the string selected.
 CATEGORY:
  Widgets
 CALLING SEQUENCE:
  result=picker(text_array)
 INPUTS:
  text_array - String array of items to present for selection.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  GROUP:  The widget ID of the widget that calls PICKER.  When this
          ID is specified, a death of the caller results in the death of
          the PICKER widget application.

  SORT:   Flag, if set causes input to be sorted in selection list.  Duplicates
             are NOT weeded out.  This function keeps track of which one you
             select but you might not be able to tell the difference.
  TITLE:  A scalar string to be used for the window title.  If it is
          not specified, the default title is "Select from list"

  YSIZE:  Number of lines of list to show before scrolling the list.
          The default is 10.

 OUTPUTS:
  Return value is the selected string.  If the operation was canceled,
    then the return value is "[[[CANCEL]]]"
 KEYWORD OUTPUT PARAMETERS:
  INDEX:  index of the item chosen
 COMMON BLOCKS:
  MWB_PICKER: COMMON block that maintains state for the widget.
 SIDE EFFECTS:
  This function initiates the XMANAGER if it is not already running.
 RESTRICTIONS:
  Only one instance of the PICKER widget can be running at one time.
 PROCEDURE:
  Create and register the widget and then exit, returning the filename
  that was picked.
 MODIFICATION HISTORY:
  96/06/09 - Written by Marc W. Buie
  96/11/11 - MWB, added SORT keyword

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


PICKIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  pickim
 PURPOSE: 
  Interactive program to select best image from cube for SL9 data.
 DESCRIPTION:
  This is a special purpose routine built for selecting one image from a
    set of nearly identical images.  The SL9 data was taken as image cubes
    ~5 images in rapid succesion in the same filter.  This program will
    display all images raw and after unsharp masking.  Click on the best
    (either version) to save it (after processing) to disk.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  pickim,root,imnum,
     PATH=path, OUTPATH=outpath, BIAS=bias, DARK=dark, FLAT=flat, FORCE=force
 INPUTS:
  root  - string containing the root of the data file names (no period)
  imnum - vector contining a list of image numbers to process.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  PATH    - Directory where data files reside (default = ./)
  OUTPATH - Directory where output files will be written (default = ./)
  BIAS    - Bias frame to subtract (default=none)
  DARK    - Dark frame to subtract (default=none)
  FLAT    - Flat field to divide into data (default=1)
  FORCE   - set to sub-frame that should be selected (default=interactive)
  DELTAT  - Readout time of each frame used to correct time for chosen image
              from the time of the first frame.  (in seconds), the default
              (for no good reason) is 1 second.
 OUTPUTS:
  Output is a FITS file with the chosen image (after processing)
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/06 - Marc W. Buie, Lowell Observatory
  96/06/22, MWB, added OUTPATH and FLAT keywords
  96/06/27, MWB, added DELTAT
  96/07/03, MWB, added calib mis-match support

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


PIXWT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    pixwt
 PURPOSE: (one line)
    Circle-rectangle overlap area computation.
 DESCRIPTION:
    Compute the fraction of a unit pixel that is interior to a circle.
    The circle has a radius r and is centered at (xc, yc).  The center of
    the unit pixel (length of sides = 1) is at (x, y).
 CATEGORY:
    CCD data processing
 CALLING SEQUENCE:
    Pixwt( xc, yc, r, x, y )
 INPUTS:
    xc, yc : Center of the circle.
    r      : Radius of the circle.
    x, y   : Center of the unit pixel.
 OPTIONAL INPUT PARAMETERS:
    None.
 KEYWORD PARAMETERS:
    None.
 OUTPUTS:
    Function value: Computed overlap area.
 COMMON BLOCKS:
    None.
 SIDE EFFECTS:
 RESTRICTIONS:
    None.
 PROCEDURE:
    Divides the circle and rectangle into a series of sectors and
    triangles.  Determines which of nine possible cases for the
    overlap applies and sums the areas of the corresponding sectors
    and triangles.
 MODIFICATION HISTORY:
    Ported by Doug Loucks, Lowell Observatory, 1992 Sep, from the
    routine pixwt.c, by Marc Buie.

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


PLAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  plast
 PURPOSE:
  Support routine for calling ``PLAST'' to get asteroids on an image.
 DESCRIPTION:

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  plast,jd,ra,dec,width,height,bmaglim,rmaglim,outfile

 INPUTS:
  jd      - Julian date of field.
  ra      - Right ascension of center of field (J2000)
              input can be in radians (double,float) or
              a string HH:MM:SS.S  (see RAPARSE for valid syntax).
  dec     - Declination of center of field for (J2000).
              input can be in radians (double,float) or
              a string +DD:MM:SS.S  (see DECPARSE for valid syntax).
  width   - Width of field to extract (arcsec).
  height  - Height of field to extract (arcsec).
  outfile - File name for the results of the extraction.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  maglim  - Limiting V magnitude of asteroids to extract (default=30).
  title   - Internal title for plast extraction (default='auto plast').
  obscode - Observatory code (default = 688, Lowell Observatory).

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/11/24, Written by Marc W. Buie, Lowell Observatory

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


PLASTEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  plastext
 PURPOSE:
  Batch mode extraction of PLAST asteroid lists.
 DESCRIPTION:
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  plastext,root,startnum,finnum
 INPUTS:
  startnum - First frame number to process
  finnum   - Last frame number to process
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

  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.

  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
                *  EPOCH     K  EPOCH
                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.  Only those fields marked with '*'
                are actually used by this program.

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

  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.

  PSCALE   - Scalar number, this is the scale of the image in arcsec/pixel.
                If not specified, then this program will look for the
                ASTROM information file, astrom.inf, in the current directory
                for the plate scale.  If the file does not exist, then you
                will be prompted to provide the plate scale directly.

  SCRIPT   - String, if provided is the file name to save a script to.
                If set will suppress the actual call to plast to
                generate the asteroid lists.  Instead, all the calls
                to plast will be saved to this file.

 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  97/11/24, MWB, cloned from REFEXT.PRO
  98/03/25, MWB, add EXTLIST keyword and group extension support

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


PLCHFIT

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

 PURPOSE:
	Two gaussian fit to an image of the Pluto-Charon system.

 DESCRIPTION:
 	Fit the equation y=f(i) where:

		X  = I MOD NX
		Y  = I / NX

		R1 = SQRT( (X-A0)^2 + (Y-A1)^2 )
		R2 = SQRT( (X-A9)^2 + (Y-A10)^2 )

		Z1 = R1/A3
		Z2 = R2/A3

 		F(I) = A2*EXP(-Z1^2/2) + A5*EXP(-Z2^2/2) +A4

	Function parameters				Initial guess
       --------------------------------------------    --------------------
	A0  = X location of center of Pluto,		Maximum in image
	A1  = Y location of center of Pluto,		Maximum in image
	A2  = height of gaussian for Pluto,		Max - Min from image
	A3  = the 1/e width of the guassian,		GUESS(0)
	A4  = Constant term for the background,		0
	A5  = height of gaussian for Charon,		A2/7
	A6  = X location of center of Charon,		A0 + GUESS(1)
	A7  = Y location of center of Charon,		A1 + GUESS(2)

 CATEGORY:
	Function fitting

 CALLING SEQUENCE:
	plchfit,i,y,numx,guess,model,a,sigmaa

 INPUTS:
	image  - Input image to be fitted, must be 2-d.
	guess  - Input information for starting guess.
		  guess(0) = estimate of the 1/e full width of the seeing.
		  guess(1) = X offset of Charon relative to Pluto.
		  guess(2) = Y offset of Charon relative to Pluto.

 OUTPUTS:
	model  - The fitted model image is returned.
	a      - The final coefficient array.
	sigmaa - The uncertainties on the coefficients.

 OPTIONAL OUTPUT PARAMETERS:

 COMMON BLOCKS:
	plchfit_com - contains the xwidth of the image.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Obs., 1993 January 13.
	93/07/01, MWB, Converted to new fitting function protocol.

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


PLCH_FUN

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

 PURPOSE:
	Two 2-d gaussian images, support routine for PLCHFIT.

 DESCRIPTION:
	Evaluate the sum of two 2-d guassian and a 2-d 2nd order polynomial
	and optionally return the value of it's partial derivatives.

 	Evaluate the equation y=f(i) where:

		X  = I MOD NX
		Y  = I / NX

		R1 = SQRT( (X-A0)^2 + (Y-A1)^2 )
		R2 = SQRT( (X-A0-A6)^2 + (Y-A1-A7)^2 )

		Z1 = R1/A3
		Z2 = R2/A3

 		F(I) = A2*EXP(-Z1^2/2) + A5*EXP(-Z2^2/2) + A4

	Function parameters
       --------------------------------------------
	A0  = X location of center of Pluto
	A1  = Y location of center of Pluto
	A2  = height of gaussian for Pluto
	A3  = the 1/e width of the guassian
	A4  = Constant term for the background
	A5  = height of gaussian for Charon
	A6  = X location of center of Charon relative to Pluto
	A7  = Y location of center of Charon relative to Pluto

 CATEGORY
       Function fitting
 CALLING SEQUENCE:
	FUNCT,I,A,F[,PDER]
 INPUTS:
	I = Independent variable, actually, just an index into 2-d array.
	A = PARAMETERS OF EQUATION DESCRIBED BELOW.

 OPTIONAL KEYWORD PARAMETERS:
	XSIZE = width of image

 OUTPUTS:
	F = value of function at each F(I).

 OPTIONAL OUTPUT PARAMETERS:
	PDER = (N_ELEMENTS(I),8 or 6) array containing the
		partial derivatives.  P(I,J) = Derivative
		at Ith point w/respect to Jth parameter.
 COMMON BLOCKS:
	r2gauss_com - contains the x-width of the array stored in A
 SIDE EFFECTS:
	NONE.
 RESTRICTIONS:
	NONE.
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1993 January 13
	93/07/01, MWB, changed to remove linear and quadratic background
	   terms, added facility for forcing position of Charon.

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


PLOTPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	plotphot
 PURPOSE: (one line)
	Plot extinction fits from Tholen's ltcrv program.
 DESCRIPTION:
	This program will automatically generate a summary plot from an
	extinction fit produced by David Tholen's ltcrv program.  If the
	file does not exist or if there aren't enough points to generate
	a meaningful plot, then no plot is generated and the top summary
	portion of the output file is printed (if found).
 CATEGORY:
	Photometry
 CALLING SEQUENCE:
	plotphot,filename
 INPUTS:
	filename - string containing filename to read and plot.
 OPTIONAL INPUT PARAMETERS:
	None.
 KEYWORD PARAMETERS:
	None.
 OUTPUTS:
	Plots to the current graphics device.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	Generates a plot in the current active graphics window.
 RESTRICTIONS:
	None.
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1992 June 18

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


PLOTSN

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	plotsn
PURPOSE:
	Analyze a vector and retrieve the signal-to-noise ratio.
DESCRIPTION:
	First, fit a polynomial to the data, subtract the polynomial and
	add the mean of the polynomial to flatten the data.
	Compute the mean and standard deviation in the flattened data.
CATEGORY
       Spectroscopy
CALLING SEQUENCE:
	plotsn,point1,point2,x,y,label
INPUTS:
	point1   = First data point to use from x and y.
	point2   = Last data point to use from x and y.
	x        = 1-d vector containing independent variable.
	y        = 1-d vector containing dependent variable.
	label    = String title for plot.
OUTPUTS:
	None
REVISION HISTORY:
	Written by Marc Buie on 2/27/91
COMMENTS:
	A single number for the SNR is somewhat dubious if the data spans
	a wide numeric value.

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


PLOTSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  plotspec
 PURPOSE: 
  Plot OSIRIS XD spectral data with wavelength scale.
 DESCRIPTION:
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  plotspec,calib,spec,YRANGE=yrange,TITLE=title,SMOOTH=smo_fac
 INPUTS:
  calib- Anonymous structure containing all pertinent calibration
           information.  This structure is usually loaded beforehand using
           the routine, "ldcalir"
  spec - 1-D spectrum vector.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  BADFLAGS = Flag array, same length as spec.  If set, the data point is bad
                and should not be plotted.  Default is to plot all.
  COLOR  = color index for data plot, does not affect the axes and labels.
             If a scalar is provided, the same color is applied to all orders.
             A vector implies that the colors in the vector should be applied
             to each order.  If the color "array" has fewer elements than
             there are orders, then the last color is replicated to all the
             remaining orders.
  OPLOT  = flag, if set, plot is overplotted, axes are not redrawn.
  XRANGE = (same as PLOT control, default is min to max), ignored if OPLOT set
  YRANGE = (same as PLOT control, default is min to max), ignored if OPLOT set
  TITLE  = (same as PLOT control, default is blank)
  SMOOTH = smoothing factor for data, default is no smoothing.  Uses
           the smooth() function on each order individually.
  LOWESS = order of polynomial for lowess smoothing.  If lowess=0 (default)
              then the smoothing is done using the IDL built-in smooth function.
              for values of lowess > 0, lowess smoothing is done with this order
              smoothing polynomial function.
  NORDER = Order of spectrum to plot (default=plot all orders).  This can be
             a vector that lists more than one order to plot.
  NOWAVENUM = Flag, if set suppresses the wavenumber axis labeling on the
             top of the plot.
  Accepts all other PLOT and OPLOT keywords.
 OUTPUTS:
  plot to current output device with wavelength scale.  Each order is
    plotted a disconnected line from the other orders.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/24, Written by Marc W. Buie, Lowell Observatory
  95/09/15, MWB, added calib structure usage.
  96/05/28, MWB, mods for new calib structure.
  98/06/12, MWB, added BADFLAGS keyword and wavenumber scale on top.
  98/08/28, MWB, added LOWESS keyword smoothing option.

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


PORTRAIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	portrait
 PURPOSE: (one line)
	IDL procedure for initializing the PS device for portrait mode plotting.
 DESCRIPTION:
	Output plotting device is changed to PS in portrait mode with a
	Helvetica font.
 CATEGORY:
	Utility
 CALLING SEQUENCE:
	portrait
 INPUTS:
	None.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	None.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory

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


PRIVAL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    prival
 PURPOSE: (one line)
    Reduce an angle to its principal value (0 $\leq \Theta < 2\pi$).
 DESCRIPTION:
    This routine uses [0 to 2*PI) as the principal value of an angle.  If
 the angle is negative, 2*PI is added to the remainder of division by 2*PI.
    If positive, then the value is the remainder of division by 2*PI.  Nothing
 is done to the input value if it is already in range.

 CATEGORY:
    Mathematical
 CALLING SEQUENCE:
    result = prival( angle )
 INPUTS:
    angle : Angle to reduce to principal value (double).
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    result = Principal value of angle (double).
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Copyright (C) 1987, by Marc W. Buie
    Version dated 86/2/1
    Ported by Doug Loucks, Lowell Observatory, July 28, 1993, from the
 C-language version written by Marc Buie.

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


PSFSTACK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  psfstack
 PURPOSE:
  Generate an average numerical psf by stacking observed images.
 DESCRIPTION:

 CATEGORY:
  CCD data processing

 CALLING SEQUENCE:
  psfstack,image,x,y,psf

 INPUTS:
  image - Input image from which psf is collected.
  x     - Scalar or vector list of positions of stars (x coordinate).
  y     - Scalar or vector list of positions of stars (y coordinate).

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  DW    - half-width of box centered around PSF, final size is 2*DW+1,
             default size is DW=9 pixels.

 OUTPUTS:
  psf   - Final average psf, normalized to unit _volume_

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

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

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


QANNOUNC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    qannounc
 PURPOSE: (one line)
    Scrollable text display widget with true and false response buttons.
 DESCRIPTION:

 CATEGORY:
    Widget
 CALLING SEQUENCE:
    result = qannounc( text [,keywords] )
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    FALSELABEL=false : Label for false button.  Default='No'
    GROUP=group      : Group leader.
    TRUELABEL=true   : Label for true button.  Default='Yes'
    TITLE=title      : Title of widget.  Default='qannounc'.
    XSIZE=ysize      : Width, in characters, of the text display.
    YSIZE=ysize      : Max size, in rows, of text display.
 OUTPUTS:
    result=0 if false button pressed, otherwise result=1.
 COMMON BLOCKS:

 SIDE EFFECTS:
    Suspends all event generation.  A user response is required.
 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, January, 1993.  Similar
    to IDL User Library procedure XANNOUNCE.
    3/93, DWL:
      Moved False button to the upper left, making it the first button.  This
    was done to prevent the true button from being 'pressed' as a result of
    the space bar event generation problem.
      Set the false button to have input focus.
    7/22/94, DWL, Added code similar to that for compound widget event
 processing, thus eliminating the need for a common block.

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


QINPUT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    qinput
 PURPOSE: (one line)
    Prompt user for input from a widget.
 DESCRIPTION:

 CATEGORY:
    Widgets
 CALLING SEQUENCE:
    result = qinput( [keywords] )
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    PROMPT   = Character string to be displayed as a prompt.
    FLOATING = Set this keyword to accept a floating-point value.
    INTEGER  = Set this keyword to accept an integer value.
    LONG     = Set this keyword to accept a longword integer value.
    STRING   = Set this keyword to accept a string value.
    TITLE    = Title for the widget.
 OUTPUTS:
    result = the returned value.
 COMMON BLOCKS:

 SIDE EFFECTS:
    Suspends other widget event generation.  A user response is required.
 RESTRICTIONS:

 PROCEDURE:

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

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


RADP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	radp
 PURPOSE: (one line)
	Extract point-wise radial ``profile'' from image data.
 DESCRIPTION:

	This routine will reorder the image into two 1-d vectors.  One vector
	is the radial distance from a point and the other vector is the
	intensity for that distance.  The image data is not modified, every
	input pixel is returned, just in a different form.

	Optionally, this program will attempt to fit a gaussian to the profile
	and will return the FWHM of the image.  You can also get the actual
	fitted coefficients and the computed functional value.  The fitting
	is done with the procedure rgfit and its associated routine
	rgauss_funct for computing the function.

 CATEGORY:
	CCD data processing
 CALLING SEQUENCE:
	radp,image,xcen,ycen,r,i,[fwhm,[coefs,[yfit]]]
 INPUTS:
	image - Input image to create profile from.
	xcen  - X-coordinate for r=0
	ycen  - Y-coordinate for r=0
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
	QONLY - No linear term in fit, just constant and quadratic.
	CONLY - Guassian and constant only.
	FZWID - Freeze the full-width half max to this value.
 OUTPUTS:
	r     - the r coordinates for all input pixels.
	i     - the input image after reordering to match r vector.
 OPTIONAL OUTPUT PARAMETERS:
	fwhm  - Return value of the gaussian fit to the profile, in pixels.
	coefs - Fitted function coefficients. (See rgfit.pro)
	yfit  - Fitted values.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	92/11/04, Written by Marc W. Buie, Lowell Observatory

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


RADTODMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    radtodms
 PURPOSE: (one line)
    Convert an angle from radians to degrees, minutes, and seconds.
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    radtodms, radians, sign, deg, min, sec
 INPUTS:
    radians = Angle expressed in radians.  May be a vector, in which case
              the outputs will be vectors.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    sign :  Sign associated with the outputs (-1 or +1).
    deg  :  Degrees.
    min  :  Minutes.
    sec  :  Seconds.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    The input declination is broken into four parts.  The sign is carried
 as a separate value, to make angles near zero behave correctly.  There
 are no invalid angles.
 MODIFICATION HISTORY:
  Copyright (C) 1987, by Marc W. Buie
  Version dated 87/2/1
  Ported by Doug Loucks, Lowell Observatory, August 11, 1993, from the
  C-Language version written by Marc Buie.

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


RADTOHMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    radtohms
 PURPOSE: (one line)
    Convert from radians to hours, minutes, and seconds of right ascension.
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    radtohms, radians, hh, mm, ss
 INPUTS:
    radians : Angle expressed in radians.  May be a vector, in which case
              the outputs will be vectors.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    hh : Hours
    mm : Minutes
    ss : Seconds
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    The angle is reduced to its principal value then converted to hours.
    The decimal number of hours is broken up into the three pieces.  There are
  no invalid input quantities.
    Calls external function prival.pro.
 MODIFICATION HISTORY:
    Copyright (C) 1987, by Marc W. Buie
    Version dated 87/2/1
    Ported by Doug Loucks, Lowell Observatory, July 28, 1993, from the
    C-Language version written by Marc Buie.

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


RAPARSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  raparse
 PURPOSE:
  Convert Right Ascension (RA) string to radians.
 DESCRIPTION:

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  ra=raparse(str)
 INPUTS:
  str - String (or array) to parse as a right ascension
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return value is scalar or vector value of RA in radians
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  1997/06/04, Written by Marc W. Buie, Lowell Observatory

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


RASTR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    rastr
 PURPOSE: (one line)
    Convert RA in radians to hours, minutes, and seconds (ASCII string).
 DESCRIPTION:

 CATEGORY:
    Astronomy
 CALLING SEQUENCE:
    rastr, radians, places, str, carry
 INPUTS:
    ra     : Right Ascension, in radians, to be converted to a string.
             May a vector, in which case the outputs will be vectors.
    places : Resolution of output string (integer).
             = -7     nearest hour.                    +HH
             = -6     nearest 30 minutes.              +HH:(00,30)
             = -5     nearest 15 minutes.              +HH:(00,15,30,45)
             = -4     nearest 10 minutes.              +HH:M0
             = -3     nearest 5 minutes.               +HH:M(0,5)
             = -2     nearest minute.                  +HH:MM
             = -1     nearest ten seconds.             +HH:MM:S0
             =  0     nearest second.                  +HH:MM:SS
             =  1     nearest tenth of a second.       +HH:MM:SS.s
             =  2     nearest hundredth of a second.   +HH:MM:SS.ss
             =  3     nearest thousandth of a second.  +HH:MM:SS.sss
             =  4     nearest thousandth of a second.  +HH:MM:SS.ssss
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    str   - Output string for the converted right ascension.
    carry - Flag that indicates ra rolled over after rounding.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    Right ascension is reduced to the range [0,24) then converted to a string.
    There are no imbedded blanks.
    Calls external routine radtohms.
 MODIFICATION HISTORY:
  Copyright (C) 1987, by Marc W. Buie
  Version dated 87/4/21
    Ported by Doug loucks, Lowell Observatory, July, 1993, from the
 C-Language version written by Marc Buie.
 97/07/14, MWB, added places=4

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


RCGFIT

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

 PURPOSE:
	Fit a radial gaussian function to the input data (no linear term).

 DESCRIPTION:
 	Fit the equation y=f(r) where:

 		F(r) = A0*EXP(-z^2/2) + A2 + A3*r^2
 			and
		z=r/A2

	A0 = height of exp, A1 = sigma (the width).
	A2 = constant term, A3 = quadratic term.
 	The parameters A0, A1, A2 are estimated and then CURVEFIT is 
	called.  The gaussian is assumed to be centered at r=0.

 CATEGORY:
	Function fitting

 CALLING SEQUENCE:
	Result = RCGAUSSFIT(R, Y [, A])

 INPUTS:
	R:	The independent variable.  R must be a vector.
	Y:	The dependent variable.  Y must have the same number of points
		as R.

 OUTPUTS:
	The fitted function is returned.

 OPTIONAL OUTPUT PARAMETERS:
	A:	The coefficients of the fit.  A is a three-element vector as 
		described under PURPOSE.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:

 PROCEDURE:
	The initial guess of the intensity is the value of the point 
	with the smallest r value.  The first point that drops below
	half of the first is the guess at the width.

 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.
	Rewritten to change initial guess, MWB, Lowell Obs., Dec. 1992.
	Rewritten to remove background function, MWB, Lowell Obs., Jan. 1993.

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


RDAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdast
 PURPOSE:
  Read final astrometry data file.
 DESCRIPTION:

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdast,file,fn,jd,ra,dec,mag,obs,id
 INPUTS:
  file - Astrometry data file to be read.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  fn  - Original filename for measurement
  jd  - Julian date of measurement
  ra  - Right Ascension (radians)
  dec - Declination (radians)
  mag - measured magnitude
  obs - Observatory code
  id  - Name of object
  nobs- Total number of observations (0 if file is empty or missing).

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/03/26, Written by Marc W. Buie, Lowell Observatory

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


RDAT1I

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdat1i
PURPOSE:
      Read and return a one dimensional 2-byte integer vector.
DESCRIPTION:
      The file should contain at least num points.
CATEGORY:
	File I/O
CALLING SEQUENCE:
	vec=rdat1i(100,'myfile.dat')
INPUTS:
	num      = number of values to read from the file.
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the vector
REVISION HISTORY:
	Written by Marc Buie on 12/28/92
COMMENTS:
	A bit of a kludge.

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


RDAT1R

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdat1r
PURPOSE:
      Read and return a one dimensional single precision floating point vector.
DESCRIPTION:
      The file should contain at least num points.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdat1r(100,'myfile.dat')
INPUTS:
	num      = number of values to read from the file.
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the vector
REVISION HISTORY:
	Written by Marc Buie on 2/19/91
COMMENTS:
	A bit of a kludge.

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


RDAT2I

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdat2i
PURPOSE:
	Read and return a two dimensional two byte integer vector.
DESCRIPTION:
	The file should contain at least nrows x ncols points.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdat2i(300,100,'myfile.dat')
INPUTS:
	nrows    = number of values to read from the file.
       ncols    = number of columns to read from the file.
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the array
REVISION HISTORY:
	Written by Marc Buie on 5/2/91
COMMENTS:
	A bit of a kludge.

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


RDAT2R

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdat2r
PURPOSE:
      Read and return a two dimensional single precision floating point vector.
DESCRIPTION:
	The file should contain at least nrows x ncols points.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdat2r(300,100,'myfile.dat')
INPUTS:
	nrows    = number of values to read from the file.
       ncols    = number of columns to read from the file.
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the array
REVISION HISTORY:
	Written by Marc Buie on 5/2/91
COMMENTS:
	A bit of a kludge.

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


RDAT2U

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdat2u
PURPOSE:
	Read and return a two dimensional two byte unsigned integer vector.
DESCRIPTION:
	The file should contain at least nrows x ncols points.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdat2u(300,100,'myfile.dat')
INPUTS:
	nrows    = number of values to read from the file.
       ncols    = number of columns to read from the file.
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the array
REVISION HISTORY:
	Written by Marc Buie on 6/3/91
COMMENTS:
	A bit of a kludge.

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


RDBYT

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdbyt
PURPOSE:
	Read and return a two dimensional byte array from an animation file.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdbyt('myfile.dat')
INPUTS:
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the vector
REVISION HISTORY:
	Written by Marc Buie on 12/17/91
COMMENTS:

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


RDCTIOPH

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  rdctioph
 PURPOSE: 
  Reads raw card image CTIO photometry data files.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  This assumes that the data is single channel.
 PROCEDURE:
 MODIFICATION HISTORY:
  94/04/14 - Written by Marc W. Buie, Lowell Observatory.

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


RDDAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rddat
 PURPOSE:
  Display the X and Y value of the cursor in a plot
 CATEGORY:
  2-D plotting
 CALLING SEQUENCE:
  rddat
 INPUTS:
  None.
 OUTPUTS:
  None.
 COMMON BLOCKS:
  None.
 SIDE EFFECTS:
  The X, Y and data values of plot under the cursor are constantly 
  displayed.

  Pressing left or center mouse button, makes a new line of output,
     saving the old.
  Pressing right mouse button, exits the procedure.

 RESTRICTIONS:
  None.
 PROCEDURE:
  Straightforward.
 MODIFICATION HISTORY:
  DMS, Dec, 1987.
  cloned from RDPIX by Marc W. Buie, March 1991.
  98/06/27, MWB, converted from !err to !mouse

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


RDFLT

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdflt
PURPOSE:
	Read and return a two dimensional byte array from an animation file.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdraw('myfile.dat')
INPUTS:
	filename = string containing the name of the file to read.
OUTPUTS:
	returns the vector
REVISION HISTORY:
	Written by Marc Buie on 12/17/91
COMMENTS:

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


RDGRAB

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	rdgrab
 PURPOSE: (one line)
	Read raw binary IRTF-grabber1 format data files.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
	vec=rdgrab(file)
 INPUTS:
	file - string containing the name of a file to read from
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Returned is a 1-d array of values from the file.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, Oct 1992

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


RDIMG

[Previous Routine] [Next Routine] [List of Routines]
NAME:
       rdimg
PURPOSE:
       Read and return the two images in an old style MaxEnt map.
CATEGORY:
  File I/O
CALLING SEQUENCE:
       rdimg('myfile.dat',pluto,charon)
INPUTS:
       filename = string containing the name of the file to read.
OUTPUTS:
       pluto    = First image in file, usually Pluto.
       charon   = Second image in file, usually Charon.
REVISION HISTORY:
       Written by Marc Buie on 10/21/91
COMMENTS:

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


RDKEYLIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    rdkeylis
 PURPOSE: (one line)
    Read a correspondence list file into arrays.
 DESCRIPTION:

 CATEGORY:
    File I/O
 CALLING SEQUENCE:
    rdkeylis, filnam, stdkeywords, flags, hdrkeywords
 INPUTS:
    filnam      : The correspondence file to be read.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    stdkeywords : List of standard kewwords.
    flags       : List of flags.
    hdrkeywords : List of header keywords (and values).
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, November 18, 1993.

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


RDLAND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdland
 PURPOSE: (one line)
  Read the Landolt Standards data file.
 DESCRIPTION:
  This program automates the process of reading the Landolt 1983 Standard
       file as provided on the CD-ROM from NSSDC.  Selected Astronomical
       Catalogs, Volume 1.  Also supported is the table for the 1992 catalog
       as supplied by Arlo Landolt at Louisiana State University.
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdland,catalog,id,ra,dec,mags,colors,errs,cerrs
 INPUTS:
     catalog - Integer key for the catalog to read in.  The only valid
                 inputs are:
                    83 - for the 1983 catalog.
                    92 - for the 1992 catalog.

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     EPOCH   - JD of epoch for of-date precession.
                 Default = catalog epoch (1985.0 for 83 catalog or
                 2000.0 for 92 catalog).
     FILE    - Name of star catalog file to read.  Defaults are:
                 For 83 = '/gryll/data1/buie/photometry/landolt/landolt.dat'
                 For 92 = '/gryll/data1/buie/photometry/landolt/landolt92.dat'

     Only one of the following is allowed to be set.  If none are set,
        the coordinates will be returned in the equinox of the catalog.
     B1950   - Coordinates should be referred to equinox of B1950.
     J2000   - Coordinates should be referred to equinox of J2000.
     OFDATE  - Coordinates should be referred to equinox of date.
                 If selected, EPOCH must be provided.

 OUTPUTS:
     id     - Name of the stars.
     ra     - Right Ascension in radians. Catalog epoch, unless one of the
                other choices, via keyword, is specified.
     dec    - Declination in radians. Catalog epoch, unless one of the
                other choices, via keyword, is specified.
     mags   - Stellar magnitudes, UBVRI
     colors - Stellar colors, U-B, B-V, V-R, R-I, V-I
     merrs  - Uncertainties on the magnitudes.
     cerrs  - Uncertainties on the colors.
     nobs   - Number of observations
     nnig   - Number of nights of observations
 COMMON BLOCKS:
     None.
 SIDE EFFECTS:
 RESTRICTIONS:
     This procedure is hard-coded for these particular files.  It is not
       intended to be a general file reading program.

     If file is not specified, the filename defaults are:
          /gryll/data1/buie/photometry/landolt/landolt.dat   (for 83 catalog)
          /gryll/data1/buie/photometry/landolt/landolt92.dat (for 92 catalog)
 PROCEDURE:
 MODIFICATION HISTORY:
  93/01/19, Written by Marc W. Buie, Lowell Observatory
  93/10/01, Modifications by Doug Loucks, Lowell Observatory.  The
            1992 Landolt Catalog (Epoch 2000) is now supported.  A new
            parameter allows selection of the the 1983 or the 1992 catalog.
  96/11/20, MWB, now returns number of nights and number of observations.

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


RDLAND2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdland2
 PURPOSE: (one line)
  Read the Combined Landolt Standard system photometry file.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdland2,name,mags,codes
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     FILE    - Name of star catalog file to read.  Default is:
                 '/gryll/data1/buie/photometry/landolt/landphot.dat'

 OUTPUTS:
     name   - Name of the star.
     mags   - Stellar magnitudes, UBVRI
     codes  - Quality codes:
               0 - not enough measurements for use as a quality standard.
               1 - good to use as standard
               2 - Known or suspected variable, don't ever use.
 COMMON BLOCKS:
     None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/22, Written by Marc W. Buie, Lowell Observatory

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


RDMATCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     rdmatch
 PURPOSE: (one line)
     Read a standard name --- non-standard name correspondence file.
 DESCRIPTION:

     This program reads a file which contains a list of matches between
     informal and imprecise object names (typically from FITS headers)
     and formal, well-defined object names to be used by EPHEM.

     The file format has one pair of strings per line.
     The first string starts at the start of the line.  The second string
     starts at just after the ' character.  Each string is stripped of
     leading and trailing blanks (and tabs).

     These string pairs are collected into a pair of string arrays and
     then returned.

 CATEGORY:
     File I/O
 CALLING SEQUENCE:
     rdmatch,file,proper,informal
 INPUTS:
     file - String containing file name to be read.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
     ERROR - error flag, if true, some error occured during file I/O.
 OUTPUTS:
     proper   - String array of proper ephemeris names.
     informal - String array of informal object names.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/25/93 - Written by Marc W. Buie, Lowell Observatory.
    11/22/96 - MWB, changed to permit spaces in the proper names.
    98/01/28 - MWB, changed to quietly ignore blank lines in file.

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


RDOBLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdoblist
 PURPOSE:
  Read a triplet object list from a file.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  rdobjlist,file,nobj,filelist,offset,pos,flags,nfiles
 INPUTS:
  file - String of file name to be read.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  nobj     - number of objects in list.
  filelist - string array of file names for this object list.
  offset   - 2*(nfiles-1) element vector [x,y offset (B-A), x,y offset (C-A), ...]
  pos      - [2*nfiles,nobj] element vector, each row is set of positions [x1,y1,x2,y2,x3,y3]
  flags    - nobj element vector of flags either ?, y, or n.
  nfiles   - Number of files in linked set of images for this field.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  1998/10/6, Written by Marc W. Buie, Lowell Observatory
  1998/11/2, MWB, generalized to handle other than frame triplets

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


RDOBSCOD

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  rdobscod
 PURPOSE:
  Read standard observatory code data file.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdobscod,code,lon,rhosinp,rhocosp,obsname
 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/rdobscod.pro)


RDOCCPHT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  rdoccpht
 PURPOSE: 
  Read a Occultation Photometer data file.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdoccpht,file,time,counts,dt,comment
 INPUTS:
  file - String containing filename to read.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  time    - vector of UT time (decimal hours)
  counts  - vector of counts for each time
  dt      - Time spacing between points (seconds)
  comment - string that identifies data (read from header)
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  Data is stored in 512 byte block "records".  The first record is a header
  and contains the following:
      0 -  79  Comment                 (ASCII string)
     80 -  81  clock ticks/second      (integer)
     82 -  83  clock ticks/integration (integer)
     84 -  87  tick # of first point   (long)
     88 -  91  tick # of last point    (long)
     92 -  95  total # of clock ticks  (long)
     96 -  99  total # of data points  (long)
    100 - 101  UT Hours of first tick  (integer)
    102 - 103  UT minutes              (integer)
    104 - 107  UT seconds              (real)
    108 - 511  Null padding 
 MODIFICATION HISTORY:
  95/1/25 - Written by Marc W. Buie, Lowell Observatory

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


RDPHALT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	rdphalt
 PURPOSE: (one line)
	Reads photometry from an alternate format basphot log file.
 DESCRIPTION:
	All photometry is read from the file and returned to the caller.
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
	pro rdphalt,logname,filename,obj,fil,jd,exptime,gain,rad,sky1,sky2,serial, $
	           xpos,ypos,fwhm,maxcnt,mag,err
 INPUTS:
	logname  - string containing the photometry log file to read from.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	filename - Original image file name for each point.
	obj      - String array containing all object names.
	fil      - String array with filter codes.
	jd       - Julian date of mid-time of observation.
	exptime  - Exposure time in seconds.
	gain     - Gain of system in photons per count.
	rad      - Radius of object aperture in pixels.
	sky1     - Inner radius of sky annulus in pixels.
	sky2     - Outer radius of sky annulus in pixels.
	serial   - Serial number for observation.
	xpos     - vector containing the x position for each point.
	ypos     - vector containing the y position for each point.
	fwhm     - Full-width at half maximum in arcseconds.
	maxcnt   - Original DN of maximum in image.
	mag      - Instrumental magnitude.
	err      - Uncertainties of the magnitudes.
  bad      - flag that marks data as bad.  1 is bad, 0 or missing is good.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written 1/19/93 - Marc W. Buie, Lowell Observatory.
	2/4/93, MWB, Rewrote file read to eliminate array concatenation.
  96/01/11, MWB, added NUMLINE, SKIPLINE keywords
  96/10/31, MWB, added bad flag argument and field.

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


RDPHOCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdphocat
 PURPOSE:
  Read a photometry standard catalog from a file.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdphocat,file,name,mags,codes,filname,nfil
 INPUTS:
  file   - Name of catalog file to read.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  name   - Name of the stars.
  mags   - Stellar magnitudes  (nfil x npts)
  codes  - Quality codes:      (nfil x npts)
            0 - not enough measurements for use as a quality standard.
            1 - good to use as standard
            2 - Known or suspected variable, don't ever use.
  filname- Filter names (string array)
  nfil   - Number of filters
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/22, Written by Marc W. Buie, Lowell Observatory

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


RDPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	rdphot
 PURPOSE: (one line)
	Reads photometry from a basphotc log file.
 DESCRIPTION:
	All photometry for the given object serial number is read from the file
	and returned to the caller.
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
	rdphot,filename,obj,name,xpos,ypos,mag,err
 INPUTS:
	filename - string containing the photometry log file to read from.
	obj      - object serial number to extract from the file.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	name     - Original image file name for each point.
	xpos     - vector containing the x position for each point.
	ypos     - vector containing the y position for each point.
	mag      - instrumental magnitudes
	err      - uncertainties on the magnitudes
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Revised for new version of basphotc
	  8/31/92 - Marc W. Buie, Lowell Observatory.

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


RDPHOT2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	rdphot2
 PURPOSE: (one line)
	Reads the original BASPHOTC photometry log file.
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


RDPHOT3

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdphot3
 PURPOSE: (one line)
  Reads photometry from a reduced photometry file (see WRPHOT)
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdphot3,filename,jd,fil,mag,err,bad
 INPUTS:
  filename - string containing the photometry log file to read from.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
  jd       - Julian date at mid-time of observation
  fil      - Filter code for observation
  mag      - Magnitude
  err      - Uncertainty on the magnitude
  bad      - Flag 0=good, 1=bad
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  11/3/96 - Written by Marc W. Buie

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


RDPRICAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     rdpricat
 PURPOSE: (one line)
     Read data from a private star catalog.
 DESCRIPTION:

     This procedure reads a semi-standard file containing a private format
     star catalog.

     The Version 1 format of the file is as follows:
        Line 1 - Id line, must be 'PRICAT v1'
        Line 2 - Number of magnitudes stored in file for each star.
                    You can also list the names for the magnitudes here.  They
                    aren't read but the documentation can be stored here.
        Line 3 to end -
           id name  h  m  s   sign  d  m  s   dra ddec epoch/equinox mag_1 mag_2 ... mag_n
           i3  a16 i2 i2 f6.3  a1  i2 i2 f5.2  d   d       f           f     f        f

        The RA and Dec must be in the epoch and equinox stated on the same line.
        The RA proper motion is in seconds of time per century (not including
        the cos(dec) factor.  The Dec proper motion is in seconds of arc
        per century.  If the epoch is listed as 2000.0 it is assumed to be
        in the J2000 coordinate system.  Any other epoch is treated as if
        it were in the B1950 system (regardless of epoch and equinox).
        Therefore, going to J2000 requires precession to B1950 then shifting
        to the J2000 system.

        Example -
       201 1989 Comp      12:22:34.455 +10:34:45.56 +0.0020 -0.0030 1950.0 14.567

     The values stored for the magnitudes are completely left up the the user.
     This program doesn't use it.

 CATEGORY:
     File I/O
 CALLING SEQUENCE:
     rdpricat,id,name,ra,dec,mags
 INPUTS:
     None.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     EPOCH   - JD of epoch to correct for proper motion to.
                 Default = catalog epoch.
     FILE    - Name of star catalog file to read.
                 Default = 'private.cat'  in current directory.

     Only one of the following is allowed to be set.  If none are set,
        the coordinates will be returned in the equinox of the catalog.
     B1950   - Coordinates should be referred to equinox of B1950.
     J2000   - Coordinates should be referred to equinox of J2000.
     OFDATE  - Coordinates should be referred to equinox of date.
                 If selected, EPOCH must be provided.

 OUTPUTS:
	   id      - Identification number of the stars.
	   object  - Name of the stars.
	   ra      - Right Ascension in radians.
	   dec     - Declination in radians.
	   mags    - Stellar magnitude(s)

 KEYWORD OUTPUT PARAMETERS:
     DRA     - Proper motion in "/year for right ascension.
     DDEC    - Proper motion in "/year for declination.
     NMAGS   - number of magnitudes for each object.
     NPTS    - number of catalog entries.

 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:

   WARNING!!!! Do not put ANY tabs in the catalog file.  The program will
     very likely crash on that line.  v3.1.0 restriction?

 PROCEDURE:
 MODIFICATION HISTORY:
     93/03/31, Written by Marc W. Buie, Lowell Observatory
     93/09/30, MWB, fixed erroneous precession for OFDATE case.

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


RDRAW

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	rdraw
PURPOSE:
	Read and return a two dimensional byte array from a raw animation file.
CATEGORY:
  File I/O
CALLING SEQUENCE:
	vec=rdraw('myfile.dat',640,480)
INPUTS:
	filename = string containing the name of the file to read.
	ncols    = number of columns in image
	nrows    = number of rows in image
OUTPUTS:
	returns the vector
REVISION HISTORY:
	Written by Marc Buie on 4/24/91
COMMENTS:

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


RDRAWAST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdrawast
 PURPOSE:
  Read raw astrometry data file.
 DESCRIPTION:

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdrawast,file,fn,jd,ra,dec,mag,nobs
 INPUTS:
  file - Astrometry data file to be read.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  fn  - Original filename for measurement
  jd  - Julian date of measurement
  ra  - Right Ascension (radians)
  dec - Declination (radians)
  mag - measured magnitude
  nobs - Number of measurements.  (zero if file not found or file empty).

 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/rdrawast.pro)


RDTBL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rdtbl
 PURPOSE:
  Read the data from the table file from one night of OSIRIS observations
 DESCRIPTION:
  The table file is read one line at a time and then disected into the various
  pieces of information in the form of arrays.  These arrays are then saved in
  a structure.
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  rdtbl,tablname,tbl
 INPUTS:
  tablname - The name of the table file to be read
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  tbl - Structure containing the information from the table file
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  98/06/10 - Written by Chris Dalla Piazza, Lycoming College; extracted from
             xdspec

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


READTIL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	readtil
 PURPOSE: (one line)
	Read and return the two images in a MaxEnt tile map file.
 DESCRIPTION:
 CATEGORY:
       Miscellaneous
 CALLING SEQUENCE:
	readtil,filename,pluto,charon
 INPUTS:
	filename - String containing the filename to be read from disk.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	pluto  - The first map found in the file (Pluto) (1-d vector).
	charon - The second map found in the file (Charon) (1-d vector).
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1991 Sep 27.

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


REDFITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  redfits
 PURPOSE:
  Apply standard CCD processing steps to a raw CCD image.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:

 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/redfits.pro)


REDUCTOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  reductor
 PURPOSE:
  Automated photometry reduction tool.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  reductor
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  DEBUG      - Turn on debug information output, default=OFF
  DUMPOBJ    - Name of object to dump complete reduction information on.
                 If set to 'all', all objects are dumped.
  FLUSH_INFO - Flush all cached information, force a clean start
  FORCE      - Flag, if true, ignores "ok" in instructions
  FULL       - Flag passed to colorsol that generates a more involved listing
                 of the reductions.
  MAGRESID   - Edit bad values by mag residual, not sigma residuals
  NOEDIT     - Suppress all bad point editing.
  PRINT      - Send all plot output to the default printer (PORTRAIT.PRO),
                  The display device is set to X (with
                  a call to DISPLAY.PRO) upon exit.
  RESETBAD   - Flag, if true, turns off all bad flags.
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
   COM_REDUCTOR - This is used to save information between multiple runs
                    of this program.  Considerable information is cached to
                    speed execution on the same night of data.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  The operation of the program is controlled by the contents of a file
     named reduc.inf that is in the current directory.  If not found, this
     program will attempt to build a relevant file to get started.  In normal
     use you will run this program many times on the way to getting your
     photometry reduced.  What steps are done and how they are done are
     controlled by lines in the reduc.inf file.

  The contents of reduc.inf are as follows:
     Line 1 - REDUCTOR v1.0          File id line
     Line 2 - LCCD/OSU2              Instrument id (no spaces)
     Line 3 - /cdrom/lo_mwb_0022/    Directory where RAW image data reside
     Line 4 - 920611                 YYMMDD, UT date code
     Line 5 - 15.0 25.0 100.0 39.4   Photometry extraction parameters,
                                     Object radius, inner sky, outer sky, gain.
     Line 6 to end, these are "rule" lines that invoke different steps of
        reduction operations.  In general, these lines start with a two
        character operation code followed by the information needed for that
        step.

     The operators are:
          2c - Two color lightcurve against all sky standards
          dp - Differential photometric reduction (like Pluto)
          lc - Single color lightcurve against all sky standards.
          sl - Block for reducing Stars (in Landolt system) (color unknown).
          tr - Transformation against Landolt standard stars.

     In addition to the stated arguments, all operator lines can be terminated
        with the word "ok" (no quotes).  Any line marked in this way is
        ignored unless /FORCE is specified.

 ------------------------------------------------------------------------------
 2c - Two color lightcurve against all sky standards
 ------------------------------------------------------------------------------
 2c OBJECT SERNO FILCOD FILNAM STDFIL COLOR1 COLOR2
                 FILCOD FILNAM STDFIL COLOR1 COLOR2 STDCOL COLERR
 1  OBJECT - Standard object code name to reduce
 2  SERNO  - Serial number of ojbect to reduce (usually 0)
 3  FILCOD - filter code (string) as in photometry log file
 4  FILNAM - filter name (best if 1 character)
 5  STDFIL - color code for Landolt system 01234 = UBVRI
 6  COLOR1 - First color code for color to reduce against
 7  COLOR2 - Second color code (ex: B-V is color1=1, color2=2)
 8  FILCOD - filter code (string) as in photometry log file
 9  FILNAM - filter name (best if 1 character)
10  STDFIL - color code for Landolt system 01234 = UBVRI
11  COLOR1 - First color code for color to reduce against
12  COLOR2 - Second color code (ex: B-V is color1=1, color2=2)

 ------------------------------------------------------------------------------
 dp - Differential photometric reduction (like Pluto)
 ------------------------------------------------------------------------------
 dp FILCOD FILNAM COLNAM OBJECT SERNO COLOR COMP [k2 V1 E1] [ct V2 E2] [k V1 E1] [td DATE]
 1  FILCOD - filter code (string) as in photometry log file
 2  FILNAM - filter name (1 character)
 3  COLNAM - name of color (2 character, ie., BV or VR)
 4  OBJECT - Standard object code name to reduce
 5  SERNO  - Serial number of ojbect to reduce (usually 0)
 6  COLOR  - Standard color of object
 7  COMP   - Standard object name for comparison star (replace blanks with _)
  argument flags:
    k2     - override second order extinction coefficient.
    ct     - Override color term.
    k      - Override extinction.
    td     - Override transformation with values from another date.
  optional
    V1,E1  - Second order extinction and error
    V2,E2  - Color term
    DATE   - YYMMDD for date to use transformation from
 
 ------------------------------------------------------------------------------
 lc - Single color lightcurve against all sky standards.
 ------------------------------------------------------------------------------
 lc OBJECT SERNO FILCOD FILNAM STDFIL COLOR1 COLOR2 STDCOL COLERR
 1  OBJECT - Standard object code name to reduce
 2  SERNO  - Serial number of ojbect to reduce (usually 0)
 3  FILCOD - filter code (string) as in photometry log file
 4  FILNAM - filter name (best if 1 character)
 5  STDFIL - color code for Landolt system 01234 = UBVRI
 6  COLOR1 - First color code for color to reduce against
 7  COLOR2 - Second color code (ex: B-V is color1=1, color2=2)
 8  STDCOL - Standard color of object
 9  COLERR - Uncertainty of color

 ------------------------------------------------------------------------------
 sl - Block for reducing Stars (in Landolt system) (color unknown)
 ------------------------------------------------------------------------------
 sl FILCOD1 FILCOD2 FILNAM1 FILNAM2 STDFIL1 STDFIL2
 1  FILCOD1 - filter code (string) as in photometry log file for color 1
 2  FILCOD2 - filter code (string) as in photometry log file for color 2
 3  FILNAM1 - filter name (best if 1 character) for color 1
 4  FILNAM2 - filter name (bset if 1 character) for color 2
 5  STDFIL1 - color code for Landolt system 01234 = UBVRI for color 1
 6  STDFIL2 - color code for Landolt system 01234 = UBVRI for color 2

 ------------------------------------------------------------------------------
 tr - Transformation against Landolt standard stars.
 ------------------------------------------------------------------------------
 tr FILCOD FILNAM STDFIL COLOR1 COLOR2 [k2 V1 E1] [ct V2 E2] [kt]
 1  FILCOD - filter code (string) as in photometry log file
 2  FILNAM - filter name (best if 1 character)
 3  STDFIL - color codes for Landolt system 01234 = UBVRI
 4  COLOR1 - First color code for color to reduce against
 5  COLOR2 - Second color code (ex: B-V is color1=1, color2=2)

  argument flags:
    k2     - override second order extinction coefficient.
    ct     - Override color term.
    kt     - turn on time dependent extinction.
  optional
    V1,E1  - Second order extinction and error
    V2,E2  - Color term

 MODIFICATION HISTORY:
  Written by Marc W. Buie, 96/10/16, Lowell Observatory
  96/10/31, MWB, added "bad" flag support from rdphalt
  97/01/24, MWB, added MAGRESID flag
  92/02/27, MWB, added "dp" rule for differential photometry reductions.

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


REFEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  refext
 PURPOSE:
  Batch mode extraction of REFNET star catalog fields in support of ASTROM
 DESCRIPTION:
 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  refext,root,startnum,finnum
 INPUTS:
  startnum - First frame number to process
  finnum   - Last frame number to process
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

  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.

  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
                *  EPOCH     K  EPOCH
                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.  Only those fields marked with '*'
                are actually used by this program.

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

  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.

  PSCALE   - Scalar number, this is the scale of the image in arcsec/pixel.
                If not specified, then this program will look for the
                ASTROM information file, astrom.inf, in the current directory
                for the plate scale.  If the file does not exist, then you
                will be prompted to provide the plate scale directly.

  SCRIPT   - String, if provided is the file name to save a script to.
                If set will suppress the actual call to refnet to
                generate the star sub-catalogs.  Instead, all the calls
                to refnet will be saved to this file.

 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  97/11/13 - Original version written by Gerbs Bauer, Institute for Astronomy
  97/11/14, MWB, stylistic rewrite
  98/03/25, MWB, add EXTLIST keyword and group extension support

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


REFNET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  refnet
 PURPOSE:
  Support routine for calling ``REFNET'' to get stars from USNO A1.0 catalog.
 DESCRIPTION:

 CATEGORY:
  Astrometry

 CALLING SEQUENCE:
  refnet,ra,dec,width,height,bmaglim,rmaglim,starfile

 INPUTS:
  ra      - Right ascension of center of field for extraction (J2000)
              input can be in radians (double,float) or
              a string HH:MM:SS.S  (see RAPARSE for valid syntax).
  dec     - Declination of center of field for extraction (J2000, radians).
              input can be in radians (double,float) or
              a string +DD:MM:SS.S  (see DECPARSE for valid syntax).
  width   - Width of field to extract (arcsec).
  height  - Height of field to extract (arcsec).
  bmaglim - Limiting Blue magnitude to extract.
  rmaglim - Limiting Red magnitude to extract.
  starfile- File name for the results of the catalog extraction.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  CATPATH - Path to the location of the star catalog, default is
                 /pub/home/koehn/starnet/dist/USNO-A1.0

 OUTPUTS:
  The output is all to the file and contains a list of stars from the
    USNO A1.0 catalog according to the input constraints.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:
  Currently this is rather restricted and is just an initial working version.
  This is hardcoded to a specific location for the catalog and executable.
  This program will work only on Unix platforms at present.

 PROCEDURE:

 MODIFICATION HISTORY:
  97/05/08, Written by Marc W. Buie, Lowell Observatory
  97/11/24 - MWB - Added CATPATH keyword

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


REFRAC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  refrac
 PURPOSE:
  Apply atmospheric refraction to a ``true'' zenith angle
 DESCRIPTION:
  This calculation is based on a few different sources.  First, it is
  assumed that the index of refraction of air at the base of the atmosphere
  can be calculated (see AIRINDEX).  From the index of refraction, the
  bending is computed from the formula on p.55 of the old Explanatory Supplment
  to the Nautical Almanac.  This formula has been modified by removing the
  h/rho term.  The explanatory supplement doesn't indicate that this is
  legitimate but I've validated this computation against a more emperical
  formalism from Eisele and Shannon (NRL memo 3058, May 1975).  Eisele and
  Shannon don't indicate the wavelength of light used but if I use 0.56 microns
  and compare for the same input conditions (dry air only), the refraction
  computed agrees to within 1 arcsec down to 51 degrees zenith angle and
  is good to 10 arcsec down to 80 degrees.
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  zref = refrac(z,wave,pressure,temp,relhum)
 INPUTS:
  z        - true zenith angle (as if there were no atmosphere), in radians
	wave     - wavelength of light, in microns
	pressure - atmospheric pressure in mm of Hg
	temp     - atmospheric temperature in degrees C
	relhum   - Relative humidity (in percent)

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  returned is the refracted (or apparent) zenith distance.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:
  Not accurate (nor useful) for z > 85 degrees.

 PROCEDURE:

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

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


RELPATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  relpath
 PURPOSE: 
  Prepend a path to the file name if file starts with {\tt +}
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  repath,filename,path
 INPUTS:
  filename - Name of file
  path     - Name of directory
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  filename - path is prepended if filename starts with +, otherwise filename
             is left unchanged.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/08/07 - Written by Marc W. Buie, Lowell Observatory

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


RENDER

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  render
 PURPOSE: 
  Render a rectangular projection map to a sphere.
 DESCRIPTION:
  The most confusing aspect of this program is by far the image orientation.
  I can't make the conventions natural for everyone (not even myself), but
  here's what this program does:

  In the output image there is a natural coordinate system, (x,y).  Each
  row, ie., image[*,i] corresponds to a fixed value of y.  image[*,0]
  is the row with the LOWEST value of y.  This may seem strange, but it
  permits a "normal" orientation of the image if displayed with !order=0
  (the usual IDL default).  The x direction (image[i,*]) works in the
  obvious way, image[0,*] is the column with the LOWEST value of x.  So,
  viewed with !ORDER=0, this is an image that has up at the top.  The
  top is also considered NORTH when dealing with images that one sees in
  the sky (or relative to your point of view).

  The position angle of the pole sets the rotation of the sphere in the
  plane of the sky (image).  North is to the top (+y) and East is to the
  left (-x).  The position angle (POLE) is the angle of the apparent
  North pole of the sphere relative to up (North) in the image, measured
  From up (North) counter-clockwise (also known as eastward from North).

  Visualizing the indexing of the input map is equally confusing.  In
  the coordinate system containing the map, North is +y, East is -x, as
  before.  These coordinates are plane-of-sky on the object.  The map
  has its own coordinates, latitude and longitude.  The first index into
  the map is treated like x but is actually East Longitude.  The left edge
  of image[0,*] is precisely at 0 degrees longitude.  As the first index
  increases (increasing x?), the longitude increases.  The right edge of
  the last column in the map is 360 degrees.

  Ok, here is the weird part.  The first row in the map is the NORTHERN-most
  set of pixels.  The last row is the SOUTHERN-most set.  So, map[0,0]
  touches the prime meridian and the north pole.
      Thus map[i,j]:
           longitude = (i+0.5)/nl * 360.0
           latitude  = 90.0 - (j+0.5)/nt * 180.0
        where nl is the width of map and nt is the height of the map.
      These formulas give the lat,lon of the CENTER of the pixel in degrees.

  Now, understanding the sub-"earth" and sub-solar longitudes becomes
  easy.  The sub-"earth" point is the lat,lon of the map that is in the
  center of the projected disk.  The sub-solar point is the lat,lon of
  the map that is nearest to the sun (normal solar illumination).  Note,
  that as the object rotates, the sub-earth longitude will decrease, not
  increase.

 CATEGORY:
  Image display
 CALLING SEQUENCE:
  render,map,radius,scale,pole,selat,selon,sslat,sslon,nx,ny,image
 INPUTS:
  map - Array containing a full map of surface
  radius - Radius of object (eg., in km)
  scale  - Scale of image (eg., km/pixel)
  pole   - Position angle of pole, east from north (degrees)
  selat  - Sub-earth latitude (degrees)
  selon  - Sub-earth longitude (degrees)
  sslat  - Sub-solar latitude (degrees).  Only used for Hapke functions.
  sslon  - Sub-solar longitude (degrees).  Only used for Hapke functions.
  nx     - X size of output image in pixels.
  ny     - Y xize of output image in pixels.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  SILENT - Flag, if set suppresses all printed output
  NODISPLAY - Flag, if set suppresses graphical output
  GEOM - Undefined (default), no special action.
         If defined but not a structure, then upon return geom will contain
            all the geometric information needed to render the image with a
            new map.
         If defined and is a structure, then the contents are taken to be
            that needed to do the final image calculation without redoing
            all the geometric computation.

  Limb darkening model to use (set one of these, at most):
     
     LIN   - Linear limb-darkening coeff, map is normal albedo
     MIN   - Minnaert limb-darkening coeff, map is normal albedo
     HAPKE - Hapke scattering model, map is single scattern albedo
                HAPKE[0] = h (old style, circa 1981)
                HAPKE[1] = P(0)
     HAP2  - 2nd generation Hapke scattering model, 1986 and the book,
               "Theory of Reflectance and Emittance Spectroscopy"
                HAP2[0] = h (new style, circa 1986, p. 226 in book)
                HAP2[1] = P(g)
                HAP2[2] = B0, Emperical backscatter factor (p. 228)
                HAP2[3] = Theta(bar), surface roughness parameter.
     H93   - When used with HAP2, will select which approximation to the
                H-function is used.  Default is the simplest (and fastest)
                formula from the 1981 Hapke paper.  H93, when set, will
                force the use of eqn. 8.57 from the Hapke book (from 1993).

 OUTPUTS:
  image  - Rendered image of object.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
   95/07/24, Written by Marc W. Buie, Lowell Observatory
   96/04/11, MWB, fixed numerous bugs, now works for sun and viewpoint
                    being different
   97/08/21, MWB, added HAP2 keyword
   97/08/27, MWB, added GEOM keyword
   97/09/18, MWB, repaired incorrect mapping of map to surface.

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


REPCHAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  repchar
 PURPOSE:
  Replace a target string with a new string in string or string array.
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  result = repchar(str,c1,c2)
 INPUTS:
  str - input string or string array to be scanned
  c1  - Target string, if found will be replaced with c2
 OPTIONAL INPUT PARAMETERS:
  c2  - Replacement string for target, default = ' '
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  return value is the modified string, input not modified
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
    96/07/02 - Written by Marc W. Buie, Lowell Observatory

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


REPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  rephot
 PURPOSE: (one line)
  Reprocess photometry data set by re-extracting from images.
 DESCRIPTION:
  This program will use a previously created photometry log file (new
  format as read and defined by RDPHALT.PRO) to reprocess the photometry
  allowing a change to the CCD gain, photometric aperture, and more.
  It also normally is used to reprocess photometry with new calibration
  information but this is not required.
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
 INPUTS:
  oldlog - Filename of an alternate format basphot log file.
  newlog - Filename for the new format file (must be different).
  calibs - Filename for the calibration information to be use.
                     (See LDCALIB.PRO for full details.)
              If this name is set to 'none', then all calibration steps
                  are bypassed.

 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
  PATH    - Directory path pointing to location for raw images.
  NEWGAIN - New value of the gain to reduce with, e-/ADU
  NEWRAD  - New value of the object aperture radius in pixels.
  NEWSKY1 - New value of the inner sky annulus radius in pixels.
  NEWSKY2 - New value of the outer sky annulus radius in pixels.
  PSCALE  - Provide plate scale of data (default = 0.726 arcsec/pixel).
  SILENT  - Do not generate voluminous BASPHOTE output to the screen.
  NSTART  - Starting point number to measure (default is beginning).
  NSTOP   - Ending point number to measure (default is end).
              Note: NSTART and NSTOP are zero-indexed.
   The following set of keywords controls a feature known as Multi-Aperture
     Photometry, where a number of different apertures are used on the
     same object on the same frame.
  MAPNAME - String array list of object names to apply multi-aperture
               photometry processing to (default=none).
  MAPSERNO - Integer scalar or vector giving object serial numbers to
               apply serial numbers to (default=0).  If set to -1, then
               all serial numbers are processed with multiple apertures.
  MAPERTURE - Vector list of apertures to apply to all of MAPNAME/MAPSERNO.
  MAPSKY1   - Inner sky annulus radius.  May be scalar or same length as
                 MAPERTURE.  Default = NEWSKY1
  MAPSKY2   - Outer sky annulus radius.  Must be same length as MAPSKY1.
                 Default = NEWSKY2
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  Rephot will read the log file from start to finish and process those
    points in the range from NSTART to NSTOP.  There can be many extractions
    from a single image so the point range does not usually correspond to
    a frame number.  All of the information required to re-extract the
    photometry from the image is read from the photometry log file or comes
    from the optional override numbers.  This program does NOT read the
    image headers to get its information.  This means that if the log file
    information is wrong, you need only edit (and fix) the log file to get
    the right information.  When editing a log file you need to be a little
    careful but the format is pretty flexible and works by fields, not by
    absolute position.

  If MAPNAME is not set, then each entry is recomputed.

  If MAPNAME and MAPERTURE are set, then the processing considerably more
    complicated.

 MODIFICATION HISTORY:
  Written 1993 Feb 4 by Marc W. Buie, Lowell Observatory
  93/05/10, MWB, Added LORAL instrument option.
  93/11/02, MWB, added PSCALE keyword, fixed overscan code for LORAL
  94/03/16, MWB, added version 2 calibration file support.
  95/03/03, MWB, fixed bug the didn't handle -1 -1 in calib files properly
  95/03/07, MWB, added version 3 calibration file support.
  95/06/12, MWB, added CALIBPATH support.
  95/08/08, MWB, split out calibration info loading to separate routine.
  96/10/31, MWB, added "bad" flag support from rdphalt
  97/10/31, MWB, added calibs='none' option.

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


REPWRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  repwrite
 PURPOSE:
  Update file by replacing or adding line of information
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  repwrite,file,tag,line
 INPUTS:

  file - string of file name to update (or create)

  tag  - key to scan at the start of the line, all lines found
          matching this key will be replaced by the new line provided.
          Any other line matching this tag will be removed from the file.

  line - Replacement line for file.  If tag is not found, this will be
          added to the file.  The output is left sorted by the tags.
          If this is an empty string (''), then all lines that match the
          tag will be removed.

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:

  HEADER  - String array to put at start of file if file is created.
              Default is no header.  If file already exists, then this is
              ignored.

  HEADLEN - Number of lines at the start of the file to pass over.
              File must have at least this many lines to be valid.  If no
              header provided, the default is 0.  If you give a header, then
              the length of the string array is used as the default header
              length.
           
 OUTPUTS:
  All output is to the file.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/19, Written by Marc W. Buie, Lowell Observatory
  97/2/6, MWB, different algorithm and file is now sorted.
  97/10/09, MWB, added HEADER and HEADLEN keywords
  98/03/22, MWB, added NOSORT keyword

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


RFGFIT

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

 PURPOSE:
	Fit a radial gaussian to the input data (no linear term, width fixed).

 DESCRIPTION:
 	Fit the equation y=f(r) where:

 		F(r) = A0*EXP(-z^2/2) + A2
 			and
		z=r/A1, A1 is constant

	A0 = height of exp, A1 = sigma (the width).
	A2 = constant term,
 	The parameters A0, A1, A2 are estimated and then CURVEFIT is 
	called.  The gaussian is assumed to be centered at r=0.

 CATEGORY:
	Function fitting

 CALLING SEQUENCE:
	Result = RFGAUSSFIT(R, Y [, A])

 INPUTS:
	R:	The independent variable.  R must be a vector.
	Y:	The dependent variable.  Y must have the same number of points
		as R.

 OUTPUTS:
	The fitted function is returned.

 OPTIONAL OUTPUT PARAMETERS:
	A:	The coefficients of the fit.  A is a three-element vector as 
		described under PURPOSE.

 COMMON BLOCKS:
	rf_gauss   -  Contains the constant gaussian width to use.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:

 PROCEDURE:
	The initial guess of the intensity is the value of the point 
	with the smallest r value.  The first point that drops below
	half of the first is the guess at the width.

 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.
	Rewritten to change initial guess, MWB, Lowell Obs., Dec. 1992.
	Rewritten to remove background function, MWB, Lowell Obs., Jan. 1993.

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


RGFIT

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

 PURPOSE:
	Fit a radial gaussian function and 2nd order polynominal to the input data.

 DESCRIPTION:
 	Fit the equation y=f(r) where:

 		F(r) = A0*EXP(-z^2/2) + A2 + A3*r + A4*r^2
 			and
		z=r/A2

	A0 = height of exp, A1 = sigma (the width).
	A2 = constant term, A3 = linear term, A4 = quadratic term.
 	The parameters A0, A1, A2 are estimated and then CURVEFIT is 
	called.  The gaussian is assumed to be centered at r=0.

 CATEGORY:
	Function fitting

 CALLING SEQUENCE:
	Result = GAUSSFIT(R, Y [, A])

 INPUTS:
	R:	The independent variable.  R must be a vector.
	Y:	The dependent variable.  Y must have the same number of points
		as R.

 OUTPUTS:
	The fitted function is returned.

 OPTIONAL OUTPUT PARAMETERS:
	A:	The coefficients of the fit.  A is a five-element vector as 
		described under PURPOSE.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:

 PROCEDURE:
	The initial guess of the intensity is the value of the point 
	with the smallest r value.  The first point that drops below
	half of the first is the guess at the width.

	If the (MAX-AVG) of Y is larger than (AVG-MIN) then it is assumed
	that the line is an emission line, otherwise it is assumed there
	is an absorbtion line.  The estimated center is the MAX or MIN
	element.  The height is (MAX-AVG) or (AVG-MIN) respectively.
	The width is found by searching out from the extrema until
	a point is found less than the 1/e value.

 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.
	Rewritten to change initial guess, MWB, Lowell Obs., Dec. 1992.
	93/05/11, put in failsafe on gaussian width guess, MWB, Lowell Obs.

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


RINGPROF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    ringprof
 PURPOSE: (one line)
    Compute a surface brightness profile.
 DESCRIPTION:

 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
    ringprof, image, xcen, ycen, rmax, dr, skyback, rout, iout
 INPUTS:
    image      : CCD image array.
    xcen, ycen : Coordinates of center.
    rmax       : Maximum radius for profile.
    dr         : Incremental value of radius.
    skyback    : Sky background.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    rout : Radius vector of length rmax/dr+1.
    rout : Counts vector of length rmax/dr+1.

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

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

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


ROBOMEAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  robomean
 PURPOSE: (one line)
  Robust statistical moments of the data.
 DESCRIPTION:
  This routine computes the average, average deviation, standard
  deviation, variance, skew and kurtosis of the input data.  The various
  output quantities are always returned as floating point scalars.
  The statistics are computed with no regard for the dimensionality of
  the input data.

  The statistics are robust in that the data is searched for outliers
  after the moments are computed.  If outliers are found they are
  removed and the statistics are computed again.  This continues until
  either no outliers are found or if the removal of outliers has an
  insignificant effect on the statistics.
 CATEGORY:
  Statistics
 CALLING SEQUENCE:
  robomean,data,thresh,eps,avg,avgdev,stddev,var,skew,kurt,nfinal
 INPUTS:
  data   - Input data to be analyzed.
  thresh - Deviation from the mean to signify an outlier.
  eps    - Smallest significant change in mean in units of std dev.
 OPTIONAL INPUT PARAMETERS:
  None.
 INPUT KEYWORD PARAMETERS:
  bad    - Array of flags, 0=good, 1=bad.  Any points removed from the sample
              will have this flag set to 1 upon return.  Note that if you
              do not supply this array, you will not get the resulting bad
              flag output even if you supply the keyword.
 OUTPUT KEYWORD PARAMETERS:
  STDMEAN : Optional return of standard deviation of the mean.
 OUTPUTS:
  avg    - Sample mean.
  avgdev - Average deviation of the data from the mean.
  stddev - Standard deviation of the data from the mean.
  var    - Variance of the data from the mean.
  skew   - Skewness, third statistical moment.
  kurt   - Kurtosis, fourth statistical moment.
  nfinal - Number of points used in the final result.
  new    - Vector of 'clean' pixels (optional).
 COMMON BLOCKS:
  None.
 SIDE EFFECTS:
  None.
 RESTRICTIONS:
  None.
 PROCEDURE:
  Standard techniques, see section 13.1 in Numerical Recipies.  The
  thresh and eps values are not tremendously important.  Thresh=5.0
  and eps=0.5 appear to work pretty well most of the time.
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1992 Jan 20.
  Fix - nfinal was not being returned to calling program.
        Doug Loucks, Lowell Observatory, 1992 Oct 22.
  Fix - Sense of test to determine additional refinement was
        not correct for some cases.  Changed logic to parallel
        the C version, since the WHILE statement is now available
        in IDL.
  Mod - Added by Marc Buie: Argument 'new,' allowing the 'clean' pixels
        to be returned to the caller.
  Mod - 2/11/94, DWL, Added keyword STDMEAN to permit return of this
        value to the caller.
  97/03/23 - MWB, added BAD keyword and operation.  This program's operation
        should not be any different than what it was if you don't supply BAD.
  98/07/08, MWB, changed so that NaN values are automatically flagged as bad.

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


ROTPOINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  rotpoint
 PURPOSE: 
  Rotate x,y,z point(s) about arbitrary axis.
 DESCRIPTION:
 CATEGORY:
  Mathematical
 CALLING SEQUENCE:
  rotpoint,x,y,z,axis,angle,xp,yp,zp
 INPUTS:
  x     - Cartesian x-coordinate of point.
  y     - Cartesian y-coordinate of point.
  z     - Cartesian z-coordinate of point.
  axis  - Axis to rotate about:
           'x' or 'X' or 0  - indicates rotation about x-axis
           'y' or 'Y' or 1  - indicates rotation about y-axis
           'z' or 'Z' or 2  - indicates rotation about z-axis
  angle - Angle to rotate by (scalar).  Radians unless /DEG is set.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  DEG - flag, if true indicates angle is in degrees, otherwise angle is
           taken to be in radians.
 OUTPUTS:
  xp - Rotated x-coordinates.
  yp - Rotated y-coordinates.
  zp - Rotated z-coordinates.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written 1/4/95 by Marc W. Buie, Lowell Observatory

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


ROUND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    round
 PURPOSE: (one line)
    round a floating point number.
 DESCRIPTION:
    rounds a floating point number to the nearest whole number.
 CATEGORY:
    Mathematical
 CALLING SEQUENCE:
    round( x )
 INPUTS:
    x : The number to be rounded.
 OPTIONAL INPUT PARAMETERS:
    None.
 KEYWORD PARAMETERS:
    None.
 OUTPUTS:
    Function value: The rounded number.
 COMMON BLOCKS:
    None.
 SIDE EFFECTS:
    None.
 RESTRICTIONS:
    None.
 PROCEDURE:
    Applies symmetric rounding to the given number.
 MODIFICATION HISTORY:
    Ported by Doug Loucks, Lowell Observatory, 1992 Sep, from the routine
    in pixwt.c written by Marc Buie.

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


RQGFIT

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

 PURPOSE:
	Fit a radial gaussian function to the input data (no linear term).

 DESCRIPTION:
 	Fit the equation y=f(r) where:

 		F(r) = A0*EXP(-z^2/2) + A2 + A3*r^2
 			and
		z=r/A2

	A0 = height of exp, A1 = sigma (the width).
	A2 = constant term, A3 = quadratic term.
 	The parameters A0, A1, A2 are estimated and then CURVEFIT is 
	called.  The gaussian is assumed to be centered at r=0.

 CATEGORY:
	Function fitting

 CALLING SEQUENCE:
	Result = RQGAUSSFIT(R, Y [, A])

 INPUTS:
	R:	The independent variable.  R must be a vector.
	Y:	The dependent variable.  Y must have the same number of points
		as R.

 OUTPUTS:
	The fitted function is returned.

 OPTIONAL OUTPUT PARAMETERS:
	A:	The coefficients of the fit.  A is a four-element vector as 
		described under PURPOSE.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:

 PROCEDURE:
	The initial guess of the intensity is the value of the point 
	with the smallest r value.  The first point that drops below
	half of the first is the guess at the width.

 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.
	Rewritten to change initial guess, MWB, Lowell Obs., Dec. 1992.
	Rewritten to remove linear term, MWB, Lowell Obs., Jan. 1993.

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


SALB

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
   salb
 PURPOSE: 
   Compute single particle scattering albedo.
 DESCRIPTION:
 CATEGORY:
   Mathematical
 CALLING SEQUENCE:
   salb,radius,abscoef,se,si,w
 INPUTS:
   radius - Radius of particle, same units as 1/abscoef
   abscoef - absorption coefficient of material, units 1/radius
   se      - external scattering efficiency
   si      - internal scattering efficiency
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
   w       - single scattering albedo
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1995 May 13

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


SAVESTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  savestar
 PURPOSE: (one line)
  Save the master star catalog file
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  loadstar
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     FILE    - Name of star catalog file.  Default is:
                 '/gryll/data1/buie/starcat/starcat.dat'

 OUTPUTS:
   file is overwritten with contents of common block
 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/savestar.pro)


SEERAD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  seerad
 PURPOSE:
  Display a radial profile at X and Y value of the cursor
 CATEGORY:
  Image display
 CALLING SEQUENCE:
  seerad, image [, X0, Y0]
 INPUTS:
  Image = Array containing values that are displayed.  May be
          any type.  Rather than pixel values being read from the display
          they are taken from this parameter, avoiding scaling difficulties.
 OPTIONAL INPUT PARAMETERS:
  X0, Y0 = Optional location of lower left corner of image area on
           screen.
 OUTPUTS:
  None.
 COMMON BLOCKS:
  None.
 SIDE EFFECTS:
  The X, Y and value of pixel under the cursor are constantly 
    displayed.

  Pressing left or center mouse button, makes a new line of output,
    saving the old and generating a new profile.
  Pressing right mouse button, exits the procedure.

 RESTRICTIONS:
  None.
 PROCEDURE:

 MODIFICATION HISTORY:
  Marc W. Buie, Lowell Observatory, 1992 March 27

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


SETUSYM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  setusym
 PURPOSE: (one line)
  Set the user defined symbol to be a filled circle (@ script).
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  setusym,sym
 INPUTS:
  sym - Symbol to load into the user-defined type.
          1 - Circle
          2 - Plus sign
          3 - Asterisk
          4 - Diamond
          5 - Triangle, point up.
          6 - Square
          7 - X
          8 - Star
          9 - Triangle, point down.
  Positive ==> filled shape, negative ==> hollow shape.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
  Redefines the user defined type (psym=8)
 RESTRICTIONS:
 MODIFICATION HISTORY:
   Written by Marc W. Buie, Lowell Observatory, 1992 Sep 21
   98/02/19, MWB, added new symbols 2-

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


SETWIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  setwin
 PURPOSE: 
  Set current draw window, create if needed.
 DESCRIPTION:
  This is intended to be a more general call for controlling the use of
  multiple plot windows especially in scripts or programs.  In particular,
  this routine becomes a no-op if the current display device can't handle
  windows (like the PS device for printing).  In its simplest form, just
  type   setwin,number   to make window number the current window.  If the
  window does not exist it will be created.  The other optional inputs work
  as described in the IDL documentation for WDEL, WSHOW, WINDOW, WSET.
  If the size and location of the window does not change, then the window
  is not recreated and its status on the screen is unchanged.  Note that
  the window title can only be changed when the window is created.  Warning:
  the xpos,ypos detection does NOT return the same value as is specified
  when the window is created.  I have determined the offset requested and
  actual position under the X-window display I use.  This offset is probably
  not correct on other windowing systems.  If TITLE and SHOW are set then
  the window is recreated regardless of the other keyword settings.
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  setwin,id
 INPUTS:
  id - window number to make the current draw window
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  ERASE - Flag, if set causes the window to be erased after setting.
  SHOW  - Flag, if set causes the window to be brought to the front.
  XPOS  - X position of the lower left corner of the window
  YPOS  - Y position of the lower left corner of the window
  XSIZE - the x size of the window.
  YSIZE - the y size of the window.
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  94/04/26 - Written by Marc W. Buie, Lowell Observatory
  98/01/29 - MWB, Added TITLE keyword and improved use of XPOS,YPOS

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


SIGRATIO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  sigratio
 PURPOSE:
  Compute the relative signal level between a set of spectra (1-d vectors).
 DESCRIPTION:

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  sigratio,stack,relsig,noise,REF=ref
 INPUTS:
  stack - an array of spectra [npts,nspec]
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  BAD       - Array of flags for each point in stack.  0=good, 1=bad. (default=0).
  REF       - If provided, the relative signal levels are measure relative to
                 this spectrum out of the stack.  You can also provide an
                 external spectrum as a vector with npts.
  RBAD      - Bad value flags for the reference (only used if REF is a spectrum).
  SCALE     - range of pixels to use for scaling all spectra to each other.
                 The default is to use all pixels for scaling.
 OUTPUTS:
  relsig - Output array, NSPEC long, that has the relative signal levels.
  noise  - Output array, NSPEC long, that is the noise level in each spectrum
              relative to the reference.
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/07/24 - Written by Marc W. Buie, Lowell Observatory
  98/08/14, MWB, added REF spectrum support, RBAD keyword, and noise output.
  98/09/10, MWB, cleanup to eliminate illegal floating point operations.

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


SINCFLTR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sincfltr
 PURPOSE: (one line)
	Pass 1-d data through a low-pass filter (damped sinc).
 DESCRIPTION:
	This procedure will filter an array of data with a low pass filter.
	The input value, smofac, determines the high-frequency cut-off in the
	output data.  The new cutoff will be 1/smofac times the old cutoff
	frequency which is defined to be 1/2 the sampling interval in the
	original data.

	Thus, a smofac of 1 will return the original array and a smofac greater
	than one will reduce the resolution of the input by that factor.  Large
	values of smofac ( > 6 ) should be avoided.  For large values it is
	much faster to do the filtering in multiple steps (provided you
	sub-sample the output vector).

	The filter is a damped sinc function and requires 21*smofac points in
	the convolution kernel.

	Note: The convolution will not be complete for any data point near the
	edge, so those points cannot be trusted.  The edge effect will be
	larger for larger values of the smofac.

	If smofac is greater than 2, not all smoothed points are required.
	Since the filter reduces the band-limit of the data, you can
	sub-sample the output array with no loss of information.  For instance,
	a smofac=4 will reduce the resolution of the data by a factor of 4.
	That means all you need to save is every fourth point to retain all
	of the information in the smoothed vector, ie., a step_by of 4.
	In practice, it is probably wise to use a step_by value that is slightly
	smaller than the value of smofac, eg., smofac=6, step_by=5.

	For a more detailed description of filtering, convolution, sub-sampling,
	and other related topics, consult the excellent reference: "The Fourier
	 Transform and Its Applications", by Ronald N. Bracewell, 2nd ed.,
	 McGraw Hill.

 CATEGORY:
       Numerical
 CALLING SEQUENCE:
	ans = function sincfltr,x,smofac,step_by
 INPUTS:
	x       - Input data to be smoothed.
	smofac  - Smoothing factor relative to current sampling of data.
	step_by - Sub-sampling factor for output vector (integer).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	return = smoothed and (possibly) sub-sampled data.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	92/11/03 - Ported from an equivalent Zodiac function written in C.
		Marc W. Buie, Lowell Observatory.
  94/08/29, MWB, fixed bug for when length of input not evenly divisible
                 by the sub-sample factor.
  95/03/29, MWB, fixed bug

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


SINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    sint
 PURPOSE: (one line)
    Sinc interpolation of a 1-D vector of data.
 DESCRIPTION:

 CATEGORY:
    Numerical
 CALLING SEQUENCE:
    result = sint( x, f )
 INPUTS:
    x  : Independent variable values for which f is to be interpolated.
         Note: The implied independent variable values for f are the indicies
         of the vector f.
    f  : Vector of function values (dependent variable).

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    Interpolated value(s).
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, September, 1993.
    Adapted from the IDL function sshift.pro written by Marc Buie.
    01/14/94, DWL, Documentation update.

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


SINT2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    sint2d
 PURPOSE: (one line)
    Sinc interpolation of a 2-D array of data.
 DESCRIPTION:

 CATEGORY:
    Numerical
 CALLING SEQUENCE:
    result = sint2d( x, y, f )
 INPUTS:
    x, y  : Position of desired function value.
    f     : Two-D function array.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    Interpolated function value.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
    Calls external function sint to interpolate appropriate 1-D slices of
 the 2-D array.
    Note: For speed, input parameters are not verified.
 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, September, 1993.

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


SINTERP4

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    sinterp4
 PURPOSE: (one line)
    Four-fold sinc interpolation of a vector of data.
 DESCRIPTION:
    This function will do a 4-fold sinc interpolation of the data
    array that is passed.
 CATEGORY:
    Numerical
 CALLING SEQUENCE:
    result = sinterp4( x )
 INPUTS:
    x     : Input data array.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    The interpolated array is returned as the function value.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Original C-Language version written by: Marc W. Buie, Institute for
 Astronomy, University of Hawaii.  Date: 9 December 1987.
    Adapted for IDL by Doug Loucks, Lowell Observatory, September 2, 1993.

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


SKYSCLIM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  skysclim
 PURPOSE:
  Compute stretch range for a hard stretch on the background in an image.
 DESCRIPTION:
 CATEGORY:
  Image display
 CALLING SEQUENCE:
  skysclim,image,lowval,hival,meanval,sigma
 INPUTS:
  image - 2-d image to compute stretch range for.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  lowval - Low DN value for sky stretch
  hival  - High DN value for sky stretch
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/01/07 - Marc W. Buie

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


SL9PROC

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  sl9proc
 PURPOSE: 
  Interactive program to process and crop image for SL9 data.
 DESCRIPTION:
  This is a special purpose routine built for processing SL9 data image and
    selecting region of interest to crop.  There is also special code to
    detect missing exposure times and allow user to enter a new value.
    (either version) to save it (after processing) to disk.
 CATEGORY:
  CCD data processing
 CALLING SEQUENCE:
  sl9proc,root,imnum,
     PATH=path, OUTPATH=outpath, BIAS=bias, DARK=dark, FLAT=flat, SIZE=size
 INPUTS:
  root  - string containing the root of the data file names (no period)
  imnum - vector contining a list of image numbers to process.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  PATH    - Directory where data files reside (default = ./)
  OUTPATH - Directory where output files will be written (default = ./)
  BIAS    - Bias frame to subtract (default=none)
  DARK    - Dark frame to subtract (default=none)
  FLAT    - Flat field to divide into data (default=1)
  SIZE    - Size of array to save, default is 200.
 OUTPUTS:
  Output is a FITS file with the chosen image (after processing)
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  As this is a special purpose routine, there are many possible ways for
    this program to fail if you try to process general data not from our
    SL9 data.
 PROCEDURE:
 MODIFICATION HISTORY:
  96/07/02, Written by Marc W. Buie, Lowell Observatory, cloned from PICKIM
  96/07/03, MWB, added calib mis-match support

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


SLIDEFIL

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  slidefil
 PURPOSE: 
  Sliding spatial filter on time series data.
 DESCRIPTION:
  This program scan a data stream looking for short duration, non-random
  excursions.  Primarily designed for scanning stellar occultation data,
  you provide the data (y), the independent variable (x) and the filter
  widths.  The equivalent width within the sliding window is computed
  and returned alone with the x location for the window.  The spacing in
  x does not need to be precisely constant but should not vary by much
  across the window.

  The data are scanned from the specified starting and ending POINT numbers.
  This allows for x being double-valued with respect to the point index.

  The sliding aperture looks like:

     |----------------------|+++++X+++++|---------------------|
      ^                      ^     ^ center of window
      |                      edge of sliding window (hhw from center)
      +- edge of background window (bhw from center)

  A polynomial is fitted to the background points (-), default order is 1.
  This polynomial extrapolated across the "gap" (+).  This extrapolation
  is either divided into the window points (default), or subtracted (and
  and 1.0 is added back.  The sum of the window points multipled by the
  local dx is then the equivalent width of the signal in the window.

  This filter is designed for scanning normalized data (full intensity=1
  and no intensity=0).  The returned values of equivalent width are in
  the same units as x.

 CATEGORY:
  Numerical
 CALLING SEQUENCE:
  slidefil,x,y,bhw,hhw,start,stop,xout,ew
 INPUTS:
  x     - Independent vector (such as distance in km).
  y     - Data vector.
  bhw   - Half width (in units of x) of inner sliding window.
  hhw   - Half width (in units of x) of outer (background) window.
  start - Point number (not x) at start of scan
  stop  - Point number (not x) near end of scan (won't go past, may stop
             up to hhw-1 points early).

   If either start or stop are too close to the edge for a full window,
   the start and stop are adjusted inward as needed.

 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  DX       - This is the derivative of X.  If the length is not the same
                as X, or, if it is undefined, the derivative is computed
                and returned to the supplied argument.  If the length
                matches on the input, then this variable is assumed to
                be the derivative and not recomputed.  This can save
                significant CPU time on large vectors.
  FULLPLOT - Flag, enable full plotting of all data.
  NOPLOT   - Flag, supress all plots.
  ORDER    - Order of polynomial to fit to background (def=1)
  SILENT   - Flag, if true suppresses all printout to the IDL "console"
  SUBTRACT - Flag, if true - background is subtracted, otherwise background
               is ratioed.
  XUNITS   - String that describes the units of X (default=km)
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
  IDXOUT - point index number for output points.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  95/03/28 - Written by Marc W. Buie, Lowell Observatory

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


SLOPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	slope
 PURPOSE: (one line)
	Compute slope of a line using part of the data.
 DESCRIPTION:
	The left and right hand values are computed from the mean of the
	input data array from -width to +width about the mid-point of the
	bin.  The slope is derived from these means and the uncertainty
	comes from propagating the uncertainties.
 CATEGORY:
       Function fitting
 CALLING SEQUENCE:
	coeff=slope(a,b,width,x,y)
 INPUTS:
	a     - Mid-point of the left hand bin in units of x.
	b     - Mid-point of the right hand bin in units of x.
	width - Half-width of each bin.
	x     - Independant values of x-y relationship.
	y     - Dependant values to get slope from.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Return value is a vector, [slope,ds], which is the slope of the
	line from a to b and ds is the uncertainty on the slope.
 COMMON BLOCKS:
 SIDE EFFECTS:
	Left, right values and slope are printed to the screen.
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory.

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


SSGEOM

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  ssgeom
 PURPOSE: 
  Compute Sun and Earth distance and phase angle for solar system object.
 DESCRIPTION:
 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
  ssgeom,ephemeris,sun,earth,phang
 INPUTS:
  ephemeris - 8 by N array as returned from codes 20-22 of EPHEM
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  sun   - Object to Sun distance in AU.
  earth - Object to Earth distance in AU.
  phang - Sun - Object - Earth angle in degrees.
  elong - Object - Earth - Sun angle in degrees.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  93/10/28, Written by Marc W. Buie, Lowell Observatory
  94/08/05, MWB, fixed bug in calculation of ELONG

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


SSHIFT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sshift
 PURPOSE: (one line)
	Shift data using a damped sinc function for fractional part.
 DESCRIPTION:

	This function will shift an array of data pointed to by x and
	extending for n points.  The amount of the shift is given by shift.
	The result of the operation is placed at xp.  A shift that is within
	0.0001 of a whole number is treated to be that of the whole number.  If
	the shift is by an integral number of pixels then the shift involves
	reindexing the data, no interpolation is done.  If the shift is some
	non-integral amount then the data is resampled using a damped sinc
	function.

	The sense of the shift is as follows: think of the array plotted on a
	fixed scale.  A shift of 1 corresponds to shifting the data by one data
	point to the right relative to the fixed scale, ie. x[3]=xp[4].

	The data will fall off one end or another of the output vector as a
	result of the shift.  However, this is not as significant as the edge
	effect, the convolution is not complete for any data point within 10
	points of the edge, so those points cannot be trusted.  The missing
	points in the convolution are assumed to be equal to the end points.

 CATEGORY:
       Numerical
 CALLING SEQUENCE:
	xp = sshift(x,shift)
 INPUTS:
	x     - Input data array to be shifted.
	shift - Amount to shift (negative to left).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	Return value is the shifted array.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
	The input and output arrays cannot be the same.
 PROCEDURE:
 MODIFICATION HISTORY:
	Adapted from Zodiac routine: shiftc/sshift
	  Marc W. Buie, Lowell Observatory, 1992 October 2

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


SSHIFT2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    sshift2d
 PURPOSE: (one line)
    Shift a 2-D array using a damped sinc function for the fractional part.
 DESCRIPTION:

 CATEGORY:
    Mathematical
 CALLING SEQUENCE:
    result = sshift2d( array, shiftvec )
 INPUTS:
    array    : Array to be shifted.
    shiftvec : Vector of two elements: [ xshift, yshift ].
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    The shifted array is returned as the function value.
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    February, 1993:
    Copied from "sincshift.pro" written by John Spencer, Lowell Observatory.
    Very minor modifications by Doug Loucks, Lowell Observatory.

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


SSPOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  sspos
 PURPOSE: 
  Interactive program for generating solar system body ephemerides.
 DESCRIPTION:
  Interactive front-end for EPHEM.  Given object code (format described
    in EPHEM), this will compute positions and give local circumstances
    of the object.  Reads the current time from the system clock which
    may or may not be accurate.

  All output is printed on the screen.

 CATEGORY:
  Astronomy
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  TIME    - optional time [y,m,d,h,m,s] for positions
  AMCRIT  - Critical airmass for rise/set times.
  FILE    - Override on file name where observatory codes are to be found.
  OBSCODE - Integer Marsden code of the observatory, default 688 - Anderson Mesa
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  This procedure requires an external ephemeris computation engine that
    is accessed through pipe I/O.  It probably won't work away from Lowell
    Observatory unless you provide a compatible engine.
 PROCEDURE:
 MODIFICATION HISTORY:
  94/04/11 - Initial version written by Marc W. Buie, Lowell Observatory.
  95/05/03 - Added TIME keyword
  95/09/10 - Fixed bug that causes program to crash for objects that never
             rise or set
  96/12/27 - MWB, added interactive 'T' time set option.
  97/03/05 - MWB, added FILE and OBSCODE keywords

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


STARCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     starcat
 PURPOSE: (one line)
     Retreive coordinates from the star catalogs.
 DESCRIPTION:
 CATEGORY:
     Astronomy
 CALLING SEQUENCE:
     starcat,object,ra,dec
 INPUTS:
     object - String (array or scalar) of a standard Star name
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
     EPOCH   - JD of epoch to correct for proper motion to.
                 Default = catalog epoch.  (Scalar or vector).
     LAND1   - Optional file name for Landolt 1983 Standards Catalog
     LAND2   - Optional file name for Landolt 1992 Standards Catalog
     PRICAT  - Name of private star catalog file for X star catalog.
                 Default = 'private.cat'  in current directory.

     Only one of the following is allowed to be set.  If none are set,
        the coordinates will be returned in the equinox of the catalog.
     B1950   - Coordinates should be referred to equinox of B1950.
     J2000   - Coordinates should be referred to equinox of J2000.
     OFDATE  - Coordinates should be referred to equinox of date.
                 If selected, EPOCH must be provided.

 OUTPUTS:
     ra  - Right ascension in radians for object (scalar or vector).
     dec - Declination in radians for object (scalar or vector).
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


STARFIT

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

 PURPOSE:
	Single gaussian fit to a stellar image.

 DESCRIPTION:
 	Fit the equation y=f(i) where:

		X  = I MOD NX
		Y  = I / NX

		R  = SQRT( (X-A0)^2 + (Y-A1)^2 )

		Z  = R/A3

 		F(I) = A2*EXP(-Z^2/2) +
			A4 + A5*X + A6*Y + A7*X^2 + A8*Y^2

	Function parameters				Initial guess
       --------------------------------------------    --------------------
	A0  = X location of center of Pluto,		Maximum in image
	A1  = Y location of center of Pluto,		Maximum in image
	A2  = height of gaussian for Pluto,		Max - Min from image
	A3  = the 1/e width of the guassian,		GUESS
	A4  = Constant term for the background,		0
	A5  = Linear term in X for the background,	0
	A6  = Linear term in Y for the background,	0
	A7  = Quadratic term in X for the background,	0
	A8  = Quadratic term in Y for the background,	0

 CATEGORY:
	Function fitting

 CALLING SEQUENCE:
  starfit, image, guess, model, a, sigmaa

 INPUTS:
	image  - Input image to be fitted, must be 2-d.
	guess  - Input information for starting guess.
		  guess = estimate of the 1/e full width of the seeing.

 OUTPUTS:
	model  - The fitted model image is returned.
	a      - The final coefficient array.
	sigmaa - The uncertainties on the coefficients.

 OPTIONAL OUTPUT PARAMETERS:

 COMMON BLOCKS:
	starfit_com - contains the xwidth of the image.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Obs., 1993 January 13.

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


STARPROC

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

 PURPOSE:
  Collect and process final (standard) star photometry

 DESCRIPTION:
  This program processes the accumulated stellar photometry into final
    averages.  The data are generated by REDUCTOR and have been saved
    to the final output directory (set via PATH keyword).
    This program can reduce all stars in this directory or just one star.

  On starting the program, the contents of the photometry directory are
    scanned and a selection widget is presented.  You can either choose
    a single object by its name or choose the item "ALL".  If you do one
    object, it will be analyzed and plots of the data are provided.  If
    you choose ALL, each star in turn is analyzed but no plots are generated.

  The photometry for each star is examined and a mean for each color is
    found.  The mean comes from weighted average of all points.  After the
    mean is determined, the photometry is examined against the mean.  Any
    point found to be greater than 5 sigma from the mean is discarded and
    the mean is recalculated.  If plotted, these removed points will plot
    with a different symbol (filled circle with overlayed asterisk).  This
    point removal continues until no points are removed or 10 passes are
    made.

  The final uncertainty for the combined photometry is comes from taking the
    standard deviation of the data and dividing by the sqrt of the number
    of nights of data (NOT the number of points).  My assumption is that
    the errors tend to be systematic within a night but random from night
    to night.  Obviously, the photometry will not be particularly trustworthy
    until there are quite a few nights in the average.

  The final output file is a listing, one line per star, of the final averaged
    values.  Left to right, the values are:
  Name, B (mag, err, npoints, nights, chisq),
        V (mag, err, npoints, nights, chisq),
        R (mag, err, npoints, nights, chisq),
        B-V (color, err)
        V-R (color, err)

 CATEGORY:
  Photometry

 CALLING SEQUENCE:
  starproc[,PATH=path]

 INPUTS:
  This is an interactive program, there are no explicit inputs.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  PATH - Directory where the star data is located.  Default is
           /gryll/data1/buie/photometry/stars

 OUTPUTS:
  output is written to a file ALL.DAT in the stars directory.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/02/27, Written by Marc W. Buie, Lowell Observatory

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


STAR_FUN

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

 PURPOSE:
	Single 2-d gaussian image, support routine for STARFIT.

 DESCRIPTION:
	Evaluate the sum of one 2-d guassian and a 2-d 2nd order polynomial
	and optionally return the value of it's partial derivatives.

 	Evaluate the equation y=f(i) where:

		X  = I MOD NX
		Y  = I / NX

		R  = SQRT( (X-A0)^2 + (Y-A1)^2 )

		Z  = R/A3

 		F(I) = A2*EXP(-Z1^2/2) + A4

	Function parameters			     
       -------------------------------------------- 
	A0  = X location of center of Pluto,
	A1  = Y location of center of Pluto,
	A2  = height of gaussian for Pluto,
	A3  = the 1/e width of the guassian,
	A4  = Constant term for the background,

 CATEGORY
       Function fitting

 CALLING SEQUENCE:
	STARFIT_FUN,I,A,F[,PDER]

 INPUTS:
	I = Independent variable, actually, just an index into 2-d array.
	A = Parameters of equation described above.

 OPTIONAL KEYWORD PARAMETERS:
	XSIZE = width of image

 OUTPUTS:
	F = value of function at each F(I).

 OPTIONAL OUTPUT PARAMETERS:
	PDER = (N_ELEMENTS(I),9) array containing the
		partial derivatives.  P(I,J) = Derivative
		at Ith point w/respect to Jth parameter.
 COMMON BLOCKS:
	starfit_com - contains the x-width of the array stored in A
 SIDE EFFECTS:
	NONE.
 RESTRICTIONS:
	NONE.
 MODIFICATION HISTORY:
	Written by Marc W. Buie, Lowell Observatory, 1993 January 13

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


STATS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
   stats
 PURPOSE: (one line)
   Compute and print statistics plus plot histogram of data.
 DESCRIPTION:
   This computes basic statistical information regarding the input data and
   prints it to the screen.  It is intended for purely interactive work,
   use MOMENT if you want to save the results to a variable.
 CATEGORY:
   Numerical
 CALLING SEQUENCE:
   stats,data
 INPUTS:
   data - Input data (any rank, or type).
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  NBINS  - number of bins for histogram (default = 750)
  ROBO   - If set, compute robust statistics.
  SILENT - If set, supresses printed output to the screen
  TITLE  - Title for plot (default is blank)
  XTITLE - X-axis title for plot (default is 'Data Numbers')
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
  MEAN   - Optional return on mean of sample.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
    Written by Marc W. Buie, Lowell Observatory, 5/14/93
    MWB, 9/23/93, Added ROBO keyword
    MWB, 1/12/95, Added SILENT keyword
    MWB, 3/29/95, Augment plot to include mean and sigma annotation.
    MWB, 7/15/96, Added MEAN keyword

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


STDCHECK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  stdcheck
 PURPOSE:
  Determine if object is in a given standard catalog.
 DESCRIPTION:
 CATEGORY:
  Photometry
 CALLING SEQUENCE:
  stdcheck,file,names,filter,std
 INPUTS:
  file   - Name of catalog file to read.
  name   - Name of the stars.
  filter - Filter indicies for each name. (vector or (npts x n))
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  std    - Results of search (vector):
             0 - not listed in file
             1 - listed and is a good standard
             2 - listed and is flagged as a variable
             3 - listed and but is not good enough to be a standard.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/11/22, Written by Marc W. Buie, Lowell Observatory

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


STRB36

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  strb36
 PURPOSE:
  Convert an integer into a Base 36 formatted string.
 DESCRIPTION:

 CATEGORY:
  Utility
 CALLING SEQUENCE:
  str=strb36(val)
 INPUTS:
  val - Integer (byte, int, long) to be converted
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  return is the string
 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  98/03/16, Written by Marc W. Buie, Lowell Observatory

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


SUMANN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    sumann
 PURPOSE: (one line)
    Integrate over an annulus.
 DESCRIPTION:

 CATEGORY:
    CCD data processing
 CALLING SEQUENCE:
    Sumann, image, xcen, ycen, inradius, outradius, back, totweight, $
            possum, negsum, posxmom, negxmom, posymom, negymom

 INPUTS:
    image       : CCD image array.
    xcen,ycen   : Center of annulus.
    inradius    : Radius of inner circle.
    outradius   : Radius of outer circle.
    back        : Background to subtract from each pixel.

 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:

 OUTPUTS:
    totweight          : Area of annulus.
    possum, negsum     : Sums of positive and negative pixels.
    posxmom, negxmom   : Positive and negative x moments.
    posymom, negymom   : Positive and negative y moments.

 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.
    April, 1993. DWL. Replaced the inner FOR loop with vectors.
    98/09/21, MWB, optimizations
    98/09/29, MWB, fixed nasty bug introduced during optimization.

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


SYNSTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	synstar
 PURPOSE: (one line)
	Compute a synthetic (gaussian) star image.
 DESCRIPTION:
 CATEGORY:
	Mathematical
 CALLING SEQUENCE:
	image = synstar(nx,ny,x,y,flux,sig)
 INPUTS:
	nx   - X dimension of image.
	ny   - Y dimension of image.
	x    - X location(s) of synthetic star(s).
	y    - Y location(s) of synthetic star(s).
	flux - Integrated strength of star(s).
	sig  - 1/e half-width of star image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	return - nx by ny image containing star.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:

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


SYNSTAR2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	synstar2
 PURPOSE: (one line)
	Compute a synthetic (Lorentizian) star image.
 DESCRIPTION:
	This uses the functional form of a Lorentzian point-spread function
	as described in Bosh et. al., Icarus, 95, 319-324 (1992).
 CATEGORY:
       Astronomy
 CALLING SEQUENCE:
	image = synstar(nx,ny,x,y,flux,power,fwhm)
 INPUTS:
	nx   - X dimension of image.
	ny   - Y dimension of image.
	x    - X location(s) of synthetic star(s).
	y    - Y location(s) of synthetic star(s).
	flux - Integrated strength of star(s).
	power- Exponent for the r dependence (must be greater than 1)
	fwhm - Full Width at Half Maximum of stellar image.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
	return - nx by ny image containing star.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	92/11/05 - Written by Marc W. Buie, Lowell Observatory

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


TBLPARSE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  tblparse
 PURPOSE:
  Determine properties and problems from the table file with OSIRIS data
 DESCRIPTION:
  The beginning and ending spectra files for a group of spectra are determined
  for later processing.  Spectra which need a mate and have probably not been
  processed by xdspec are flagged.  Spectra sets that have inequal exposure
  are flagged as inhomogenous.
 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  tblparse,tbl,oblist,badset
 INPUTS:
  tbl - Structure containing the data from the table file
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  oblist - Array containing the beginning and ending filenames for each set of spectra as well
           as the flagged, mateless spectra.  It has the format:
           oblist[0,*] - Index for start of group
           oblist[1,*] - Index for end of group
           oblist[2,*] - Flag which if true indicates that the image is missing a mate.  One
                         missing mate may require redoing the full set.
  badset - The flag that indicates if there is one or more sets of spectra with inequal
           exposure times.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  98/06/10 - Written by Chris Dalla Piazza, Lycoming College; extracted from xdspec
  98/06/30, MWB, some logic cleanup on "deleted" spectra flags.

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


TOBACKSL

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  tobacksl
 PURPOSE:
  Convert forward slash (/) to backslash ($\backslash$) in string.
 DESCRIPTION:
 CATEGORY:
  Utility
 CALLING SEQUENCE:
  str=tobacksl(str)
 INPUTS:
  str - String to scan and convert
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  return value is a copy of the string with / converted to \\
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  96/01/21, Written by Marc W. Buie

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


TRANSF

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

 PURPOSE: (one line)
   Determine transformation coefficients from instrumental to standard mags.

 DESCRIPTION:

   This will take a set of all-sky standard star measurements and derive
     the best fitting set of transformation coefficients from instrumental
     to standard magnitudes.

   Normally, you give this routine ALL the data taken with a single filter.
     Only those objects that are standards in this filter and the alternate
     color will be used in the fit.  Only those that should be standards
     can end up marked as bad from this program.

   My conventions for the photometric fit are patterned after Hardie's
     nomenclature.  However, there is one additional term I've added which
     is a first order expansion term of extinction with respect to time.
     The basic formula for the transformation is:

       m0 = m - kX - n(t-t0)X - k"CX + eC + Z

        where
           m  = instrumental magnitude
           k  = extinction coefficient, mag/airmass
           X  = airmass
           n  = coefficient of the 1st order expansion of extinction as a
                  function of time
           t  = Time of observation (in hours)
           t0 = Reference time for n, time dependent correction is zero at
                  this time, usually is the middle of the observation set.
           k" = second order extinction coefficient
           C  = Standard system color of the object
           e  = color term
           Z  = zero point
           m0 = Standard magnitude

   The fitting process takes advantage of the uncertainties on the instrumental
     magnitude and the uncertainties on the forced terms.  The uncertainties
     on the catalog standard magnitudes are ignored.  The coefficients, k",
     e, and n are considered to be auxillary coefficients and can be either
     fit for or forced.  k" and e can be forced to explicit values.  n is
     either fit for or set to 0.  The extinction and zero-point are always
     fit for.

 CATEGORY:
   Photometry

 CALLING SEQUENCE:
  transf,names,jd,filter,color1,color2,airm,mag,err,bad,
    [ RESID=resid,FILE=landfile,NOPLOT=noplot,OTHER=other,
      OLAB=olab,TITLE=title ]

 INPUTS:
  names  - String array of standard names.
  jd     - Julian date of observations.
  filter - Filter number of data. (0-U, 1-B, 2-V, 3-R, 4-I)
  color1 - First filter for color.
  color2 - Second filter for color.  (eg., B-V is 1,2)
  airm   - Vector of airmasses for observations.
  mag    - Vector of instrumental magnitudes.
  err    - Vector of uncertainties.
  bad    - Vector of flags, 0=good, 1=bad, default is good

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

  These keywords affect how the fit is done.

  CTERM  - Optional, fixed color term.  If provided, the color term is
              assumed, not fitted.
  K2     - Second order extinction coefficient.  If provided, this term
              is assumed, not fitted.
  KTIME  - Flag, enable time dependent extinction.

 -------------------

  These keywords affect the plotting output

  NOPLOT   - Flag, if true inhibits the summary plots.
  OLAB     - Label for the plot of residuals vs. OTHER.
  OTHER    - If provided, allows plotting the residuals against some other
              variable, eg., exposure time.  Must match the length of
              the data input vectors.

 -------------------

  Other control options

  FILE     - Optional name for the Landolt "system" Standards catalog.
  NOEDIT   - Flag, if set inhibits final interactive editing of fitted points.
             This keyword has no effect and is not necessary if the current
             plotting device is 'PS'.
  RESID    - Flag, if true enables printing a full residual table.
  TITLE    - Title for plots.
  NOFILES  - Flag, if true supresses saving information to summary files.
  CHISCALE -Flag, if true rescales final solution to force reduced Chi=1.0
  TAGDATE  -String identifying date of data.
  TAGINST  -String identifying instrument.
  HISTFILE -File name of history file to update extintion values in.
             Only one line for TAGDATE/TAGINST is allowed.  If a duplicate
             is found, the appropriate line is replaced.
  MAGRESID - Edit bad values by mag residual, not sigma residuals

 OUTPUTS:
  No explicit vector outputs.  All output is graphical, printed to the
    screen, or saved to external files.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:
  None

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  93/08/05, Initial version completed, Marc W. Buie, Lowell Observatory.
  93/10/05, MWB, added support for 1993 catalog.
  95/02/22, MWB, modified plots.
  96/10/16, MWB, added summary save to file, NOFILES, CHISCALE, TAG*, and
                   HISTFILE keywords actions added.
  96/11/22, MWB, changed to new master photometry catalog
  97/01/24, MWB, added MAGRESID flag
  97/2/7, MWB, massive rewrite

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


TVMAPS

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  tvmaps
 PURPOSE:
  Display a full set of Pluto/Charon model .til maps on the current display.
 DESCRIPTION:
 CATEGORY:
  Miscellaneous
 CALLING SEQUENCE:
 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/tvmaps.pro)


TVTIL

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  tvtil
 PURPOSE: 
  Display a Pluto/Charon .til map as an image on the current display.
 DESCRIPTION:
 CATEGORY:
  Miscellaneous
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Sep 1991, Written by Marc W. Buie, Lowell Observatory

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


VIEWTEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    viewtext
 PURPOSE: (one line)
    View a string, or string array, of text in a scrollable text widget.
 DESCRIPTION:

 CATEGORY:
    Widgets
 CALLING SEQUENCE:
    viewtext, text [, KEYWORDS]
 INPUTS:
    text : String (scalar, 1-D or 2-D array) of text to be displayed.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD PARAMETERS:
    EXIT   = Label for exit button.  Default is 'Dismiss'.
    FONT   = Font to use for the text.  Default is '8x13'.
    GROUP  = Group Leader.
    TITLE  = Title of widget.
    XSIZE  = Width of text.  Default is 80 characters.
    YSIZE  = Length of text.  Default is 40 lines.
 OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
    Written by Doug Loucks, Lowell Observatory, May, 1993.
    1/7/94, DWL, Added Hardcopy button.
    8/25/94, DWL, Minor mods.
    96/07/02, MWB, changed YSIZE default to 40 lines.

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


WEDGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  wedge
 PURPOSE: 
  Compute and return a gray scale step wedge.
 DESCRIPTION:
 CATEGORY:
  Image display
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
 Oct 1991, Written by Marc W. Buie, Lowell Observatory

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


WRBOPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  wrbophot
 PURPOSE: (one line)
  Write a simple photometry data file.
 DESCRIPTION:

   File format: (one blank separates each field)

      JD-2450000 of observation (UT) F10.5   Julian date of the observation.

      Observed Magnitude . . . . . . F7.4    Observed magnitude

      Uncertainty (sigma)  . . . . . F6.4    Error bar for observation.

      Source . . . . . . . . . . . . A45     Free format field to reference
                                             the observer and the telescope
                                             used for the observation.
      This last field is left blank by this program.

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  wrbophot,jd,mag,err,file
 INPUTS:
  jd     - Julian date of observation (double precision).
  mag    - Observed magnitude.
  err    - Uncertainty on the observed magnitude.
  file   - String with name of file to save photometry to.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  APPEND - if set appends data to the named file.
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, 1996 Aug 24

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


WRCALIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  wrcalir
 PURPOSE:
  Write calibration information for OSIRIS XD data to a calib file.
 DESCRIPTION:

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  wrcalir,calib,calibfile
 INPUTS:
  calib - anonymous structure with calibration information (see LDCALIR)
  calibfile - Name of file to write calibration information
                 (default=files.cal)
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  97/12/4, Written by Marc W. Buie, Lowell Observatory

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


WRMATCH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     wrmatch
 PURPOSE: (one line)
     Write a standard name --- non-standard name correspondence file.
 DESCRIPTION:

     This program writes a file which contains a list of matches between
     informal and imprecise object names (typically from FITS headers)
     and formal, well-defined object names to be used by EPHEM.

     The file format has one pair of strings per line.
     The first token (or word) in the line is taken to be the standard
     object name.  Since this name is not allowed to contain spaces,
     the first space on the line signals the end of the standard name.
     All characters (spaces included) following this name are ignored up
     to the first ' character in the line.  All characters (including
     spaces) following the quote character up to the end of the line are
     taken to be the non-standard name.

     The input string pairs are printed to the requested file.

 CATEGORY:
     File I/O
 CALLING SEQUENCE:
     wrmatch,proper,informal,file
 INPUTS:
     proper   - String array of proper ephemeris names.
     informal - String array of informal object names.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
 OUTPUTS:
     file - String containing file name to write.
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
     3/25/93 - Written by Marc W. Buie, Lowell Observatory.

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


WROBLIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  wroblist
 PURPOSE:
  Write an object list to a file.
 DESCRIPTION:

 CATEGORY:
  Astrometry
 CALLING SEQUENCE:
  wrobjlist,file,filelist,offset,pos,flags
 INPUTS:
  file - String of file name to be written to.
 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:
  filelist - string array of file names for this object list.
  offset   - 2*(nfiles-1) element vector [x,y offset (B-A), x,y offset (C-A), ...]
  pos      - [2*nfiles,nobj] element vector, each row is set of positions [x1,y1,x2,y2,x3,y3]
  flags    - nobj element vector of flags either ?, y, or n.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
  1998/11/3, Written by Marc W. Buie, Lowell Observatory

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


WRPHOCAT

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

 PURPOSE:
  Write a photometry standard catalog file.

 DESCRIPTION:

 CATEGORY:
  File I/O

 CALLING SEQUENCE:
  wrphocat,file,name,mags,codes,filname

 INPUTS:
  file   - Name of catalog file to write.
  name   - Name of the stars.
  mags   - Stellar magnitudes  (nfil x npts)
  codes  - Quality codes:      (nfil x npts)
            0 - not enough measurements for use as a quality standard.
            1 - good to use as standard
            2 - Known or suspected variable, don't ever use.
  filname- Filter names (string array)

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

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

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


WRPHOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  wrphot
 PURPOSE: (one line)
  Write a standard raw photometry data file (Pluto format).
 DESCRIPTION:
  This creates a .001 format Pluto-Charon format file from the input
    photometry.  As a suggestion, use .000 as a suffix if these are NOT
    standard magnitudes (such as differential to some star), and use
    .001 if they are magnitudes on a standard system.

      File format: (one blank separates each field)

         Orbit Flag . . . . . . . . . . I1      1 -> Search for new orbital
                                                     elements that most
            This is a flag to the program            closely match the time
            PLEPH that controls which set            of observation.
            of orbital elements to use          0 -> Use the same set of
            for the Pluto ephemeris.                 orbital elements as used
                                                     for the previous point.
        This is always set to zero in the output from this program.

         JD of observation (UT) . . . . F13.5   Julian date of the observation.

         Filter ID  . . . . . . . . . . A2      Two character id of the filter
                                                used for the observation.
                                                Consult the filter documentation
                                                to get the ID's that are
                                                currently in use.
        Only the first two characters of the filter field are saved to the file.

         Observed Magnitude . . . . . . F7.4    Observed magnitude reduced to
                                                some standard system.  The
                                                filter ID must reflect this
                                                system.

         Uncertainty (sigma)  . . . . . F6.4    Error bar for observation.

         Source . . . . . . . . . . . . A45     Free format field to reference
                                                the observer and the telescope
                                                used for the observation.
        This is left blank by this program.

 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  wrphot,jd,filter,mag,err,file
 INPUTS:
  jd     - Julian date of observation (double precision).
  filter - String array of filter names.
  mag    - Observed magnitude.
  err    - Uncertainty on the observed magnitude.
  file   - String with name of file to save photometry to.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  APPEND - if set appends data to the named file.
  BAD    - if supplied, must be a vector of flags, 0=good, 1=bad
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 1993 Jun 26
  96/11/03, MWB, added BAD input

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


WRTBL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  wrtbl
 PURPOSE:
  Update the table file of a night's OSIRIS data
 DESCRIPTION:
 CATEGORY:
  File I/O
 CALLING SEQUENCE:
  wrtbl,tablname,tbl
 INPUTS:
  tablname - Table file to be updated
  tbl      - Structure containing the updated table information
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  98/06/10 - Written by Chris Dalla Piazza, Lycoming College; extracted from
             xdspec

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


XDAVG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  xdavg
 PURPOSE:
  Interactive tool for combining and correcting OSIRIS XD spectra.
 DESCRIPTION:

  This program handles the removal of instrumental defects from OSIRIS XD
    spectra.  This is accomplished through the removal of bad points in the
    data from bad pixels on the NICMOS chip, applying slope corrections to the
    spectra to remove the effects of wavelength dependent vignetting, and the
    exclusion of bad spectra from the averaging process.

 CATEGORY:
  Spectroscopy
 CALLING SEQUENCE:
  xdavg
 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:

 OUTPUTS:

  Spectra selected in the tool are displayed in cw_osipl.  The final products
    consist of the individual corrected spectra and their averages.  These
    spectra have had all the badflag editting done, primary slope correction
    applied to make them consistent within a set, all the bad spectra excluded,
    and have had the secondary slope correction applied relative to some
    reference.  A preliminary amount of ratioing is also done in which these
    corrected spectra are ratioed against either one other corrected average or
    an airmass corrected denominator interpolated between two of these
    corrected averages.  Each individual ratio is saved as well as the average
    of the set.  The badflags for each spectrum are also saved.

  File format for each type is:

    Individual corrected spectra - Spec/yymmddc.### where ### is the index
                                   number of the spectrum.  These have both
                                   the primary and secondary slope corrections
                                   applied but the flux in the file is still
                                   in units of [counts].

    Average corrected spectra - Corr/yymmdda.## where ## is the set number of
                                the average.  These are weighted set averages
                                and the "flux" values are all in counts/sec.

    Individual ratio spectra - Ratio/yymmddr.### where ### is the index number
                               of the spectrum.

    Average ratio spectra - Ratio/yymmdda.## where ## is the set number of the
                            average.

    Badflags have the same file format as their corresponding parents and are
      in the same directory except they are "b." files instead.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

  At present, you cannot remove all spectra in a set (flag with X) with
    this tool.  You must edit the .tbl file by hand in this case.

 PROCEDURE:

  This program begins by loading the information regarding the nights worth of
    data by loading the table and calibration files from whichever directory
    that has been selected.  Next, the user can select to display whichever
    spectra that help in the process of removing the instrumental defects and
    edit them accordingly.  The primary slope correction is applied
    automatically to the spectra.  Spectra may also be excluded from the
    averages by means of either an x or s flag.

  The bulk of the editting of this type should be accomplished before moving on
    to making ratios with the bottom part of the tool and applying the
    secondary slope correction manually.  You begin by selecting one numerator
    as the reference denominator and then getting the night consistent by
    applying the secondary slope correction to various ratios.  Moving the an
    object into the denominator is also the point at which the various product
    spectra are saved to disk.

  Instance structure locations
     state  - First child of XDAVG
                 Contains all widget ids.

     tbl     - UVALUE of state.cwdid (current working directory)
                 Contains the contents of the observation summary table as
                 generated by XDSPEC.  Also has derived information about
                 groups of observations.

     calib   - UVALUE of state.tblnameid (name of current table file).
                 This is the calibration structure as read in by ldcalir

     oblist  - UVALUE of state.tblnsetid

     spec    - UVALUE of state.butspecid (Structure containing the various
                 levels of processed spectra as well as flags indicating how
                 far each has been processed).

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


XDSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  xdspec
 PURPOSE:
  End-to-end reduction tool for OSIRIS XD spectral data.
 DESCRIPTION:

  This program handles all steps of processing raw OSIRIS XD spectral data
    to create final averaged output spectra.  This will work quite well for
    data on single point sources.  If the objects are extended or if there
    are more than one object, you need to do the reductions by hand.

 CATEGORY:
  Spectroscopy

 CALLING SEQUENCE:
  xdspec

 INPUTS:

 OPTIONAL INPUT PARAMETERS:

 KEYWORD INPUT PARAMETERS:
  Unless otherwise indicated, these options are all flags.

  ABSPOSCAL  - Run through the absolute position calibration step.

  ADDPATH    - String of directory name to prepend to the DIRLIST for a
                  location to look for the raw data.  The same restriction
                  applies to this as to DIRLIST.

  ALLCAL     - Run through all the calibration steps.

  ALLSPEC    - (Re)compute all spectral extractions.

  AVGSPEC    - Force (re)computation of final average spectra.

  DIRLIST    - String array list of directories for where to search for
                  raw data.  Do NOT include the final directory that is
                  the same as the current directory and the root of the
                  raw data files.

  FINAL      - Enable final spectral extraction, this step combines any
                  bad pixel masks and creates final mask (if not already
                  present) and then extracts all spectra.

  FLUSH_INFO - Flush all remembered information.

  GAUSSCOR- Correction factor from the directly computed image FWHM (per order)
               See OPTSPEC for a more detailed explanation.

  GROUPCHECK - Flag, generate a summary plot of all spectra against their
                  group leader.

  MASKTHRESH - When using a final mask image, you can adjust the mask
                  threshold with this keyword.  The mask image records the
                  fraction of the time that a given pixel is recorded as
                  being "bad".  This fraction varies between 0.0 and 1.0.
                  The default is to mark pixels bad that are seen to be bad
                  more than 4% of the time.  In other words, MASKTHRESH=0.04
                  is the default.

  NOSPEC     - Inhibit any spectral extraction processing.

  PLOTRANGE  - Two element vector, [start,stop], frame numbers to generate
                  postscript plots for.

  PLOTS      - How many and how much to plot.  (only for optspec plots)
                  0 - All plots generated.
                  1 - No plots at all.
                  2 - Show strip image, average profile, order profiles (default)

  QUEUE      - (String) Print queue to send postscript plots to.  If this
                  is not provided, then the idl.ps file is not spooled to
                  a printer and is left behind when xdspec finishes.  If you
                  give a queue name, the idl.ps file is deleted after the
                  file is spooled for printing.

  RELPOSCAL  - Run through the relative position calibration step.

  SLOPECAL   - Run through centerline slope calibration step.

  WAVECAL    - Run the wavelength calibration steps on each order.

 OUTPUTS:

  All output is either to the various plot screens or to files.

 KEYWORD OUTPUT PARAMETERS:

 COMMON BLOCKS:
  COM_XDSPEC - Used to store information from one invocation of xdspec to
                 the next.

 SIDE EFFECTS:

 RESTRICTIONS:

  If you use an 's' flag to eliminate an image and its spectrum from the
    output products, you will not necessarily get this image as a mate in
    cases where you might like it.  You will almost always need to tweak
    the mate in the .tbl file by hand in these cases.

 PROCEDURE:

  This program assumes (and requires) that the current directory is NOT where
    the raw frames are to be found.  The raw frames are in some other location
    and have no other files with them.  This allows you to have the raw data
    in a location where you do not have write permission (ie., CDROM).  All
    of the resulting files from running xdspec are written to the current
    directory and directories beneath there.

  Also, for simplicity of bookkeeping, I have assumed that the root of the
    raw data file names is the same as the directory where you are running
    xdspec and where the data live.  For example:
       Data files of the form:   980115.001
       Current directory:     /usr/results/980115/
       Data directory:        /usr/data/980115/
    In this case '/usr/data' should be in the DIRLIST or added with ADDPATH
    (if it isn't already present).

  If there are no flat field calibration frames on this night, you must use
    calibration specifications and flat fields from another night in that
    run.  In this case, as you start XDSPEC you get a flat field selection
    popup window.  Use this tool to browse through other nights until you
    find an appropriate calibration file.  In selecting the flat you are
    actually selecting that flat and its associated files.cal specification
    file.  In this case you probably shouldn't fiddle with _anything_ in
    the files.cal and if the original ever changes, you should probably start
    all over from scratch on any other nights that use the same stuff.
    You _can_ re-run the wavelength calibration steps in this case but it's
    probably not a good idea.  Once you select the flat field, processing
    continues and there's very little that needs to be done on the calibration
    steps (actually nothing at all).

  During the wavelength calibration steps, here are the mouse operation
   options:          (1st:sky spectrum)                 (2nd:synthetic)
          left      measure nearest line           grab nearest strong line
          middle    delete nearest point                   nothing
          right           done                         abort this line

  Here's the typical "flow" of running this program:
   xdspec        <-- Initial call, sets up calibration information, and
                        extracts initial spectra.  Run this as many times
                        as needed to get a complete set of initial spectra.

   xdspec,plotrange=[1,NNN],queue='printer name'
                     this will generate the summary plots for all the
                     spectra.  Do only when all are done.  You then review
                     the plots with an eye toward spectra that should be
                     removed from the averages.  You mark one to be skipped
                     by replacing the second column flag character
                     by an 'x' (to exclude).  After all have
                     been marked, proceed to the next step ...

   xdspec,/final  <-- Final processing, combines bad pixel maps, reextracts
                      the spectra and generates final averages.  You are done
                      with this program at this point.

   Note, you can ignore any spectrum in the tbl file by marking it with an
     'x' in the second column in the table.  It will do no good to delete the
     line from the table as the line will come back.  'x' marks it to be
     ignored.  If any extraction/reduction products exist for such a spectrum
     they will be deleted.

 MODIFICATION HISTORY:
  97/12/11, Written by Marc W. Buie, Lowell Observatory
  98/03/09, MWB, cleaned up logic needed when data are added to raw directory.
  98/04/01, MWB, added some generalization items, and ADDPATH, DIRLIST
  98/06, MWB, numerous changes to incorporate a numerical image profile for
            the optimal extraction on the FINAL pass.  Also added support
            for those cases where more than one data directory can be found.
  98/06/30, MWB, added user selection if data could be found in more than one
            directory.  Also, some logic was cleaned up that dealt with
            spectra marked to be ignored.
  98/08/25, MWB, changed the default plotting option, PLOTS=2 so that only
            three windows are automatically created and used.
  98/09/17, MWB, fixed a minor bookkeeping problem with 's' flagged frames.
            The output files from these frames were still hanging around and
            this has been changed so the output products are deleted.

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


XORACLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	xoracle
 PURPOSE:
	Display ``oracle'' animation image sequences.
 CATEGORY:
	Widgets
 CALLING SEQUENCE:
	XORACLE,frame_1,frame_2
 INPUTS:
       frame_1 - Animation sequence frame number to start with.
       frame_2 - Animation sequence frame number to end with.
 OPTIONAL INPUT PARAMETERS:
       IMDELTA - interval between loaded images (default = 1)
 KEYWORD PARAMETERS:
	GROUP = The widget ID of the widget that calls Xoracle.  When this
		ID is specified, a death of the caller results in a death of
		Xoracle
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
	Initiates the XManager if it is not already running.
 RESTRICTIONS:
 PROCEDURE:
  Read a sequence of oracle animation files in byte format and animate.
 MODIFICATION HISTORY:
	Created 12/18/91 by: Marc Buie, Lowell Observatory

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


XRUNPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	xrunplot
 PURPOSE:
	Display a complete graphical summary of ``plutomem'' output logs.
 CATEGORY:
	Widgets
 CALLING SEQUENCE:
	XRUNPLOT
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
	GROUP = The widget ID of the widget that calls Xrunplot.  When this
		ID is specified, a death of the caller results in a death of
		Xrunplot
 OUTPUTS:
 OPTIONAL OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
	Initiates the XManager if it is not already running.
 RESTRICTIONS:
 PROCEDURE:
	Create and register the widget and then exit.
 MODIFICATION HISTORY:
	Written by Marc Buie, 1991 Dec 12

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


ZPLOT

[Previous Routine] [List of Routines]
 NAME: 
  zplot
 PURPOSE:
  Plot differential refraction as a function of wavelength.
 DESCRIPTION:
 CATEGORY:
  2-D plotting
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  1991 - Written by Marc W. Buie, Lowell Observatory

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