RSI IDL 5.2 Procedures 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:15:47 2000.

List of Routines


Routine Descriptions

AMOEBA

[Next Routine] [List of Routines]
 NAME:
	AMOEBA

 PURPOSE:
	Multidimensional minimization of a function FUNC(X), where
	X is an N-dimensional vector, using the downhill simplex
	method of Nelder and Mead, 1965, Computer Journal, Vol 7, pp 308-313.

	This routine is based on the AMOEBA routine, Numerical
	Recipes in C: The Art of Scientific Computing (Second Edition), Page
	411, and is used by permission.

 CATEGORY:
	Function minimization/maximization. Simplex method.

 CALLING SEQUENCE:
	Result = AMOEBA(Ftol, ....)
 INPUTS:
    FTOL:  the fractional tolerance to be achieved in the function
	value.  e.g. the fractional decrease in the function value in the
	terminating step.  This should never be less than the
	machine's single or double precision.
 KEYWORD PARAMETERS:
    FUNCTION_NAME: a string containing the name of the function to
	be minimized.  If omitted, the function FUNC is minimized.
	This function must accept an Ndim vector as its only parameter and
	return a scalar single or double precision floating point value as its
	result. 
    FUNCTION_VALUE: (output) on exit, an Ndim+1 element vector
	containing the function values at the simplex points.  The first
	element contains the function minimum. 
    NCALLS: (output) the of times the function was evaluated. 
    NMAX: the maximum number of function evaluations allowed
	before terminating.  Default = 5000.
    P0: Initial starting point, an Ndim element vector.  The starting
	point must be specified using either the keyword SIMPLEX, or P0 and
	SCALE.  P0 may be either single or double precision floating.
	For example, in a 3-dimensional problem, if the initial guess
	is the point [0,0,0], and it is known that the function's
	minimum value occurs in the interval: -10 <
	X(0) < 10, -100 < X(1) < 100, -200 < X(2) < 200, specify: P0=[0,0,0],
	SCALE=[10, 100, 200]. 
    SCALE: a scalar or Ndim element vector contaiing the problem's
	characteristic length scale for each dimension.
	SCALE is used with P0 to form an initial (Ndim+1) point simplex.
	If all dimensions have the same	scale, specify a scalar.
    SIMPLEX: (output and/or optional input) On input, if P0 and SCALE
	are not set, SIMPLEX contains the Ndim+1 vertices, each of
	Ndim elements, of starting simplex, in either single or double
	precision floating point, in an (Ndim, Ndim+1) array. On output,
	SIMPLEX contains the simplex, of dimensions (Ndim, Ndim+1), enclosing
	the function minimum.  The first point, Simplex(*,0), corresponds to
	the function's minimum.

 OUTPUTS:
   Result: If the minimum is found, an Ndim vector, corresponding to
	the Function's minimum value is returned.  If a function minimum
	within the given tolerance, is NOT found in the given number of
	evaluations, a scalar value of -1 is returned.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 PROCEDURE:
	This procedure implements the Simplex method, described in
	Numerical Recipes, Section 10.4.  See also the POWELL procedure.

	Advantages:  requires only function evaluations, not
	derivatives, may be more reliable than the POWELL method.
	Disadvantages: not as efficient as Powell's method, and usually
	requires more function evaluations.

	Results are performed in the mode (single or double precision)
	returned by the user-supplied function.  The mode of the inputs P0,
	SCALE, or SIMPLEX, should match that returned by the function. The
	mode of the input vector supplied to the user-written function, is
	determined by P0, SCALE, or SIMPLEX.

 EXAMPLE:
	Use Amoeba to find the slope and intercept of a straight line fitting
	a given set of points minimizing the maximum error:

	The function to be minimized returns the maximum error,
	given p(0) = intercept, and p(1) = slope:
 FUNCTION FUNC, p
 COMMON FUNC_XY, x, y
 RETURN, MAX(ABS(y - (p(0) + p(1) * x)))
 END

	Put the data points into a common block so they are accessible to the
	function: 
 COMMON FUNC_XY, x, y
	Define the data points:
   x = findgen(17)*5
   y = [ 12.0,  24.3,  39.6,  51.0,  66.5,  78.4,  92.7, 107.8, 120.0, $
        135.5, 147.5, 161.0, 175.4, 187.4, 202.5, 215.4, 229.9]

	Call the function.  Fractional tolerance = 1 part in 10^5, 
	Initial guess = [0,0], and the minimum should be found within
	a distance of 100 of that point: 
   r = AMOEBA(1.0e-5, SCALE=1.0e2, P0 = [0, 0], FUNCTION_VALUE=fval)

	Check for convergence:
   if n_elements(r) eq 1 then message,'AMOEBA failed to converge'
	Print results.
   print, 'Intercept, Slope:', r, 'Function value (max error): ', fval(0)
Intercept, Slope:      11.4100      2.72800
Function value:       1.33000

 MODIFICATION HISTORY:
	DMS, May, 1996.	Written.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/amoeba.pro)


ANNOTATE

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

 PURPOSE:
	This procedure is a general purpose drawing program/widget to
	annotate displays. Drawing objects include text, lines, arrows,
	polygons, rectangles, circles, and ellipses.

 CATEGORY:
	Widgets.  Will also work with plain windows.

 CALLING SEQUENCE:
	ANNOTATE

 INPUTS:
	No required inputs.

 KEYWORD PARAMETERS:
	COLOR_INDICES:	an array of color indices from which the user
			can choose colors. For example, to allow the user
			to choose 10 colors, spread evenly over the
			available indices, set the keyword as folows:
			COLOR_INDICES = INDGEN(10) * (!D.N_COLORS-1) / 9
	DRAWABLE:	the widget ID of the draw widget for the annotations.
			This is mutually exclusive with WINDOW.
	LOAD_FILE:	the name of an annotation format file to load after
			initialization.
	TEK_COLORS:	if set, the Tektronix color table is loaded
			starting at color index TEK_COLORS(0), with
			TEK_COLORS(1) color indices. The Tektronix color
			table contains up to 32 distinct colors suitable
			for graphics.
	WINDOW:		the window index number of the window to receive the
			annotations.

 OUTPUTS:
	This procedure has no explicit outputs. Menu choices exist to
	write TIFF, GIF, or PostScript bitmap files. Encapsulated
	or standalone PostScript files may also be created.

 SIDE EFFECTS:
	Annotations are made in the designated window or draw widget.

 RESTRICTIONS:
	This is a simple drawing program.

 PROCEDURE:
	If neither TEK_COLORS or COLOR_INDICES are specified, the default
	is to load 10 colors, evenly distributed over those available.

	If neither WINDOW or DRAWABLE are specified, the current window
	is used.

 EXAMPLE:
	TVSCL, HANNING(300,200)	;Output an image in the current window
	ANNOTATE		;Annotate it

 MODIFICATION HISTORY:
	DMS, RSI, July, 1993.  Original version.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/annotate.pro)


ARROW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:				ARROW
 PURPOSE:	Draw a vector(s) with an arrow head
 CATEGORY:	Graphics
 CALLING SEQUENCE:
	ARROW, x0, y0, x1, y1
 INPUTS:
	(x0, y0) = coordinates of beginning of vector(s).  May be arrays
		or scalars. Coordinates are in DEVICE coordinates
		unless otherwise specified.
	(x1, y1) = coordinates of endpoint (head) of vector.  
		x0, y0, x1, y1 must all have the same number of elements.
 KEYWORD PARAMETERS:
	DATA - if set, implies that coordinates are in data coords.
	NORMALIZED - if set, coordinates are specified in normalized coords.
	HSIZE = size of arrowhead.  Default = 1/64th the width of the device,
		(!D.X_SIZE / 64.).
		If the size is positive, it is assumed to be in device
		coordinate units.  If it is NEGATIVE, then the head length
		is set to the vector length * abs(hsize), giving heads
		proportional in size to the bodies.  The size is defined as
		the length of each of the lines (separated by 60 degrees) 
		that make the head.
	COLOR = drawing color.  Default = highest color index.
	HTHICK = thickness of heads.  Default = 1.0.
	SOLID = if set, make a solid arrow, using polygon fills, looks better
		for thick arrows.
	THICK = thickness of body.    Default = 1.0.
	
 OUTPUTS:
	No explicit outputs.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
	Straightforward.
	Examples:
  		Draw an arrow from (100,150) to (300,350) in DEVICE units.
	ARROW, 100, 150,  300, 350

		Draw a sine wave with arrows from the line Y=0 to
		sin(x/4).
	X = FINDGEN(50)
	Y = SIN(x/4)		;Make sin wave
	PLOT, X, Y
	ARROW, X, REPLICATE(0,50), X, Y, /DATA
 MODIFICATION HISTORY:
	DMS, Feb, 1992.
	DMS, Sept, 1992.  Added /SOLID.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/arrow.pro)


ASCII_TEMPLATE

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

 PURPOSE:
       Generate a template that defines an ASCII file format.

 CATEGORY:
       Input/Output.

 CALLING SEQUENCE:
       template = ASCII_TEMPLATE( [file] )

 INPUTS:
       file              - Name of file to base the template on.
                           Default = use DIALOG_PICKFILE to get the file.

 INPUT KEYWORD PARAMETERS:
       browse_lines      - Number of lines to read in at a time via the
                           GUI's browse button.  Default = 50.

 OUTPUT KEYWORD PARAMETERS:
       cancel            - Boolean indicating if the user canceled
                           out of the interface (1B = canceled).

 OUTPUTS:
       The function returns a template (structure) defining ASCII files
       of the input file's format.  Such templates may be used as inputs
       to function READ_ASCII.  (0 is returned if the user canceled.)

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       See DESCRIPTION.

 DESCRIPTION:
       This routine presents a graphical user interface (GUI) that assists
       the user in defining a template.

       ASCII files handled by this routine consist of an optional header
       of a fixed number of lines, followed by columnar data.  Files may
       also contain comments, which exist between a user-specified comment
       string and the corresponding end-of-line.

       One or more rows of data constitute a "record."  Each data element
       within a record is considered to be in a different column, or "field."
       Adjacent fields may be "grouped" into multi-column fields.
       The data in one field must be of, or promotable to, a single
       type (e.g., FLOAT).

 EXAMPLES:
       ; Generating a template to be used later, maybe on a set of files.
       template = ASCII_TEMPLATE()

       ; Same as above, but immediately specifying which file to use.
       template = ASCII_TEMPLATE(file)

       ; Same as above, but returning flag if the user canceled.
       template = ASCII_TEMPLATE(file, CANCEL=cancel)

       ; Generating and using a template in place for reading data.
       data = READ_ASCII(file, TEMPLATE=ASCII_TEMPLATE(file))

 DEVELOPMENT NOTES:
       - see ???,!!!,xxx in the code
       - errors preserving state when switch pages with 'back/next'
       - make NaN default missing value as in reader ?

 MODIFICATION HISTORY:
       AL & RPM, 8/96 - Written.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/ascii_template.pro)


A_CORRELATE

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

 PURPOSE:
       This function computes the autocorrelation Px(L) or autocovariance
       Rx(L) of a sample population X as a function of the lag (L).

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = A_correlate(X, Lag)

 INPUTS:
       X:    An n-element vector of type integer, float or double.

     LAG:    A scalar or n-element vector, in the interval [-(n-2), (n-2)],
             of type integer that specifies the absolute distance(s) between 
             indexed elements of X.

 KEYWORD PARAMETERS:
       COVARIANCE:    If set to a non-zero value, the sample autocovariance
                      is computed.

       DOUBLE:        If set to a non-zero value, computations are done in
                      double precision arithmetic.

 EXAMPLE
       Define an n-element sample population.
         x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57]

       Compute the autocorrelation of X for LAG = -3, 0, 1, 3, 4, 8
         lag = [-3, 0, 1, 3, 4, 8]
         result = a_correlate(x, lag)

       The result should be:
         [0.0146185, 1.00000, 0.810879, 0.0146185, -0.325279, -0.151684]

 PROCEDURE:
       See computational formula published in IDL manual.

 REFERENCE:
       INTRODUCTION TO STATISTICAL TIME SERIES
       Wayne A. Fuller
       ISBN 0-471-28715-6

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, October 1994
       Modified:    GGS, RSI, August 1995
                    Corrected a condition which excluded the last term of the
                    time-series.
       Modified:    GGS, RSI, April 1996
                    Simplified AUTO_COV function. Added DOUBLE keyword.
                    Modified keyword checking and use of double precision.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/a_correlate.pro)


BAR_PLOT

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

 PURPOSE:
	Create a bar graph, or overplot on an existing one.

 CATEGORY:
	Graphics.

 CALLING SEQUENCE:
	BAR_PLOT, Values

 INPUTS:
	Values:	A vector containing the values to be represented by the bars.
		Each element in VALUES corresponds to a single bar in the
		output.

 KEYWORD PARAMETERS:
   BASELINES:	A vector, the same size as VALUES, that contains the
		base value associated with each bar.  If not specified,
		a base value of zero is used for all bars.

      COLORS:	A vector, the same size as VALUES, containing the color index
		to be used for each bar.  If not specified, the colors are
		selected based on spacing the color indices as widely as 
		possible within the available colors (specified by D.N_COLORS).

    BARNAMES:	A string array, containing one string label per bar.
		If the bars are vertical, the labels are placed beneath
		them.  If horizontal (rotated) bars are specified, the labels
		are placed to the left of the bars.

	TITLE:	A string containing the main title to for the bar plot.

	XTITLE:	A string containing the title for the X axis.

	YTITLE:	A string containing the title for the Y axis.

   BASERANGE:	A floating-point scalar in the range 0.0 to 1.0, that
		determines the fraction of the total available plotting area
		(in the direction perpendicular to the bars) to be used.
		If not specified, the full available area is used.

    BARWIDTH:	A floating-point value that specifies the width of the bars
		in units of "nominal bar width".  The nominal bar width is
		computed so that all the bars (and the space between them, 
		set by default to 20% of the width of the bars) will fill the 
		available space (optionally controlled with the BASERANGE 
		keyword).

    BARSPACE: 	A scalar that specifies, in units of "nominal bar width",
		the spacing between bars.  For example, if BARSPACE is 1.0,
		then all bars will have one bar-width of space between them.
		If not specified, the bars are spaced apart by 20% of the bar
		width.

   BAROFFSET:	A scalar that specifies the offset to be applied to the
		first bar, in units of "nominal bar width".  This keyword 
		allows, for example, different groups of bars to be overplotted
		on the same graph.  If not specified, the default offset is
		equal to BARSPACE.

     OUTLINE:	If set, this keyword specifies that an outline should be 
		drawn around each bar.

    OVERPLOT:	If set, this keyword specifies that the bar plot should be
		overplotted on an existing graph.

  BACKGROUND:	A scalar that specifies the color index to be used for
		the background color.  By default, the normal IDL background
		color is used.

	ROTATE:	If set, this keyword indicates that horizontal rather than
		vertical bars should be drawn.  The bases of horizontal bars
		are on the left, "Y" axis and the bars extend to the right.

 OUTPUTS:
	A bar plot is created, or an existing one is overplotted.

 EXAMPLE:
	By using the overplotting capability, it is relatively easy to create
	stacked bar charts, or different groups of bars on the same graph.

	For example, if ARRAY is a two-dimensional array of 5 columns and 8
	rows, it is natural to make a plot with 5 bars, each of which is a
	"stacked" composite of 8 sections.  First, create a 2D COLORS array,
	equal in size to ARRAY, that has identical color index values across
	each row to ensure that the same item is represented by the same color
	in all bars.

	With ARRAYS and COLORS defined, the following code fragment
	illustrates the creation of stacked bars (note that the number of rows
	and columns is arbitrary):

	!Y.RANGE = [0,ymax] ; Scale range to accommodate the total bar lengths.
	BASE = INTARR(NROWS)
	FOR I = 0, NROWS-1 DO BEGIN
	   BAR_PLOT, ARRAY(*,I), COLORS=COLORS(*,I), BASELINES=BASE, $
	             BARWIDTH=0.75, BARSPACE=0.25, OVER=(I GT 0)
	   BASE = BASE + ARRAY(*,I)
	ENDFOR

	To plot each row of ARRAY as a clustered group of bars within the same
	graph, use the BASERANGE keyword to restrict the available plotting
	region for each set of bars.  The sample code fragment below
	illustrates this method:

	FOR I = 0, NROWS-1 DO $
	   BAR_PLOT, ARRAY(*,I), COLORS=COLORVECT, BARWIDTH=0.8,BARSPACE=0.2, $
	     BAROFFSET=I*((1.0+BARSPACE)*NCOLS), OVER=(I GT 0), BASERANGE=0.19

	where NCOLS is the number of columns in ARRAY, and COLORVECT is a
	vector containing the color indices to be used for each group of
	bars.  (In this example, each group uses the same set of colors, but
	this could easily be changed.)

 MODIFICATION HISTORY:
	August 1990, T.J. Armitage, RSI, initial programming.  Replacement
	for PLOTBAR and OPLOTBAR routines written by William Thompson.

	September 1990, Steve Richards, RSI, changed defaults to improve the
	appearance of the bar plots in the default mode. Included
	spacing the bars slightly.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/bar_plot.pro)


BETA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BETA
 PURPOSE:
	The introduction of the BETA function as a built in system routine
	in IDL 4.0 caused inconvenience to customers with existing code
	in which BETA had been used as a variable, because IDL system
	routines have precedence over variable names. To minimize this
	problem, RSI has renamed BETA back to NR_BETA (its old name).

	This wrapper serves to make NR_BETA available under the name
	BETA as documented in the IDL Reference Manual. However, since
	IDL library routines have lower precedence than variables, programs
	that use BETA as a variable name will work as before.

	See the documentation for BETA in the IDL Reference manual for details
	on arguments, keywords, and results.
 

 MODIFICATION HISTORY:
	3 July 1995, AB, RSI.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/beta.pro)


BILINEAR

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

 PURPOSE:
	Bilinearly interpolate a set of reference points.

 CALLING SEQUENCE:
	Result = BILINEAR(P, IX, JY)

 INPUTS:                 
	P:  A two-dimensional data array.

	IX and JY:  The "virtual subscripts" of P to look up values
	  for the output.
  
	IX can be one of two types:
	     1)	A one-dimensional, floating-point array of subscripts to look
		up in P.  The same set of subscripts is used for all rows in
		the output array.
	     2)	A two-dimensional, floating-point array that contains both 
		"x-axis" and "y-axis" subscripts specified for all points in
		the output array.

	In either case, IX must satisfy the expression,
		    0 <= MIN(IX) < N0  and 0 < MAX(IX) <= N0
	where N0 is the total number of subscripts in the first dimension
	of P.

	JY can be one of two types:
	     1) A one-dimensional, floating-point array of subscripts to look
		up in P.  The same set of subscripts is used for all rows in
		the output array.
	     2) A two-dimensional, floating-point array that contains both
               "x-axis" and "y-axis" subscripts specified for all points in
               the output array.

	    In either case JY must satisfy the expression,
		    0 <= MIN(JY) < M0  and 0 < MAX(JY) <= M0
	    where M0 is the total number of subscripts in the second dimension
	    of P.

  	It is better to use two-dimensional arrays for IX and JY when calling
  	BILINEAR because the algorithm is somewhat faster.  If IX and JY are 
  	one-dimensional, they are converted to two-dimensional arrays on
  	return from the function.  The new IX and JY can be re-used on 
	subsequent calls to take advantage of the faster, 2D algorithm.  The 
	2D array P is unchanged upon return.

 OUTPUT:
	The two-dimensional, floating-point, interpolated array.  

 SIDE EFFECTS:
	This function can take a long time to execute.

 RESTRICTIONS:
	None.

 EXAMPLE:
	Suppose P = FLTARR(3,3), IX = [.1, .2], and JY = [.6, 2.1] then
	the result of the command:
		Z = BILINEAR(P, IX, JY)
	Z(0,0) will be returned as though it where equal to P(.1,.6) 
	interpolated from the nearest neighbors at P(0,0), P(1,0), P(1,1)
	and P(0,1).

 PROCEDURE:
	Uses bilinear interpolation algorithm to evaluate each element
	in the result  at virtual coordinates contained in IX and JY with 
	the data in P.                                                          

 REVISION HISTORY:
       Nov. 1985  Written by L. Kramer (U. of Maryland/U. Res. Found.)
	Aug. 1990  TJA simple bug fix, contributed by Marion Legg of NASA Ames
	Sep. 1992  DMS, Scrapped the interpolat part and now use INTERPOLATE

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/bilinear.pro)


BINOMIAL

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

 PURPOSE:
       This function computes the probabilty (bp) such that:
                   Probability(X => v) = bp 
       where X is a random variable from the cumulative binomial distribution
       (Bernouli distribution).

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = Binomial(V, N, P)

 INPUTS:
       V:    A non-negative integer specifying the minimal number of 
             times an event E occurs in (N) independent performances.

       N:    A non-negative integer specifying the number of performances.
             If the number of performances exceeds 25, the Gaussian 
             distribution is used to approximate the cumulative binomial 
             distribution.

       P:    A non-negative scalar, in the interval [0.0, 1.0],  of type 
             float or double that specifies the probability of occurance 
             or success of a single independent performance.

 EXAMPLES:
       Compute the probability of obtaining at least two 6s in rolling a
       die four times. The result should be 0.131944
         result = binomial(2, 4, 1./6.)

       Compute the probability of obtaining exactly two 6s in rolling a
       die four times. The result should be 0.115741
         result = binomial(2, 4, 1./6.) - binomial(3, 4, 1./6.)

       Compute the probability of obtaining three or fewer 6s in rolling
       a die four times. The result should be 0.999228
         result = (binomial(0, 4, 1./6.) - binomial(1, 4, 1./6.)) + $
                  (binomial(1, 4, 1./6.) - binomial(2, 4, 1./6.)) + $
                  (binomial(2, 4, 1./6.) - binomial(3, 4, 1./6.)) + $
                  (binomial(3, 4, 1./6.) - binomial(4, 4, 1./6.))

 PROCEDURE:
       BINOMIAL computes the probability that an event E occurs at least
       (V) times in (N) independent performances. The event E is assumed
       to have a probability of occurance or success (P) in a single 
       performance.

 REFERENCE:
       ADVANCED ENGINEERING MATHEMATICS (seventh edition)
       Erwin Kreyszig
       ISBN 0-471-55380-8

 MODIFICATION HISTORY:
       Modified by:  GGS, RSI, July 1994
                     Minor changes to code. Rewrote documentation header.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/binomial.pro)


BIN_DATE

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

 PURPOSE:
	This function converts a standard form ascii date/time string
	to a binary string.

 CATEGORY:
	Date/time functions.

 CALLING SEQUENCE:
	Result = BIN_DATE(Asc_time)

 INPUTS:
	Asc_time: the date/time to convert in standard ascii format.
		  If omitted, use the current date/time.  
	  	  Standard form is a 24 character string:
			DOW MON DD HH:MM:SS YYYY
		  where: DOW = day of week, MON = month, DD=day of month,
			HH:MM:SS = hour/minute/second, YYYY = year.

 OUTPUTS:
	This function returns a 6 element integer array containing:
 	Element 0 = year	e.g. 1992
		1 = month	1-12
		2 = day		1-31
		3 = hour	0-23
		4 = minute	0-59
		5 = second	0-59

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	None.

 PROCEDURE:
	Straightforward.

 MODIFICATION HISTORY:
 	Written by:	DMS /RSI, Jul, 1992.
	Modified to use STR_SEP function, DMS, Dec. 1995.
       Fixed bug when passed single digit dates
			KDB, Nov, 01 1996

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/bin_date.pro)


BISECT_PDF

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

 PURPOSE:
       This function computes the cutoff value x such that the probabilty
       of an observation from the given distribution, less than x, is a(0).
       u and l are the upper and lower limits for x, respectively.
       a(1) and a(2) are degrees of freedom, if appropriate.
       funct is a string specifying the probability density function.
       BISECT_PDF is not intended to be a user-callable function.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/bisect_pdf.pro)


BLK_CON

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

 PURPOSE:
       This function computes a "fast convolution" of a digital signal 
       and an impulse-response sequence.

 CATEGORY:
       Digital Signal Processing

 CALLING SEQUENCE:
       Result = BLK_CON(Filter, Signal, B_length = B_length)

 INPUTS:
       Filter = A P-element floating-point vector containing the impulse-
                response sequence of the digital filter.
       Signal = An N-element floating-point vector containing the discrete 
                signal samples.
                
 KEYWORD PARAMETERS:
       B_length = (Block Length) An integer specifying the length of
                  the subdivided signal segments. If this paramter is
                  not specified, a near-optimal value is chosen by the 
                  algorithm based upon the length of the impulse-response 
                  sequence, P. If P is a value less than 11 or greater 
                  than 377, then B_length must be specified.

 RESTRICTIONS:
       1) The block length must be greater than the filter length.
          B_length > P
       2) The block length must be less than the number of signal samples.
          B_length < N_elements(Signal)

 EXAMPLE:
       Create an impulse-response sequence of length P = 32. 
         filter = replicate(1.0, 32) ;Set all points to 1.0
         filter(2*indgen(16)) = 0.5  ;Set even points to 0.5

       Create a sampled signal with random noise.
         signal = sin((findgen(1000)/35.0)^2.5)
         noise  = (randomu(SEED,1000)-0.5)/2
         signal = signal + noise

       Convolve the filter and signal using block convolution.
         result = BLK_CON(filter, signal)

 PROCEDURE:
       Implementation of the "overlap-save" method in the frequency domain.
       The discrete signal samples are divided into overlapping segments of
       a length specified by the parameter B_length. B_length may be supplied
       by the user as an optional keyword parameter or determined by the
       algorithm to a near-optimal value. Each input segment consists of P-1
       samples from the previous input segment and (B_length-P+1) new signal
       samples, where P is the length of the filter. Each of these segments
       is processed in the frequency domain and then 'reassembled' in the
       time domain. The first and last input segments are handled differently.
       The result is an N-element floating-point vector containing the 
       filtered signal.

 REFERENCE:
       Oppenheim, A.V. and Schafer, R.W.
       DIGITAL SIGNAL PROCESSING
       Prentice-Hall, 1975

 MODIFICATION HISTORY:
           Written by:  GGS, RSI, May 1993
           Modified:    GGS, RSI, June 1994
                        Added long indexing into vectors. Minor changes in 
                        the use of intermediate variables reduces memory
                        allocation in certain instances. Made slight changes
                        to the documentation header.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/blk_con.pro)


BOX_CURSOR

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

 PURPOSE:
	Emulate the operation of a variable-sized box cursor (also known as
	a "marquee" selector).

 CATEGORY:
	Interactive graphics.

 CALLING SEQUENCE:
	BOX_CURSOR, x0, y0, nx, ny [, INIT = init] [, FIXED_SIZE = fixed_size]

 INPUTS:
	No required input parameters.

 OPTIONAL INPUT PARAMETERS:
	x0, y0, nx, and ny give the initial location (x0, y0) and 
	size (nx, ny) of the box if the keyword INIT is set.  Otherwise, the 
	box is initially drawn in the center of the screen.

 KEYWORD PARAMETERS:
	INIT:  If this keyword is set, x0, y0, nx, and ny contain the initial
	parameters for the box.

	FIXED_SIZE:  If this keyword is set, nx and ny contain the initial
	size of the box.  This size may not be changed by the user.

	MESSAGE:  If this keyword is set, print a short message describing
	operation of the cursor.

 OUTPUTS:
	x0:  X value of lower left corner of box.
	y0:  Y value of lower left corner of box.
	nx:  width of box in pixels.
	ny:  height of box in pixels. 

	The box is also constrained to lie entirely within the window.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	A box is drawn in the currently active window.  It is erased
	on exit.

 RESTRICTIONS:
	Works only with window system drivers.

 PROCEDURE:
	The graphics function is set to 6 for eXclusive OR.  This
	allows the box to be drawn and erased without disturbing the
	contents of the window.

	Operation is as follows:
	Left mouse button:   Move the box by dragging.
	Middle mouse button: Resize the box by dragging.  The corner
		nearest the initial mouse position is moved.
	Right mouse button:  Exit this procedure, returning the 
			     current box parameters.

 MODIFICATION HISTORY:
	DMS, April, 1990.
	DMS, April, 1992.  Made dragging more intutitive.
	June, 1993 - Bill Thompson
			prevented the box from having a negative size.
       SJL, Nov, 1997.  Formatted, conform to IDL style guide.
                       Prevented crash from unitialized corner.
       RJF, Feb, 1998. Replaced !ERROR_STATE.CODE w/ !MOUSE.BUTTON and
			fixed some problems w/sizing when a corner might swap.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/box_cursor.pro)


CALDAT

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

 PURPOSE:
	Return the calendar date and time given julian date.
	This is the inverse of the function JULDAY.
 CATEGORY:
	Misc.

 CALLING SEQUENCE:
	CALDAT, Julian, Month, Day, Year, Hour, Minute, Second
	See also: julday, the inverse of this function.

 INPUTS:
	JULIAN contains the Julian Day Number (which begins at noon) of the 
	specified calendar date.  It should be a long integer.
 OUTPUTS:
	(Trailing parameters may be omitted if not required.)
	MONTH:	Number of the desired month (1 = January, ..., 12 = December).

	DAY:	Number of day of the month.

	YEAR:	Number of the desired year.

	HOUR:	Hour of the day
	Minute: Minute of the day
	Second: Second (and fractions) of the day.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	Accuracy using IEEE double precision numbers is approximately
	1/10000th of a second.

 MODIFICATION HISTORY:
	Translated from "Numerical Recipies in C", by William H. Press,
	Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling.
	Cambridge University Press, 1988 (second printing).

	DMS, July 1992.
	DMS, April 1996, Added HOUR, MINUTE and SECOND keyword
	AB, 7 December 1997, Generalized to handle array input.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/caldat.pro)


CALENDAR

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

 PURPOSE:
	Display a calandar for a month or an entire year using IDL's
	plotting subsystem. This IDL routine imitates the Unix cal
	command.

 CATEGORY:
	Misc.

 CALLING SEQUENCE:
	CALENDAR
	CALENDAR, YEAR
	CALENDAR, MONTH, YEAR

 INPUTS:
	If called without arguments, CALENDAR draws a calendar for the
	current month.

	MONTH:  The number of the month for which a calandar is
		desired (1 is January, 2 is February, ..., 12 is December).

	YEAR:   The number of the year for which a calendar should be
		drawn. If YEAR is provided without MONTH, a calendar
		for the entire year is drawn.

 OPTIONAL INPUT PARAMETERS:
	None.

 OUTPUTS:
	The specified calandar is drawn on the current graphics device.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	None.

 MODIFICATION HISTORY:
	AB, September, 1988

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/calendar.pro)


CDF_EXISTS

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

 PURPOSE:
	Test for the existence of the CDF library

 CATEGORY:
	File Formats

 CALLING SEQUENCE:
	Result = CDF_EXISTS()

 INPUTS:
	None.

 KEYWORD PARAMETERS:
	None.

 OUTPUTS:
	Returns TRUE (1) if the CDF data format library is
	supported. Returns FALSE(0) if it is not.

 EXAMPLE:
	IF cdf_exists() EQ 0 THEN Fail,"CDF not supported on this machine"

 MODIFICATION HISTORY
	Written by:	Joshua Goldstein,  12/8/92

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cdf_exists.pro)


CHEBYSHEV

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

 PURPOSE:
	Implements forward and reverse Chebyshev polynomial expansion of
	a set of data.

 CATAGORY:
	Mathematics.

 CALLING SEQUENCE:
	Result = CHEBYSHEV(D, N)

 INPUT:
	D:  A vector containing the values at the zeros of Chebyshev
	    polynomial.

	N:  A flag that, if set to -1, returns a set of Chebyshev polynomials.
	    If set to +1, the original data is returned.

 OUTPUT:
	Returns either the set of Chebyshev polynomials or the original
	data depending on the value of N.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Results from this function are subject to roundoff error given
	discontinuous data.

 RESTRICTIONS:                                           
	Unknown.

 PROCEDURE:
	Straightforward implementation of recursion formula. 

 REVISION HISTORY:
	Jan, 1986  Written by Leonard Kramer, U. of Maryland
		   University Research Foundation

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/chebyshev.pro)


CHISQR_CVF

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

 PURPOSE: 
	This function computes the cutoff value (v) such that:
                   Probability(X > v) = p
       where X is a random variable from the Chi-square distribution
       with (df) degrees of freedom. 

 CATEGORY:
       Statistics.
 
 CALLING SEQUENCE:
       Result = chisqr_cvf(P, DF)

 INPUTS:
       P:    A non-negative scalar, in the interval [0.0, 1.0], of type
             float or double that specifies the probability of occurance 
             or success.

      DF:    A positive scalar of type integer, float or double that 
             specifies the degrees of freedom of the Chi-square distribution.

 EXAMPLE:
       Compute the cutoff value (v) such that Probability(X > v) = 0.100
       from the Chi-square distribution with (DF = 3) degrees of freedom. 
       The result should be 6.25139
         result = chisqr_cvf(0.100, 3) 

 REFERENCE:
       ADVANCED ENGINEERING MATHEMATICS (seventh edition)
       Erwin Kreyszig
       ISBN 0-471-55380-8

 MODIFICATION HISTORY:
       Modified by:  GGS, RSI, July 1994
                     Minor changes to code. New documentation header.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/chisqr_cvf.pro)


CHISQR_PDF

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

 PURPOSE: 
       This function computes the probabilty (p) such that:
                   Probability(X <= v) = p
       where X is a random variable from the Chi-square distribution
       with (df) degrees of freedom.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = chisqr_pdf(V, DF)

 INPUTS:
       V:    A scalar of type integer, float or double that specifies 
             the cutoff value.

      DF:    A positive scalar of type integer, float or double that
             specifies the degrees of freedom of the Chi-square distribution.

 EXAMPLES:
       Compute the probability that a random variable X, from the Chi-square 
       distribution with (DF = 3) degrees of freedom, is less than or equal 
       to 6.25. The result should be 0.899939 
         result = chisqr_pdf(6.25, 3)

       Compute the probability that a random variable X, from the Chi-square
       distribution with (DF = 3) degrees of freedom, is greater than 6.25. 
       The result should be 0.100061
         result = 1 - chisqr_pdf(6.25, 3)

 REFERENCE:
       ADVANCED ENGINEERING MATHEMATICS (seventh edition)
       Erwin Kreyszig
       ISBN 0-471-55380-8

 MODIFICATION HISTORY:
       Modified by:  GGS, RSI, July 1994
                     Minor changes to code. New documentation header.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/chisqr_pdf.pro)


CIR_3PNT

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

 PURPOSE:
	This procedure returns the radius and center of a circle,
	given 3 points on the circle. This is analogous to finding
	the circumradius and circumcircle of a triangle; the center
	of the circumcircle is the point at which the three perpendicular
	bisectors of the triangle formed by the points meet.

 CATEGORY:
	Analytical geometry.

 CALLING SEQUENCE:
	CIR_3PNT, X, Y, R, X0, Y0

 INPUTS:
	X: A three-element vector containing the X-coordinates of the points.
	Y: A three-element vector containing the Y-coordinates of the points.

 OUTPUTS:
	R: The radius of the circle. The procedure returns 0.0 if the points
	   are co-linear.
	X0, Y0: The coordinates of the center of the circle. The procedure
	        returns 0.0 if the points are co-linear.

 PROCEDURE:
	Derived from Glasser, ed.  Graphics Gems, Volume 1, Page 22.

 EXAMPLE:
	X = [1.0, 2.0, 3.0]
	Y = [1.0, 2.0, 1.0]
	CIR_3PNT, X, Y, R, X0, Y0
	Print, 'The radius is: ', R
	Print, 'The center of the circle is at: ', X0, Y0

 MODIFICATION HISTORY:
 	Written by:	DMS, RSI, Nov, 1992.
                       SJL, Nov, 1997.  - Formatting.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cir_3pnt.pro)


COLORMAP_APPLICABLE

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

 PURPOSE:
   Determine whether the current visual class supports the use of a colormap,
   and if so, whether colormap changes affect pre-displayed Direct Graphics
   or if the graphics must be redrawn to pick up colormap changes.

 CATEGORY:
   Direct Graphics, Color.

 CALLING SEQUENCE:
   result = COLORMAP_APPLICABLE(redrawRequired)

 INPUTS:
   None.

 Keyword Inputs:
   None.

 OUTPUTS:
   The function returns a long value of 1 if the current visual class allows
   modification of the color table, and 0 otherwise.

   redrawRequired: Set this to a named variable to retrieve a value
                   indicating whether the visual class supports automatic
                   updating of graphics.  The value will be 0 if the
                   graphics are updated automatically or 1 if the graphics
                   must be redrawn to pick up changes to the colormap.
   
 EXAMPLE:
   To determine whether to redisplay an image after a colormap change:

       result = COLORMAP_APPLICABLE(redrawRequired)
       IF ((result GT 0) AND (redrawRequired GT 0)) THEN BEGIN
           my_redraw
       ENDIF

 MODIFICATION HISTORY:
   Written August 1998, ACY

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/colormap_applicable.pro)


COMFIT

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

 PURPOSE:
       This function fits the paired data {X(i), Y(i)} to one of six common
       types of appoximating models using a gradient-expansion least-squares
       method. The result is a vector containing the model parameters.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = COMFIT(X, Y, A)

 INPUTS:
       X:    An n-element vector of type integer, float or double.

       Y:    An n-element vector of type integer, float or double.

       A:    A vector of initial estimates for each model parameter. The length
             of this vector depends upon the type of model selected.

 KEYWORD PARAMETERS:
       EXPONENTIAL:    If set to a non-zero value, the parameters of the 
                       exponential model are computed. Y = a0  * a1^x + a2.

         GEOMETRIC:    If set to a non-zero value, the parameters of the
                       geometric model are computed.  Y = a0 * x^a1 + a2.
    
          GOMPERTZ:    If set to a non-zero value, the parameters of the
                       Gompertz model are computed.  Y = a0 * a1^(a2*x) + a3.

        HYPERBOLIC:    If set to a non-zero value, the parameters of the
                       hyperbolic model are computed.  Y = 1./(a0 + a1*x)

          LOGISTIC:    If set to a non-zero value, the parameters of the
                       logistic model are computed.  Y = 1./(a0 * a1^x + a2)

         LOGSQUARE:    If set to a non-zero value, the parameters of the
                       logsquare model are computed.
			Y = a0 + a1*alog10(x) + a2 * alog10(x)^2

             SIGMA:    Use this keyword to specify a named variable which 
                       returns a vector of standard deviations for the computed
                       model parameters.
                
           WEIGHTS:    An n-element vector of weights. If the WEIGHTS vector 
                       is not specified, an n-element vector of 1.0s is used.

              YFIT:    Use this keyword to specify a named variable which 
                       returns n-element vector of y-data corresponding to the 
                       computed model parameters.

 EXAMPLE:
       Define two n-element vectors of paired data.
         x = [2.27, 15.01, 34.74, 36.01, 43.65, 50.02, 53.84, 58.30, 62.12, $
             64.66, 71.66, 79.94, 85.67, 114.95]
         y = [5.16, 22.63, 34.36, 34.92, 37.98, 40.22, 41.46, 42.81, 43.91, $
             44.62, 46.44, 48.43, 49.70, 55.31]
       Define a 3-element vector of initial estimates for the logsquare model.
         a = [1.5, 1.5, 1.5]
       Compute the model parameters of the logsquare model, a(0), a(1), & a(2).
         result = comfit(x, y, a, sigma = sigma, yfit = yfit, /logsquare)
       The result should be the 3-element vector:
         [1.42494, 7.21900, 9.18794]

 REFERENCE:
       APPLIED STATISTICS (third edition)
       J. Neter, W. Wasserman, G.A. Whitmore
       ISBN 0-205-10328-6

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, September 1994

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/comfit.pro)


COMPLEXROUND

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

 PURPOSE:
       This function rounds a complex scalar or array.

 CATEGORY:
       Numerical Analysis.

 CALLING SEQUENCE:
       Result = Complexround(z)

 INPUTS:
       Z: A complex scalar or array.

 RESTRICTIONS:
       The input argument must be complex.

 PROCEDURE:
       This function rounds the real and imaginary components of the 
       complex input argument.

 EXAMPLE:
       ;Define a complex array.
 	  z = [[complex(1.245, 3.880), complex( 1.245, -3.880)], $
              [complex(1.499, 5.501), complex(-1.355, -2.115)]]
       ;Round it.
         result = complexround(z) 

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, September 1992
       Modified:    GGS, RSI, September 1994
                    Added support for double-precision complex inputs.
                    Uses IDL's intrinsic ROUND function.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/complexround.pro)


COND

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

 PURPOSE:
       This function computes the condition number of an N by N array.

 CATEGORY:
       Complex Linear Algebra.

 CALLING SEQUENCE:
       Result = COND(A)

 INPUTS:
       A:      An N by N real or complex array.

 KEYWORD PARAMETERS:
       DOUBLE: If set to a non-zero value, computations are done in
               double precision arithmetic.

 EXAMPLE:
       Define a complex array (a).
         a = [[complex(1, 0), complex(2,-2), complex(-3,1)], $
              [complex(1,-2), complex(2, 2), complex(1, 0)], $
              [complex(1, 1), complex(0, 1), complex(1, 5)]]
       Compute the condition number of the complex array (a) using 
       double-precision complex arithmetic.
         result = cond(a, /double)
         
 PROCEDURE:
       This function returns the condition number of an N x N real or
       complex array (A) by explicitly computing, norm(A)*norm(A_inverse).
       If A is real and A_inverse is invalid (due to the singularity of A 
       or floating-point errors in the nr_invert function), the condition 
       number is returned as a -1. If A is complex and A_inverse is invalid
       (due to the singularity of A), calling COND.PRO results in floating-
       point errors.

 REFERENCE:
       ADVANCED ENGINEERING MATHEMATICS (seventh edition)
       Erwin Kreyszig
       ISBN 0-471-55380-8

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, April 1992
       Modified:    GGS, RSI, February 1994
                    Accepts complex inputs. Added DOUBLE keyword.
       Modified:    GGS, RSI, November 1994
                    Added support for double-precision complex inputs.
                    Changed NR_INVERT to INVERT.
       Modified:    GGS, RSI, April 1996
                    Modified keyword checking and use of double precision. 

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cond.pro)


CONGRID

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

 PURPOSE:
       Shrink or expand the size of an array by an arbitrary amount.
       This IDL procedure simulates the action of the VAX/VMS
       CONGRID/CONGRIDI function.

	This function is similar to "REBIN" in that it can resize a
       one, two, or three dimensional array.   "REBIN", however,
       requires that the new array size must be an integer multiple
       of the original size.   CONGRID will resize an array to any
       arbitrary size (REBIN is somewhat faster, however).
       REBIN averages multiple points when shrinking an array,
       while CONGRID just resamples the array.

 CATEGORY:
       Array Manipulation.

 CALLING SEQUENCE:
	array = CONGRID(array, x, y, z)

 INPUTS:
       array:  A 1, 2, or 3 dimensional array to resize.
               Data Type : Any type except string or structure.

       x:      The new X dimension of the resized array.
               Data Type : Int or Long (greater than or equal to 2).

 OPTIONAL INPUTS:
       y:      The new Y dimension of the resized array.   If the original
               array has only 1 dimension then y is ignored.   If the
               original array has 2 or 3 dimensions then y MUST be present.

       z:      The new Z dimension of the resized array.   If the original
               array has only 1 or 2 dimensions then z is ignored.   If the
               original array has 3 dimensions then z MUST be present.

 KEYWORD PARAMETERS:
       INTERP: If set, causes linear interpolation to be used.
               Otherwise, the nearest-neighbor method is used.

	CUBIC:	If specified and non-zero, "Cubic convolution"
		interpolation is used.  This is a more
		accurate, but more time-consuming, form of interpolation.
		CUBIC has no effect when used with 3 dimensional arrays.
		If this parameter is negative and non-zero, it specifies the
		value of the cubic interpolation parameter as described
		in the INTERPOLATE function.  Valid ranges are -1 <= Cubic < 0.
		Positive non-zero values of CUBIC (e.g. specifying /CUBIC)
		produce the default value of the interpolation parameter
		which is -1.0.

       MINUS_ONE:
               If set, will prevent CONGRID from extrapolating one row or
               column beyond the bounds of the input array.   For example,
               If the input array has the dimensions (i, j) and the
               output array has the dimensions (x, y), then by
               default the array is resampled by a factor of (i/x)
               in the X direction and (j/y) in the Y direction.
               If MINUS_ONE is present (AND IS NON-ZERO) then the array
               will be resampled by the factors (i-1)/(x-1) and (j-1)/(y-1).

 OUTPUTS:
	The returned array has the same number of dimensions as the original
       array and is of the same data type.   The returned array will have
       the dimensions (x), (x, y), or (x, y, z) depending on how many
       dimensions the input array had.

 PROCEDURE:
       IF the input array has three dimensions, or if INTERP is set,
       then the IDL interpolate function is used to interpolate the
       data values.
       If the input array has two dimensions, and INTERP is NOT set,
       then the IDL POLY_2D function is used for nearest neighbor sampling.
       If the input array has one dimension, and INTERP is NOT set,
       then nearest neighbor sampling is used.

 EXAMPLE:
       ; vol is a 3-D array with the dimensions (80, 100, 57)
       ; Resize vol to be a (90, 90, 80) array
       vol = CONGRID(vol, 90, 90, 80)

 MODIFICATION HISTORY:
       DMS, Sept. 1988.
       DMS, Added the MINUS_ONE keyword, Sept. 1992.
 	Daniel Carr. Re-wrote to handle one and three dimensional arrays
                    using INTERPOLATE function.
 	DMS, RSI, Nov, 1993.  Added CUBIC keyword.
       SJL, Nov, 1997.  Formatting, conform to IDL style guide.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/congrid.pro)


COORD2TO3

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

 PURPOSE:
	Return 3D data coordinates given the normalized X and Y screen
	coordinates and one of the three data coordinates.

 CATEGORY:
	Geometry / Graphics.

 CALLING SEQUENCE:
	Result = COORD2TO3(Mx, My, Dim, D0 [, PTI])

 INPUTS:
	Mx, My: The normalized X and Y screen coordinates.

	Dim:  	A parameter used to specify which data coordinate is fixed.
		Use 0 for a fixed X data coordinate, 1 for a fixed Y data 
		coordinate, or 2 for a fixed Z data coordinate.

	D0:	The value of the fixed data coordinate.

 OPTIONAL INPUT PARAMETERS:
	PTI:  	The inverse of !P.T.  If this parameter is not supplied, 
		or set to 0, COORD2TO3 computes the inverse.  If this routine
		is to be used in a loop, the caller should supply PTI for
		highest efficiency.

 KEYWORD PARAMETERS:
	None.

 OUTPUTS:
	Returns a 3-element vector containing the 3D data coordinates.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	A valid 3D transform must exist in !P.T or PTI.
	The axis scaling variables, !X.S, !Y.S and !Z.S must be valid.

 PROCEDURE:
	The intersection of the plane determined by data coordinates
	Dim and D0 and the screen coordinate line (Mx, My, 0),
	(Mx, My, 1) is computed.

 EXAMPLE:
	To return the data coordinates of the mouse, fixing the
	data Z value at 10, enter the commands:
		CURSOR, X, Y, /NORM	;Get the normalized mouse coords.
	  	P = COORD2TO3(X, Y, 2, 10.0)

 MODIFICATION HISTORY:
	DMS, 9/91.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/coord2to3.pro)


CORRELATE

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

 PURPOSE:
       This function computes the linear Pearson correlation coefficient
       of two vectors or the Correlation Matrix of an M x N array. 
       Alternatively, this function computes the covariance of two vectors 
       or the Covariance Matrix of an M x N array.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = Correlate(X [,Y])

 INPUTS:
       X:    A vector or an M x N array of type integer, float or double.
 
       Y:    A vector of type integer, float or double. If X is an M x N 
             array, this parameter should not be supplied.

 KEYWORD PARAMETERS:
       COVARIANCE:    If set to a non-zero value, the sample covariance is 
                      computed. 

       DOUBLE:        If set to a non-zero value, computations are done in
                      double precision arithmetic.
       
 RESTRICTIONS:
       If X is an M x N array, then Y should not be supplied; 
       Result = Correlate(X)

 EXAMPLES:
       Define the data vectors.
         x = [65, 63, 67, 64, 68, 62, 70, 66, 68, 67, 69, 71]
         y = [68, 66, 68, 65, 69, 66, 68, 65, 71, 67, 68, 70]

       Compute the linear Pearson correlation coefficient of x and y.
         result = correlate(x, y)
       The result should be 0.702652

       Compute the covariance of x and y.
         result = correlate(x, y, /covariance)
       The result should be 3.66667
  
       Define an array with x and y as its columns.
         a = [transpose(x), transpose(y)]
       Compute the correlation matrix.
         result = correlate(a)
       The result should be [[1.000000,  0.702652]
                             [0.702652,  1.000000]]

       Compute the covariance matrix.
         result = correlate(a, /covariance)
       The result should be [[7.69697,  3.66667]
                             [3.66667,  3.53788]]

 PROCEDURE:
       CORRELATE computes the linear Pearson correlation coefficient of
       two vectors. If the vectors are of unequal length, the longer vector
       is truncated to the length of the shorter vector. If X is an M x N 
       array, M-columns by N-rows, the result will be an M x M array of 
       linear Pearson correlation coefficients with the iTH column and jTH 
       row element corresponding to the correlation of the iTH and jTH 
       columns of the M x N array. The M x M array of linear Pearson 
       correlation coefficients (also known as the Correlation Matrix) is 
       always symmetric and contains 1s on the main diagonal. The Covariance
       Matrix is also symmetric, but is not restricted to 1s on the main
       diagonal. 

 REFERENCE:
       APPLIED STATISTICS (third edition)
       J. Neter, W. Wasserman, G.A. Whitmore
       ISBN 0-205-10328-6

 MODIFICATION HISTORY:
       Written by:  DMS, RSI, Sept 1983
       Modified:    GGS, RSI, July 1994
                    Added COVARIANCE keyword.
                    Included support for matrix input.  
                    New documentation header.
       Modified:    GGS, RSI, April 1996
                    Included support for scalar and unequal length vector
                    inputs. Added checking for undefined correlations and
                    support of IEEE NaN (Not a Number). 
                    Added DOUBLE keyword.
                    Modified keyword checking and use of double precision.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/correlate.pro)


CRAMER

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

 PURPOSE:
       This function solves an n by n linear system of equations 
       using Cramer's rule.

 CATEGORY:
       Linear Algebra.

 CALLING SEQUENCE:
       Result = CRAMER(A, B)

 INPUTS:
       A:      An N by N array of type: float, or double.

       B:      An N-element vector of type: float, or double.

 KEYWORD PARAMETERS:
       DOUBLE: If set to a non-zero value, computations are done in
               double precision arithmetic.

       ZERO:   Use this keyword to set the value of floating-point
               zero. A floating-point zero on the main diagonal of
               a triangular matrix results in a zero determinant.
               A zero determinant results in a 'Singular matrix'
               error and stops the execution of CRAMER.PRO.
               For single-precision inputs, the default value is 
               1.0e-6. For double-precision inputs, the default value 
               is 1.0e-12.

 EXAMPLE:
       Define an array (a).
         a = [[ 2.0,  1.0,  1.0], $
              [ 4.0, -6.0,  0.0], $
              [-2.0,  7.0,  2.0]]

       And right-side vector (b).
         b = [3.0, 10.0, -5.0]

       Compute the solution of the system, ax = b.
         result = cramer(a, b)

 PROCEDURE:
       CRAMER.PRO uses ratios of column-wise permutations of the array (a)
       to calculate the solution vector (x) of the linear system, ax = b.

 REFERENCE:
       ADVANCED ENGINEERING MATHEMATICS (seventh edition)
       Erwin Kreyszig
       ISBN 0-471-55380-8

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, February 1994
       Modified:    GGS, RSI, November 1994
                    Added support for double precision results.
       Modified:    GGS, RSI, April 1996
                    Modified keyword checking and use of double precision.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cramer.pro)


CREATE_VIEW

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

 PURPOSE:
	This procedure sets the various system variables required to
       define a coordinate system and a 3-D view.   This procedure
       builds the system viewing matrix (!P.T) in such a way that the
       correct aspect ratio of the data is maintained even if the
       display window is not square.
       CREATE_VIEW also sets the "Data" to "Normal" coordinate
       conversion factors (!X.S, !Y.S, and !Z.S) so that center of
       the unit cube will be located at the center of the display
       window.

 CATEGORY:
	Viewing.

 CALLING SEQUENCE:
       CREATE_VIEW
	
 INPUTS:
	None.

 KEYWORD PARAMETERS:
       XMIN:       The minimum data value on the X axis.
                   The default is (0.0).
                   Data type : Any scalar numeric value.
       XMAX:       The maximum data value on the X axis.
                   The default is (1.0).
                   Data type : Any scalar numeric value.
       YMIN:       The minimum data value on the Y axis.
                   The default is (0.0).
                   Data type : Any scalar numeric value.
       YMAX:       The maximum data value on the Y axis.
                   Data type : Any scalar numeric value.
                   The default is (1.0).
       ZMIN:       The minimum data value on the Z axis.
                   The default is (0.0).
                   Data type : Any scalar numeric value.
       ZMAX:       The maximum data value on the Z axis.
                   The default is (1.0).
                   Data type : Any scalar numeric value.
       AX:         The orientation (X rotation) of the view.
                   The default is (0.0).
                   Data type : Float.
       AY:         The orientation (Y rotation) of the view.
                   The default is (0.0).
                   Data type : Float.
       AZ:         The orientation (Z rotation) of the view.
                   The default is (0.0).
                   Data type : Float.
       WINX:       The X size, in pixels, of the window that the
                   view is being set up for.
                   The default is (640).
                   Data type : Long.
       WINY:       The Y size, in pixels, of the window that the
                   view is being set up for.
                   The default is (512).
                   Data type : Long.
       ZOOM:       The view zoom factor.   If zoom is a single
                   value then the view will be zoomed equally in
                   all 3 dimensions.   If zoom is a 3 element vector
                   then the view will be scaled zoom(0) in X,
                   zoom(1) in Y, and zoom(2) in Z.
                   The default is (1.0).
                   Data type : Float or Fltarr(3).
       ZFAC:       Use this keyword to expand or contract the view
                   in the Z dimension.
                   The default is (1.0).
                   Data type : Float.
       PERSP:      The perspective projection distance.   A value of
                   (0.0) indicates an isometric projection (NO per-
                   spective).
                   The default is (0.0).
                   Data type : Float.
       RADIANS:    Set this keyword to a non-zero value if the values
                   passed to AX, AY, and AZ are in radians.
                   The default is degrees.
                   Data type : Int.

 SIDE EFFECTS:
	This procedure sets the following IDL system variables :

          !P.T, !P.T3D, !P.Position, !P.Clip, !P.Region
          !X.S, !X.Style, !X.Range, !X.Margin
          !Y.S, !Y.Style, !Y.Range, !Y.Margin
          !Z.S, !Z.Style, !Z.Range, !Z.Margin

 PROCEDURE:
       This procedure sets the 4x4 system viewing matrix (!P.T) by
       calling T3D with the following parameters :

       ; Reset (!P.T) to the identity matrix.
          T3D, /RESET
       ; Translate the center of the unit cube to the origin.
          T3D, TRANSLATE=[(-0.5), (-0.5), (-0.5)]
       ; Zoom the view.
          T3D, SCALE=ZOOM
       ; Scale the view to preserve the correct aspect ratio.
          xrange = xmax - xmin
          yrange = ymax - ymin
          zrange = (zmax - zmin) * zfac
          max_range = xrange > yrange > zrange
          T3D, SCALE=([xrange, yrange, zrange] / max_range)
       ; Rotate the view.
          T3D, ROTATE=[0.0, 0.0, AZ]
          T3D, ROTATE=[0.0, AY, 0.0]
          T3D, ROTATE=[AX, 0.0, 0.0]
       ; Define a perspective projection (if any).
          IF (p_proj) THEN T3D, PERSPECTIVE=PERSP
       ; Compensate for the aspect ratio of the display window.
          T3D, SCALE=[xfac, yfac, 1.0]
       ; Translate the unit cube back to its starting point.
          T3D, TRANSLATE=[(0.5), (0.5), (0.5)]

 EXAMPLE:
       Set up a view to display an iso-surface from volumetric data.

       ; Create some data.
          vol = FLTARR(40, 50, 30)
          vol(3:36, 3:46, 3:26) = RANDOMU(s, 34, 44, 24)
          FOR i=0, 10 DO vol = SMOOTH(vol, 3)

       ; Generate the iso-surface.
          SHADE_VOLUME, vol, 0.2, polygon_list, vertex_list, /LOW

       ; Set up the view.
       ; Note that the subscripts into the Vol array range from
       ; 0 to 39 in X, 0 to 49 in Y, and 0 to 29 in Z.   As such,
       ; the 3-D coordinates of the iso-surface (vertex_list) may
       ; range from 0.0 to 39.0 in X, 0.0 to 49.0 in Y,
       ; and 0.0 to 29.0 in Z.   Set XMIN, YMIN, and ZMIN to
       ; zero (the default), and set XMAX=39, YMAX=49, and ZMAX=29.
          WINDOW, XSIZE=600, YSIZE=400
          CREATE_VIEW, XMAX=39, YMAX=49, ZMAX=29, AX=(-60.0), AZ=(30.0), $
                       WINX=600, WINY=400, ZOOM=(0.7), PERSP=(1.0)

       ; Display the iso surface in the specified view.
          img = POLYSHADE(polygon_list, vertex_list, /DATA, /T3D)
          TVSCL, img

 MODIFICATION HISTORY:
 	Written by:	Daniel Carr. Wed Sep  2 16:40:47 MDT 1992
       Modified the way the view is compensated for the data aspect ratio.
                       Daniel Carr. Tue Dec  8 17:53:54 MST 1992

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/create_view.pro)


CROSSP

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

 PURPOSE:
	Evaluate the vector or cross-product of vectors v1 and v2.

 CATEGORY:
	Vector mathematics.

 CALLING SEQUENCE:
	Result = CROSSP(v1, v2)

 INPUTS:
	v1, v2:  Three-element vectors.

 OUTPUTS:
	Returns a 3-element, floating-point vector.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	Vectors must have 3 elements.

 PROCEDURE:
	v1 X v2 = | i  j  k  | = (b1c2 - b2c1)i + (c1a2-c2a1)j + (a1b2-a2b1)k
		  | a1 b1 c1 |
		  | a2 b2 c2 |

 MODIFICATION HISTORY:
	Written, DMS, Aug, 1983;

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/crossp.pro)


CRVLENGTH

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

 PURPOSE:
       This function computes the length of a curve with a tabular
       representation, y(i) = F(x(i)). 

 CATEGORY:
       Numerical Analysis

 CALLING SEQUENCE:
       Result = Crvlength(X, Y)

 INPUTS:
       X:    An N-element vector (N >= 3) of type float or double. These 
             values must be specified in ascending order. Duplicate x values 
             will result in a warning message.

       Y:    An N-element vector of type float or double.

 KEYWORD PARAMETERS:
       DOUBLE:  If set to a non-zero value, computations are done in
                double precision arithmetic.

 RESTRICTIONS:
       Data that is highly oscillatory requires a sufficient number
       of samples for an accurate curve length computation.

 EXAMPLE:
       Define a 21-element vector of X-values.
         x = [-2.00, -1.50, -1.00, -0.50, 0.00, 0.50, 1.00, 1.50, 2.00, $
               2.50,  3.00,  3.50,  4.00, 4.50, 5.00, 5.50, 6.00, 6.50, $
               7.00,  7.50,  8.00]
       Define a 21-element vector of Y-values.
         y = [-2.99, -2.37, -1.64, -0.84, 0.00, 0.84, 1.64, 2.37, 2.99, $
               3.48,  3.86,  4.14,  4.33, 4.49, 4.65, 4.85, 5.13, 5.51, $
               6.02,  6.64,  7.37]
       Compute the length of the curve.
         result = CRVLENGTH(x, y)
       The result should be:
         14.8115

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, March 1996

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/crvlength.pro)


CTI_TEST

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

 PURPOSE:
       This function constructs a "contingency table" from an array of
       observed frequencies and tests the hypothesis that the rows and
       columns are independent using an extension of the chi-squared 
       goodness-of-fit test. The result is a two-element vector contain-
       ing the chi-squared test statistic X2 and probability of obtaining 
       a value of X2 or greater.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = CTI_TEST(OBFREQ)

 INPUTS:
       OBFREQ:  An array of c-columns and r-rows of type integer, float 
                or double containing observed frequencies.

 KEYWORD PARAMETERS:
        COEFF:  Use this keyword to specify a named variable which returns
                the Coefficient of Contingency. A non-negative scalar,
                in the interval [0.0, 1.0], which measures the degree
                of dependence within a contingency table. The larger the
                value of COEFF, the greater the degree of dependence.

    CORRECTED:  If set to a nonzero value, the "Yate's Correction for
                Continuity" is used to compute the chi-squared test 
                statistic, X2. The Yate's correction always decreases the
                magnitude of the chi-squared test statistic, X2. In general,
                this keyword should be set for small sample sizes.

         CRAMV: Use this keyword to specify a named variable which returns
                Cramer's V. A non-negative scalar, in the interval [0.0, 1.0],
                which measures the degree of dependence within a contingency
                table.

           DF:  Use this keyword to specify a named variable which returns
                the degrees of freedom used to compute the probability of 
                obtaining the value of the chi-squared test statistic or
                greater. DF = (r - 1) * (c - 1) where r and c are the
                number of rows and columns of the contingency table, 
                respectively.

       EXFREQ:  Use this keyword to specify a named variable which returns
                an array of c-columns and r-rows containing expected  
                frequencies. The elements of this array are often refered
                to as the "cells" of the expected frequencies. The expected
                frequency of each cell is computed as the product of row
                and column marginal frequencies divided by the overall 
                total of observed frequencies.
 
     RESIDUAL:  Use this keyword to specify a named variable which returns
                an array of c-columns and r-rows containing signed differences
                between corresponding cells of observed frequencies and 
                expected frequencies.

 EXAMPLE:
       Define the 5-column and 4-row array of observed frequencies.
         obfreq = [[748, 821, 786, 720, 672], $
                   [ 74,  60,  51,  66,  50], $
                   [ 31,  25,  22,  16,  15], $
                   [  9,  10,   6,   5,   7]]
       Test the hypothesis that the rows and columns of "obfreq" contain
       independent data at the 0.05 significance level.
         result = cti_test(obfreq, coeff = coeff)
       The result should be the two-element vector [14.3953, 0.276181].
       The computed value of 0.276181 indicates that there is no reason to
       reject the proposed hypothesis at the 0.05 significance level.
       The Coefficient of Contingency returned in the parameter "coeff" 
       (coeff = 0.0584860) also indicates the lack of dependence between
       the rows and columns of the observed frequencies. Setting the 
       CORRECTED keyword returns the two-element vector [12.0032, 0.445420]
       and (coeff = 0.0534213) resulting in the same conclusion of 
       independence.

 PROCEDURE:
       CTI_TEST constructs a "contingency table" from a 2-dimensional
       input array of observed frequencies and applies the principles of
       the chi-squared goodness-of-fit test to determine the independence
       of the rows and columns. For small sample sizes, a correction for
       absolute differences between observed and expected frequencies may
       be applied by setting the CORRECTED keyword.

 REFERENCE:
       PROBABILITY and STATISTICS for ENGINEERS and SCIENTISTS (3rd edition)
       Ronald E. Walpole & Raymond H. Myers
       ISBN 0-02-424170-9

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, August 1994

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cti_test.pro)


CT_LUMINANCE

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

 PURPOSE:
	Calculate the luminance of colors.

 CATEGORY:
	Color tables

 CALLING SEQUENCE:
	L = CT_LUMINANCE(R, G, B)

 INPUTS:
	R = Red color table.  If omitted, use the color values from
		either the COLORS common block, or the current color table.
	G = Green color table, optional parameter.
	B = Blue color table, optional parameter.

 KEYWORD PARAMETERS:
	BRIGHT=var - Stores the index of the brightest color in the current
		colortable into var.
	DARK=var - Stores the index of the darkest color in the current
		colortable into var.
	READ_TABLES = if set and parameters are not specified,
		read directly from color tables, using
		TVLCT, /GET.  Do not use the COLORS common block.

 OUTPUTS:
   This function returns an array containing the luminance values
	of the specified colors.  If the R,G,B parameters are not
	specified, or if R is of integer, byte or long type, the
	result is a longword array.  Otherwise, the result is a 
	floating point array.

 COMMON BLOCKS:
	COLORS:	Contains the current RGB color tables.

 MODIFICATION HISTORY:
	April 1, 1992, AB
		When splitting XPALETTE into widget clusters, this code
		became necessary in multiple places. This routine
		encapsulates it.
	May 15, 1994, DMS
		Process colors from parameters or current color table.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/ct_luminance.pro)


CURVEFIT

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

 PURPOSE:
       Non-linear least squares fit to a function of an arbitrary 
       number of parameters.  The function may be any non-linear 
       function.  If available, partial derivatives can be calculated by 
       the user function, else this routine will estimate partial derivatives
       with a forward difference approximation.

 CATEGORY:
       E2 - Curve and Surface Fitting.

 CALLING SEQUENCE:
       Result = CURVEFIT(X, Y, Weights, A, SIGMA, FUNCTION_NAME = name, $
                         ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE)

 INPUTS:
       X:  A row vector of independent variables.  This routine does
           not manipulate or use values in X, it simply passes X
           to the user-written function.

       Y:  A row vector containing the dependent variable.

  Weights:  A row vector of weights, the same length as Y.
            For no weighting,
                 Weights(i) = 1.0.
            For instrumental (Gaussian) weighting,
                 Weights(i)=1.0/sigma(i)^2
            For statistical (Poisson)  weighting,
                 Weights(i) = 1.0/y(i), etc.

       A:  A vector, with as many elements as the number of terms, that 
           contains the initial estimate for each parameter.  IF A is double-
           precision, calculations are performed in double precision, 
           otherwise they are performed in single precision. Fitted parameters
           are returned in A.

 KEYWORDS:
       FUNCTION_NAME:  The name of the function (actually, a procedure) to 
       fit.  IF omitted, "FUNCT" is used. The procedure must be written as
       described under RESTRICTIONS, below.

       ITMAX:  Maximum number of iterations. Default = 20.
       ITER:   The actual number of iterations which were performed
       TOL:    The convergence tolerance. The routine returns when the
               relative decrease in chi-squared is less than TOL in an 
               interation. Default = 1.e-3.
       CHI2:   The value of chi-squared on exit (obselete)
     
       CHISQ:   The value of reduced chi-squared on exit
       NODERIVATIVE:   IF this keyword is set THEN the user procedure will not
               be requested to provide partial derivatives. The partial
               derivatives will be estimated in CURVEFIT using forward
               differences. IF analytical derivatives are available they
               should always be used.

 OUTPUTS:
       Returns a vector of calculated values.
       A:  A vector of parameters containing fit.

 OPTIONAL OUTPUT PARAMETERS:
       Sigma:  A vector of standard deviations for the parameters in A.

 COMMON BLOCKS:
       NONE.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The function to be fit must be defined and called FUNCT,
       unless the FUNCTION_NAME keyword is supplied.  This function,
       (actually written as a procedure) must accept values of
       X (the independent variable), and A (the fitted function's
       parameter values), and return F (the function's value at
       X), and PDER (a 2D array of partial derivatives).
       For an example, see FUNCT in the IDL User's Libaray.
       A call to FUNCT is entered as:
       FUNCT, X, A, F, PDER
 where:
       X = Variable passed into CURVEFIT.  It is the job of the user-written
           function to interpret this variable.
       A = Vector of NTERMS function parameters, input.
       F = Vector of NPOINT values of function, y(i) = funct(x), output.
       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
               PDER(I,J) = DErivative of function at ith point with
               respect to jth parameter.  Optional output parameter.
               PDER should not be calculated IF the parameter is not
               supplied in call. IF the /NODERIVATIVE keyword is set in the
               call to CURVEFIT THEN the user routine will never need to
               calculate PDER.

 PROCEDURE:
       Copied from "CURFIT", least squares fit to a non-linear
       function, pages 237-239, Bevington, Data Reduction and Error
       Analysis for the Physical Sciences.  This is adapted from:
       Marquardt, "An Algorithm for Least-Squares Estimation of Nonlinear
       Parameters", J. Soc. Ind. Appl. Math., Vol 11, no. 2, pp. 431-441,
       June, 1963.

       "This method is the Gradient-expansion algorithm which
       combines the best features of the gradient search with
       the method of linearizing the fitting function."

       Iterations are performed until the chi square changes by
       only TOL or until ITMAX iterations have been performed.

       The initial guess of the parameter values should be
       as close to the actual values as possible or the solution
       may not converge.

 EXAMPLE:  Fit a function of the form f(x) = a * exp(b*x) + c to
           sample pairs contained in x and y.
           In this example, a=a(0), b=a(1) and c=a(2).
           The partials are easily computed symbolicaly:
           df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0

           Here is the user-written procedure to return F(x) and
           the partials, given x:

       pro gfunct, x, a, f, pder      ; Function + partials
         bx = exp(a(1) * x)
         f= a(0) * bx + a(2)         ;Evaluate the function
         IF N_PARAMS() ge 4 THEN $   ;Return partials?
         pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(f))]]
       end

         x=findgen(10)                  ;Define indep & dep variables.
         y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1]
         Weights=1.0/y            ;Weights
         a=[10.0,-0.1,2.0]        ;Initial guess
         yfit=curvefit(x,y,Weights,a,sigma,function_name='gfunct')
         print, 'Function parameters: ', a
         print, yfit
       end

 MODIFICATION HISTORY:
       Written, DMS, RSI, September, 1982.
       Does not iterate IF the first guess is good.  DMS, Oct, 1990.
       Added CALL_PROCEDURE to make the function's name a parameter.
              (Nov 1990)
       12/14/92 - modified to reflect the changes in the 1991
            edition of Bevington (eq. II-27) (jiy-suggested by CreaSo)
       Mark Rivers, U of Chicago, Feb. 12, 1995
           - Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE
             These make the routine much more generally useful.
           - Removed Oct. 1990 modification so the routine does one iteration
             even IF first guess is good. Required to get meaningful output
             for errors. 
           - Added forward difference derivative calculations required for 
             NODERIVATIVE keyword.
           - Fixed a bug: PDER was passed to user's procedure on first call, 
             but was not defined. Thus, user's procedure might not calculate
             it, but the result was THEN used.

      Steve Penton, RSI, June 1996.
            - Changed SIGMAA to SIGMA to be consistant with other fitting 
              routines.
            - Changed CHI2 to CHISQ to be consistant with other fitting 
              routines.
            - Changed W to Weights to be consistant with other fitting 
              routines.
            _ Updated docs regarding weighing.
           

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/curvefit.pro)


CVTTOBM

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

 PURPOSE:
	Converts a byte array in which each byte represents one pixel
       into a bitmap byte array in which each bit represents one
       pixel. This is useful when creating bitmap labels for buttons
       created with the WIDGET_BUTTON function.

       Bitmap byte arrays are monochrome; by default, CVTTOBM converts
       pixels that are darker than the median value to black and pixels
       that are lighter than the median value to white. You can supply
       a different threshold value via the THRESHOLD keyword.

       Most of IDL's image file format reading functions (READ_BMP,
       READ_PICT, etc.) return a byte array which must be converted
       before use as a button label. Note that there is one exception
       to this rule; the READ_X11_BITMAP routine returns a bitmap
       byte array that needs no conversion before use.

 CATEGORY:

       Widgets, button bitmaps

 CALLING SEQUENCE:

	bitmap = Cvttobm(array [,THRESHOLD = Threshold])
 
 INPUTS:
	array - A 2-dimensional pixel array, one byte per pixel


 OPTIONAL INPUTS:
       None


 KEYWORD PARAMETERS:

	THRESHOLD - A byte value (or an integer value between 0 and 255)
                   to be used as a threshold value when determining if
                   a particular pixel is black or white. If not specified,
                   the threshold is calculated to be the average of the
                   input array.

 OUTPUTS:
	bitmap - bitmap byte array, in which each bit represents one pixel


 OPTIONAL OUTPUTS:
       None


 COMMON BLOCKS:
       None


 SIDE EFFECTS:
       None


 RESTRICTIONS:
       None


 PROCEDURE:
 1. Creates mask from input array, where values are 0/1 based on threshold.
 2. Calculates the size of the output array.
 3. Calculates the bitmap array from byte array based on mask.

 EXAMPLE:

 IDL> image=bytscl(dist(100))
 IDL> base=widget_base(/column)
 IDL> button=widget_button(base,value=Cvttobm(image))
 IDL> widget_control,base,/realize


 MODIFICATION HISTORY:
       Created: Mark Rehder, 10/96
       Modified: Lubos Pochman, 10/96

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cvttobm.pro)


CV_COORD

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

 PURPOSE:
       Converts 2-D and 3-D coordinates between the RECTANGULAR, POLAR,
       CYLINDRICAL, and SPHERICAL coordinate systems.

 CATEGORY:
       Graphics

 CALLING SEQUENCE:
       Coord = CV_COORD()

 KEYWORD PARAMETERS:

       FROM_RECT:
                  A vector of the form [x, y] or [x, y, z], or a (2, n) or
                  (3, n) array containing rectangular coordinates to convert.

       FROM_POLAR:
                  A vector of the form [angle, radius], or a (2, n) array of
                  polar coordinates to convert.

       FROM_CYLIN:
                  A vector of the form [angle, radius, z], or a (3, n) array
                  of cylindrical coordinates to convert.

       FROM_SPHERE:
                  A vector of the form [longitude, latitude, radius], or a
                  (3, n) array of spherical coordinates to convert.

       TO_RECT:   If set, then rectangular coordinates are returned.

       TO_POLAR:  If set, then polar coordinates are returned.

       TO_CYLIN:  If set, then cylindrical coordinates are returned.

       TO_SPHERE: If set, then spherical coordinates are returned.

       DEGREES:   If set, then the input (and output) coordinates are in
                  degrees (where applicable). Otherwise, the angles are
                  in radians.

 OUTPUTS:
       This function returns the converted coordinate(s) based on which of
       the "TO_" keywords is used :

          TO_RECT   : If the input coordinates were polar, then a vector
                      of the form [x, y] or a (2, n) array is returned.
                      Otherwise, a vector of the form [x, y, z], or a
                      (3, n) array is returned.
          TO_POLAR  : A vector of the form [angle, radius], or a (2, n)
                      array is returned.
          TO_CYLIN  : A vector of the form [angle, radius, z], or a (3, n)
                      array is returned.
          TO_SPHERE : A vector of the form [longitude, latitude, radius],
                      or a (3, n) array is returned.

       If the value passed to the "FROM_" keyword is double precision, then
       all calculations are performed in double precision and the returned
       value is double precision. Otherwise, single precision is used.

       If none of the "FROM_" keywords are specified then 0 is returned.
       If none of the "TO_" keywords are specified then the input coordinates
       are returned.

 PROCEDURE:
       When converting from spherical to polar coordinates, the points
       are first projected along the z axis to the x-y plane to get 2-D
       rectangular coordinates. The 2-D rectangular coordinates are
       then converted to polar.

 EXAMPLE:
       ; Convert from spherical to cylindrical coordinates.

       sphere_coord = [[45.0, -60.0, 10.0], [0.0, 0.0, 0.0]]
       rect_coord = CV_COORD(From_Sphere=sphere_coord, /To_Cylin, /Degrees)

       ; Convert from rectangular to polar coordinates.

       rect_coord = [10.0, 10.0]
       polar_coord = CV_COORD(From_Rect=rect_coord, /To_Polar)

 MODIFICATION HISTORY:
       Written by:     Daniel Carr, Thu Mar 31 14:42:58 MST 1994

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cv_coord.pro)


CW_ANIMATE

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

 PURPOSE:
	This widget displays an animated sequence of images using
	X-windows Pixmaps. This is a compound widget, based on the
	XINTERANIMATE procedure, with the following advantages:
		- It can be included in other applications.
		- Multiple copies can be run simultaneously.

	The speed and direction of the display can be adjusted using
	the widget interface.

 CATEGORY:
	Image display, compound widgets.

 CALLING SEQUENCE:
	To initially create:
		widget = CW_ANIMATE(PARENT, SIZEX, SIZEY, NFRAMES)

	To reinitialize when another animation is loaded:
		CW_ANIMATE_INIT, ANIMATEBASE, SIZEX, SIZEY, NFRAMES

	To load a single image:
		CW_ANIMATE_LOAD, WIDGET, IMAGE = IMAGE, FRAME = FRAME_INDEX

	To load a single image that is already displayed in an existing window:

		CW_ANIMATE_LOAD, WIDGET, FRAME = FRAME_INDEX, $
			WINDOW = [WINDOW_NUMBER [, X0, Y0, SX, SY]]

	(This technique is much faster than reading back from the window.)

	To display the animation after all the images have been loaded:

		CW_ANIMATE, WIDGET [, RATE]

	To get a copy of the vector of Pixmaps being used by the widget.
	If this routine is called, the widget does not destroy the pixmaps
	when it is destroyed. The user can then provide them to a later
	call to CW_ANIMATE to re-use them while skipping the Pixmap creation
	and rendering step:

		CW_ANIMATE_GETP, widget, PIXMAPS

 INPUTS:
   CW_ANIMATE:
		PARENT:	 The ID of the parent widget.
		SIZEX:	 The width of the displayed image.
		SIZEY:	 The height of the displayed image.
		NFRAMES: The number of frames in the animation sequence.

   CW_ANIMATE_INIT:
		ANIMATEBASE: The ID of the base animation widget.
		SIZEX:	 The width of the displayed image.
		SIZEY:	 The height of the displayed image.
		NFRAMES: The number of frames in the animation sequence.

  	CW_ANIMATE_LOAD:
		WIDGET:	 The ID of the widget (as created with CW_ANIMATE)
			 into which the image should be loaded.

   CW_ANIMATE_RUN:
		WIDGET:	 The ID of the widget (as created with CW_ANIMATE)
			 into which the image should be loaded.
		RATE:	 A value between 0 and 100 that represents the
			 speed of the animation as a percentage of the
			 maximum display rate. The fastest animation has
			 a value of 100 and the slowest  has a value of 0.
			 The default animation rate is 100.
       STOP:    If this keyword is set, the animation is stopped.
       NFRAMES: Specifies the number of frames to animate, must
                        <= the number specified in CW_ANIMATE().

 KEYWORD PARAMETERS:
   	CW_ANIMATE:
		PIXMAPS: This keyword provides the new widget with a vector
			 of pre-existing pixmap (off screen window) IDs.
			 This vector is usually obtained from a call to
			 CW_ANIMATE_GETP applied to a previous animation
			 widget.
		UVALUE:  A user supplied value to be stored in the widget's
			 user value field.
               NO_KILL: If NOT set, an "End Animation" button is added to the
			 animation base.  If set the button is not added.
		OPEN_FUNC: A user supplied string that specifies a callback
			 function name. When a value is specified for this
			 keyword, an "Open..." pushbutton is added to the
			 window.  When the "Open..." pushbutton is clicked
			 the OPEN_FUNC function is called to load new
			 animation data.
		INFO_FILE: A filename containing text to be displayed by
                        XDISPLAYFILE when user selects the help button.

   	CW_ANIMATE_INIT:
		PIXMAPS: This keyword provides the new widget with a vector
			 of pre-existing pixmap (off screen window) IDs.
			 This vector is usually obtained from a call to
			 CW_ANIMATE_GETP applied to a previous animation
			 widget.

   	CW_ANIMATE_LOAD:
		CYCLE:   If set, cycle. Normally, frames are displayed
			 going either forward or backwards. If CYCLE is
			 set, reverse direction after the last frame in
			 either direction is displayed.
		FRAME: 	 The frame number to be loaded. This is a value
			 between 0 and NFRAMES. If not supplied, frame 0
		  	 is loaded.
		IMAGE:   The image to be loaded.
		ORDER:   Set this keyword to display images from the top
			 down instead of the default bottom up. This keyword
			 is only used when loading images with the IMAGE
			 keyword.
		TRACK:   If set, the frame slider tracks the current frame.
			 Default is not to track.
		WINDOW:  When this keyword is specified, an image is copied
			 from an existing window to the animation pixmap.
			 When using X windows, this technique is much faster
			 than reading from the display and then loading with
			 the IMAGE keyword.

			 The value of this parameter is either an IDL window
			 number (in which case the entire window is copied),
			 or a vector containing the window index and the
			 rectangular bounds of the area to be copied. For
			 example:
			 WINDOW = [Window_Number, X0, Y0, Sx, Sy]

      		XOFFSET: The horizontal offset, in pixels from the left of
			 the frame, of the image in the destination window.

      		YOFFSET: The vertical offset, in pixels from the bottom of
			 the frame, of the image in the destination window.

 OUTPUTS:
	No explicit outputs.

 SIDE EFFECTS:
	If the widget is realized before calls to CW_ANIMATE_LOAD, the frames
	are displayed as they are loaded. This provides the user with an
	indication of how things are progressing.

	When the widget is destroyed, it destroys the pixmaps used in the
	animation, unless they were previously obtained via CW_ANIMATE_GETP
       and the KILL_ANYWAY keyword was not set.

	The only event returned by this widget indicates that the user
	has pressed the DONE button. The parent application should use
	this as a signal to kill the animation widget via WIDGET_CONTROL.

 RESTRICTIONS:
	If more than one animation widget is running at a time, they
	will fight for resources and run slower.

 PROCEDURE:
	When initialized, this procedure creates pixmaps containing the
	frames of the animation sequence. Once the images are loaded,
	they are displayed by copying the images from the pixmap or buffer
	to the visible draw widget.

 EXAMPLE:
	Assume the following event handler procedure exists:
		PRO EHANDLER, EV
		  WIDGET_CONTROL, /DESTROY, EV.TOP
		end

	Enter the following commands to open the file ABNORM.DAT (a series
	of images of a human heart) and load the images it contains into
	an array H:

		OPENR, 1, FILEPATH('abnorm.dat', SUBDIR = 'images')
		H = BYTARR(64, 64, 16)
		READU, 1, H
		CLOSE, 1
		H = REBIN(H, 128, 128, 16)

	Create an instance of the animation widget at load the frames:

		base = widget_base()
		animate = CW_ANIMATE(base, 128, 128, 16)
		WIDGET_CONTROL, /REALIZE, base
		for i=0,15 do CW_ANIMATE_LOAD, animate, FRAME=i, IMAGE=H(*,*,I)

	Start the animation:

		CW_ANIMATE_RUN, animate
		XMANAGER, "CW_ANIMATE Demo", base, EVENT_HANDLER = "EHANDLER"

	Pressing the DONE button kills the application.

 MODIFICATION HISTORY:
	AB, June 1992		Heavily based on the XINTERANIMATE procedure.
	SR, September 1992	Fixed a problem when a paused animation's
				frame selection was moved and the resulting
				frame change ended up in another animation.
	SR, November  1992	Fixed a problem when a single paused animation
				would fail when the frame selection slider
				event tried to set do a bad drawing window.
	DMS/AB, March, 1993	Got rid of state caching. Got rid of
				XMANAGER background tasks in favor of new
				"WIDGET_CONTROL,timer=" feature.
	ACY, October 1993	Set RETAIN=2 for draw widget to prevent
				clipping by an overlapping window when
				loading frames.
       DMS, Dec, 1993          Added STOP and NFRAMES keywords to CW_ANIMATE_RUN.
                               Added KILL_ANYWAY keyword to CW_ANIMATE_GETP.
       WSO, Jan, 1995          Added OPEN_FUNC keyword and updated UI.
       ACY, Jan, 1997          Added INFO_FILE keyword to allow user-supplied
                               files for help text

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_animate.pro)


CW_ARCBALL

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

 PURPOSE:
	CW_ARCBALL is a compound widget for intuitively specifying
	three-dimensional orientations.

 CATEGORY:
	Widget, 3d graphics

 CALLING SEQUENCE:
	Widget_id = CW_ARCBALL(Parent)

 INPUTS:
       PARENT:	The ID of the parent widget.

 KEYWORD PARAMETERS:
	FRAME:	If set, draws a frame around the widget.
		The default is FRAME=0.
	LABEL:	A string containing the widget's label.
	VALUE:	An initial value for the 3 x 3 rotation matrix. This
		must be a valid rotation matrix (no translation or
		perspective) where: transpose(value) = inverse(value).
		This can be the upper-left corner of !P.T after executing
		the command T3D, /RESET, ROTATE=[x,y,z]. The default
		is the identity matrix.
	UVALUE:	The initial user value for the widget.
	SIZE:	The size of the square drawable area containing the arcball,
		in pixels.  Default size = 192.	
	UPDATE:	If set, the widget will send an event each time
		the mouse button is released after a drag operation.
		Otherwise, an event is only sent when the Update
		button is pressed.
	COLORS:	A 6-element array containing the color indices to be used.
		  Colors(0) = View axis color
		  Colors(1) = object axis color, 
		  Colors(2) = XZ plane +Y side (body top) color, 
		  Colors(3) = YZ plane (fin) color,
		  Colors(4) = XZ plane -Y side (body bottom),
		  Colors(5) = background color.
		Default value = [ 1,7,2,3,7,0], which yields good colors
		with the TEK_COLOR table.
		  (white, yellow, red, green, yellow, black).
	RETAIN: Retain parameter for window, 0 = none, 1 = server's default,
		2 = use backing store.  default = 1.

 OUTPUTS:
	The ID of the widget is returned.

 SIDE EFFECTS:
	Events are generated as described above. The current graphics window
	is changed.

 RESTRICTIONS:
	This widget can generate any rotation about any axis.
	Not all rotations are compatible with the IDL SURFACE
	procedure, which is restricted to rotations that project the
	object Z axis parallel to the view Y axis.

 PROCEDURE:
	This widget is based on "ARCBALL: A User Interface for
	Specifying Three-Dimensional Orientation Using a Mouse", by Ken
	Shoemake, Computer Graphics Laboratory, University of Pennsylvania,
	Philadelphia, PA 19104. "In Arcball, human factors and mathematical
	fundamentals come together exceptionally well."

	The user drags a simulated track-ball with the mouse to interactively
	obtain arbitrary rotations. Sequences of rotations may be cascaded.
	The rotations may be unconstrained (about any axis), constrained to
	the view X, Y, or Z axes, or to the object's X, Y, or Z axis.

	Use the call:
		WIDGET_CONTROL, id, /SET_VALUE
	to draw the arcball after the widget is initially realized.
	Also, the SET_VALUE entry will set the widget's value to the
	given 3x3 rotation matrix and redraw the widget.

	The WIDGET_CONTROL, id, GET_VALUE=v
	call returns the current 3x3 rotation matrix.
	
 EXAMPLE:
	See the procedure ARCBALL_TEST, contained in this file.
	To test CW_ARCBALL:
	.RUN cw_arcball
	ARCBALL_TEST

 MODIFICATION HISTORY:
	DMS, RSI, September, 1993.  Written
	ACY, RSI, January, 1994.  Correct test on initial value.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_arcball.pro)


CW_BGROUP

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

 PURPOSE:
	CW_BGROUP is a compound widget that simplifies creating
	a base of buttons. It handles the details of creating the
	proper base (standard, exclusive, or non-exclusive) and filling
	in the desired buttons. Events for the individual buttons are
	handled transparently, and a CW_BGROUP event returned. This
	event can return any one of the following:
		- The Index of the button within the base.
		- The widget ID of the button.
		- The name of the button.
		- An arbitrary value taken from an array of User values.

 CATEGORY:
	Compound widgets.

 CALLING SEQUENCE:
		Widget = CW_BGROUP(Parent, Names)

	To get or set the value of a CW_BGROUP, use the GET_VALUE and
	SET_VALUE keywords to WIDGET_CONTROL. The value of a CW_BGROUP
	is:

		-----------------------------------------------
		Type		Value
		-----------------------------------------------
		normal		None
		exclusive   	Index of currently set button
		non-exclusive	Vector indicating the position
				of each button (1-set, 0-unset)
		-----------------------------------------------


 INPUTS:
       Parent:		The ID of the parent widget.
	Names:		A string array, containing one string per button,
			giving the name of each button.

 KEYWORD PARAMETERS:

	BUTTON_UVALUE:	An array of user values to be associated with
			each button and returned in the event structure.
	COLUMN:		Buttons will be arranged in the number of columns
			specified by this keyword.
	EVENT_FUNCT:	The name of an optional user-supplied event function 
			for buttons. This function is called with the return
			value structure whenever a button is pressed, and 
			follows the conventions for user-written event
			functions.
	EXCLUSIVE:	Buttons will be placed in an exclusive base, with
			only one button allowed to be selected at a time.
	FONT:		The name of the font to be used for the button
			titles. If this keyword is not specified, the default
			font is used.
	FRAME:		Specifies the width of the frame to be drawn around
			the base.
	IDS:		A named variable into which the button IDs will be
			stored, as a longword vector.
	LABEL_LEFT:	Creates a text label to the left of the buttons.
	LABEL_TOP:	Creates a text label above the buttons.
	MAP:		If set, the base will be mapped when the widget
			is realized (the default).
	NONEXCLUSIVE:	Buttons will be placed in an non-exclusive base.
			The buttons will be independent.
	NO_RELEASE:	If set, button release events will not be returned.
	RETURN_ID:	If set, the VALUE field of returned events will be
			the widget ID of the button.
	RETURN_INDEX:	If set, the VALUE field of returned events will be
			the zero-based index of the button within the base.
			THIS IS THE DEFAULT.
	RETURN_NAME:	If set, the VALUE field of returned events will be
			the name of the button within the base.
	ROW:		Buttons will be arranged in the number of rows
			specified by this keyword.
	SCROLL:		If set, the base will include scroll bars to allow
			viewing a large base through a smaller viewport.
	SET_VALUE:	The initial value of the buttons. This is equivalent
			to the later statement:

			WIDGET_CONTROL, widget, set_value=value

	SPACE:		The space, in pixels, to be left around the edges
			of a row or column major base. This keyword is
			ignored if EXCLUSIVE or NONEXCLUSIVE are specified.
	UVALUE:		The user value to be associated with the widget.
	XOFFSET:	The X offset of the widget relative to its parent.
	XPAD:		The horizontal space, in pixels, between children
			of a row or column major base. Ignored if EXCLUSIVE
			or NONEXCLUSIVE are specified.
	XSIZE:		The width of the base. 
	X_SCROLL_SIZE:	The width of the viewport if SCROLL is specified.
	YOFFSET:	The Y offset of the widget relative to its parent.
	YPAD:		The vertical space, in pixels, between children of
			a row or column major base. Ignored if EXCLUSIVE
			or NONEXCLUSIVE are specified.
	YSIZE:		The height of the base. 
	Y_SCROLL_SIZE:	The height of the viewport if SCROLL is specified.

 OUTPUTS:
       The ID of the created widget is returned.

 SIDE EFFECTS:
	This widget generates event structures with the following definition:

		event = { ID:0L, TOP:0L, HANDLER:0L, SELECT:0, VALUE:0 }

	The SELECT field is passed through from the button event. VALUE is
	either the INDEX, ID, NAME, or BUTTON_UVALUE of the button,
	depending on how the widget was created.

 RESTRICTIONS:
	Only buttons with textual names are handled by this widget.
	Bitmaps are not understood.

 MODIFICATION HISTORY:
	15 June 1992, AB
	7 April 1993, AB, Removed state caching.
	6 Oct. 1994, KDB, Font keyword is not applied to the label.
       10 FEB 1995, DJC  fixed bad bug in event procedure, getting
                         id of stash widget.
	11 April 1995, AB Removed Motif special cases.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_bgroup.pro)


CW_CLR_INDEX

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

 PURPOSE:
	CW_CLR_INDEX is a compound widget for the selection of a color
	index. A horizontal color bar is displayed. Clicking on the bar sets
	the color index.

 CATEGORY:
	Compound Widgets

 CALLING SEQUENCE:
	Widget = CW_CLR_INDEX(Parent)

 INPUTS:
	Parent:	      ID of the parent widget.

 KEYWORD PARAMETERS:
	COLOR_VALUES: A vector of color indices containing the colors to
		      be displayed in the color bar. If omitted, NCOLORS
		      and START_COLOR specify the range of color indices.
	EVENT_FUNCT:  The name of an optional user-supplied event function.
		      This function is called with the return value structure
		      whenever a button is pressed, and follows the conventions ;		      for user-written event functions.
	FRAME:        If set, a frame will be drawn around the widget.
	LABEL:        A text label that appears to the left of the color bar.
	NCOLORS:      The number of colors to place in the color bar.  
		      The default = !D.N_COLORS.
	START_COLOR:  The starting color index, placed at the left of the bar.
	UVALUE:       The user value to be associated with the widget.
	XSIZE:        The width of the color bar in pixels. The default =192.
	YSIZE:        The height of the color bar in pixels. The default = 12.

 OUTPUTS:
       The ID of the created widget is returned.

 SIDE EFFECTS:
	This widget generates event structures with the following definition:

	Event = { CW_COLOR_INDEX, ID: base, TOP: ev.top, HANDLER: 0L, VALUE: c}
	Value is the color index selected.

 PROCEDURE:
	Standard Compound widget.  Use WIDGET_CONTROL, SET_VALUE and GET_VALUE
	to change/read the widget's value.

 EXAMPLE:
	A = WIDGET_BASE(TITLE='Example', /COLUMN)
	B = CW_CLR_INDEX(A, LABEL='Color:')

 MODIFICATION HISTORY:
	DMS,	June, 1993.	Written.
	TAC,	Oct, 1993.	Changed name to cw_clr_index

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_clr_index.pro)


CW_COLORSEL

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

 PURPOSE:
	CW_COLORSEL is a compound widget that displays all the colors
	in the current colormap and allows the user to select the color
	indices via the mouse or with sliders.

 CATEGORY:
	Compund widgets.

 CALLING SEQUENCE:
 	widget = CW_COLORSEL(Parent)

 INPUTS:
	Parent:	 The ID of the parent widget.

 KEYWORD PARAMETERS:
	FRAME:	 If set, a frame is drawn around the widget.
	UVALUE:	 The user value for the widget.
	XOFFSET: The X offset position
	YOFFSET: The Y offset position

 OUTPUTS:
	The ID of the created widget is returned.

 SIDE EFFECTS:
	This widget generates event structures containing a field named
	VALUE, which contains the colormap index selected by the user.

 PROCEDURE:
	The COLORSEL widget displays all the colors in the current
	colormap in a 16x16 (320x320 pixels) grid. To select a color
	index, the user moves the mouse pointer over the desired
	color square and presses any mouse button. Alternatively, the
	color index can be selected by moving one of the three sliders
	provided around the grid.

	WIDGET_CONTROL, SET_VALUE=index can be used to set the current
		color index.

	WIDGET_CONTROL, SET_VALUE=-1 informs the widget to initialize
		itself and redraw. It should be called when any of the
		following happen:
			- The widget needs redrawing.
			- The brightest or darkest color has changed. 

	WIDGET_CONTROL, GET_VALUE=var can be used to retrieve the
		current color index.

 MODIFICATION HISTORY:
	March 30, 1992, AB
		Removed the relevant code from XPALETTE.PRO and modified
		it to create this reusable widget cluster.
	September 4, 1992, SR
		Fixed a bug where the value of the xslider was calculated
		as negative and WIDGET_CONTROL, SET_VALUE failed.
	7 April 1993, AB, Removed state caching.
	October 20, 1993, KDB 
		Changed return value in function CSEL_GET_VALUE
		from state.cur_idx to ret
	23 May 1994, AB
		Added NOTIFY_REALIZE routine to eliminate the need
		to call "WIDGET_CONTROL, SET_VALUE=-1" when the widget
		is realized.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_colorsel.pro)


CW_DEFROI

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

 PURPOSE:
   Widget to define a region of interest within a widget drawable. 
 CATEGORY:
   Regions of interest, graphics.
 CALLING SEQUENCE:
   Result = CW_DEFROI(draw)
 INPUTS:
   Draw = id of drawable to draw the region.  The drawable should
 	have both MOTION and BUTTON events enabled.
 KEYWORD PARAMETERS:
   IMAGE_SIZE = the size of the underlying array, expressed
       as a two element vector: [columns, rows].  Default =
       drawable size / zoom.
   OFFSET = offset of lower left corner of image within the
       drawable.  Default = [0,0].
   ORDER = if set, return inverted subscripts, as if the array
       were output from top to bottom.
   RESTORE = Set to restore the drawable to its previous appearance
       on exit.  Otherwise, the regions remain on the drawable.
   ZOOM = if the image array was expanded (via REBIN for example)
       specify this two element vector containing the expansion
       factor in X and Y.  Default = [1,1].  Must be integer.
 OUTPUTS:
      Result = subscripts of points within the region[s] defined.
       If no region was defined, a scalar -1 is returned.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       The regions are drawn within the drawable.  Set the RESTORE
       keyword to undo the damage.  
 RESTRICTIONS:
   This is a MODAL widget.  No other widget applications will be
   responsive while this widget is in use.

 PROCEDURE:
   Complicated.
 EXAMPLE:
   To obtain the average of the counts of a region within a drawable:
   Assume A = the array of interest, n columns, m rows, and that
   it is displayed in drawable D, at offset X=20, Y=100, and zoomed
   with a factor of 2:
       TV, REBIN(A, M*2, N*2), 20, 100     ;Display the image
       q = CW_DEFROI(D, ZOOM=[2,2], OFFSET=[20,100], IMAGE_SIZE=[m,n])
       if q(0) ne -1 then print,'Average = ', total(a(q))/n_elements(q)
       
 MODIFICATION HISTORY:
   DMS, RSI, December, 1993.  Written.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_defroi.pro)


CW_DICE

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

 PURPOSE:
	CW_DICE is a compound widget that implements a single die.
	This widget uses a button with a bitmap label.

	The primary purpose of this compound widget is to serve as
	a full example of a realistic compound widget for the IDL
	User's Guide.

 CATEGORY:
	Compound widgets.

 CALLING SEQUENCE:
	Widget = CW_DICE(Parent)

 INPUTS:
       Parent:	  The ID of the parent widget.

 KEYWORD PARAMETERS:
	TUMBLE_CNT: The widget simulates the tumbling of a dice by
		changing the bitmap on the dice several times before
		settling down to a final value. The number of "tumbles"
		is specified by the TUMBLE_CNT keyword. The default is 10.
	TUMBLE_PERIOD: The amount of time in seconds between each tumble
		of the dice. The default is .05 seconds.
	UVALUE:	  The user value for the widget.

 OUTPUTS:
       The ID of the created widget is returned.

 COMMON BLOCKS
	CW_DICE_BLK: Used to store dice faces, and the current
		random number generator seed for the CW_DICE class.

 SIDE EFFECTS:
	This widget generates event structures containing an extra
	field named VALUE giving the final value resulting from a dice roll.
	Such events are only sent when the user presses the dice button.

 PROCEDURE:
	The CW_DICE widget consists of a single pushbutton that
	displays its current dice value as a bitmask. If the user presses
	the button, it tumbles for a moment and then the new value is
	displayed and an event is issued.

	The current value of the dice is available via the
	WIDGET_CONTROL,GET_VALUE command.

	The current value can be set by issuing the
	WIDGET_CONTROL, SET_VALUE command. If the requested value is
	outside the range [1,6], then the dice tumbles to a new value
	as if the user had pressed the button, but no event is issued.

 MODIFICATION HISTORY:
	24 October 1993, AB, RSI
	16 April 1996, RPM, RSI - Fixed name of WIDGET_TIMER event.
				  Fixed check of dice value range.

(See /host/bluemoon/usr2/idllib/idl_5.2/lib/cw_dice.pro)


CW_FIELD

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

 PURPOSE:
	This widget cluster function manages a data entry field widget.
	The field consists of a label and a text widget.  CW_FIELD's can
	be string fields, integer fields or floating-point fields.  The
	default is an editable string field.

 CATEGORY:
	Widget Clusters.

 CALLING SEQUENCE:
	Result = CW_FIELD(Parent)

 INPUTS:
	Parent:	The widget ID of the widget to be the field's parent.

 KEYWORD PARAMETERS:
	TITLE:	A string containing the text to be used as the label for the
		field.  The default is "Input Field:".

	VALUE:	The initial value in the text widget.  This value is
		automatically converted to the type set by the STRING,
		INTEGER, and FLOATING keywords described below.

	UVALUE:	A user value to assign to the field cluster.  This value
		can be of any type.

	FRAME:	The width, in pixels, of a frame to be drawn around the
		entire field cluster.  The default is no frame.

RETURN_EVENTS:	Set this keyword to make cluster return an event when a
		 is pressed in a text field.  The default is
		not to return events.  Note that the value of the text field
		is always returned when the WIDGET_CONTROL, field, GET_VALUE=X
		command is used.

   ALL_EVENTS: Like RETURN_EVENTS but return an event whenever the
		contents of a text field have changed.

	COLUMN:	Set this keyword to center the label above the text field.
		The default is to position the label to the left of the text
		field.

	ROW:	Set this keyword to position the label to the left of the text
		field.  This is the default.

	XSIZE:	An explicit horizontal size (in characters) for the text input
		area.  The default is to let the window manager size the
		widget.  Using the XSIZE keyword is not recommended.

	YSIZE:	An explicit vertical size (in lines) for the text input
		area.  The default is 1.

	STRING:	Set this keyword to have the field accept only string values.
		Numbers entered in the field are converted to their string
		equivalents.  This is the default.

     FLOATING:	Set this keyword to have the field accept only floating-point
		values.  Any number or string entered is converted to its
		floating-point equivalent.

      INTEGER:	Set this keyword to have the fi