Varosi vlib AstroContrib 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:18:21 2000.

List of Routines


Routine Descriptions

ACCUMULATE

[Next Routine] [List of Routines]
 NAME:
	accumulate
 PURPOSE:
	Perform running accumulation of one of the dimension in 2D array,
	for example, a matrix of histograms. 
 CALLING:
	haccum = accumulate( histogs )
 INPUTS:
	histogs = matrix ( Nbins, Nhistog ) of histograms to accumulate,
		or any 2D array to be accumulated in first dimension.
 KEYWORDS:
	/NO_TRANSPOSE : assume input matrix of histograms is already transposed,
		accumulation is performed on second dimension of input matrix.
 HISTORY:
	Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/accumulate.pro)


ADD_STRUCT

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

 PURPOSE:
	Add the tag values of two structures in nice column format.
	Tags are chosen by wildcard matching.

 CALLING:
	add_struct, struct_in_out, struct_add, TAG_MATCH=tag_match

 INPUTS:
	struct_in_out = structure to which values are added.
	struct_add = tag values of this structure are added to struct_in_out.

 KEYWORDS:

 OUTPUTS:
 EXTERNAL CALLS:
	function N_struct
	function unique
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1999.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/add_struct.pro)


ADJCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	adjct
 PURPOSE:
	My interface to replace standard adjct with adjctmap (my version)
 CALLING:
	adjct
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/adjct.pro)


ADJCTMAP

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

 PURPOSE:
	Interactively adjusts color tables using mouse input.
	This version is designed (by F.V.) to work with procedures:
		color_map_Load,
		color_struct,
		color_st_Load,
		hist_equal_ct,
	by saving the color table mapping and parameters in common.
	Also, the color bar is put on horizontal axis (more intuitive).

 CALLING:
	adjctmap

 KEYWORDS:
	XPOSITION = x position of interaction window on screen
	YPOSITION = y position of interaction window on screen

 SIDE EFFECTS:
	Color tables are modified (rgb_orig is mapped into rgb_curr).

 COMMON BLOCKS:
	adjct_map, color_map  : keeps pixel value to color table mapping.
	adjct_ramp, oldx, oldy  : keeps RAMP mapping parameters.
	NOTE: common colors - color table common block (rgb_orig , rgb_curr),
			is modified by pro color_map_Load.

 EXTERNAL CALLS:
	pro menus  - to handle selection of operation types.
	pro color_map_Load  - apply pixel value to color table mapping,
				and load color tables (tvlct).
	function select_number  -  called for steps option only.

 PROCEDURE:
	A new window is created and a graph of the color output value
	versus pixel value is created. User can adjust this transfer function
	a number of ways using the mouse (explained in help option).

 HISTORY:
	DMS, March, 1988, written.
	DMS, April, 1989, modified cursor handling to use less CPU
	Frank Varosi Oct.1989, added the STEPS option #3 (not all finished).
	FV Nov.89, put color bar on horizontal axis (more intuitive).
	FV Jan.90, saved color_map (=p) in common
		  and call color_map_Load instead of tvlct (map is remembered).
	FV Feb.90, saved oldx & oldy in common adjct_ramp (ramp is remembered).
	FV Nov.90, use modified version of pro menus for initial choice setup.
	FV Dec.91, apply smoothing to reduce jitter in draw curve option.
	FV 1992, added keywords XPOS and YPOS.
	FV 1993, changed name from adjct to adjctmap (so as not to confuse).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/adjctmap.pro)


ALIGN_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ALIGN_STRUCT
 PURPOSE:
	Check an IDL structure for standard memory alignment of fields,
	insert any byte padding required to align fields on size boundaries,
	write out new code to define the aligned version of structure.
 CATEGORY:
			Structures
 CALLING SEQUENCE:
			align_struct, structure_name
	examples:
			align_struct, "fdq_sdf"
 INPUTS:
		structure_name = string giving the structure name
				as known by IDL (help,/struct,variable).

 inputs/outputs used recursively:
		struct = the structure variable currently analyzed.
		Max_Field_Size = size of the largest field found in structure.
		struct_size = total size of all fields in structure.
		Lun_out = Logical unit number for writing .PRO code.

 SIDE EFFECTS:
		"structure_name"_ST_AL.PRO is created (IDL function code).
 PROCEDURE:
		Strategy is to call align_struct recursively.

  otherwise the field type and size is used to construct IDL definition,
	which is then concatenated with the other IDL definitions,

 MODIFICATION HISTORY:
	written 1990 Frank Varosi STX @ NASA/GSFC

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/align_struct.pro)


ASTRO_TICKS[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	astro_ticks
 PURPOSE:
	Create nice Labels for R.A. or DEC given range of degrees.
 CALLING:
	astro_ticks, degrees, nticin, ticvals, ticLabs, mtics
 INPUTS:
	degrees = array of degrees.
	nticin = suggested # of ticks.
 KEYWORDS:
	/RA : to indicate that Labels are for R.A. axis. (hours,..etc.)
 OUTPUTS:
	ticvals = float array, location of major ticks.
	ticLabs = string array, Labels for major ticks.
	mtics = # of minor tick marks.
 EXTERNAL CALLS:
	function Ten
	function sixty
 PROCEDURE:
	Very many "if" statements.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989, based on
		"tics.pro" and "ticlabels.pro" from IDL-astron-Library.
	F.V. 1991, make seconds start on multiple of 5 or 2 if inc = 5 or 2 .

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/astro_ticks.pro)


ASTRO_TICKS[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	astro_ticks
 PURPOSE:
	Read R.A. and DEC from user, convert and return as degrees.
	User input can be delimeted with commas, spaces or ":".
 CALLING:
	read_radec, asc,dec
 INPUTS:
	asc = default value of Right Ascension.
	dec = default value of Declination.
 OUTPUTS:
	asc = degrees Right Ascension.
	dec = degrees Declination.
 EXTERNAL CALLS:
	function Ten
	function sixty
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989, based "radec.pro" in astro-Lib.
	F.V. 1991, added option to use default values.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/read_radec.pro)


BACKGROUND

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/background.pro)


BANDPASS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	bandpass
 PURPOSE:
	Compute flux thru bandpass filter of given transmission at wavelengths.
	Optionally, flux and/or transmission is integrated in Log-Log space
	(see keyword POWER_LAW), default is integration in Linear-Linear space.
 CALLING:
	Fobs = bandpass( Lambda, Flux, W=waveT, T=Trans )
 INPUTS:
	Lambda = wavelengths in microns.
	Flux = radiation spectrum at wavelengths of Lambda array.
		Units are assumed to be energy/Hertz.
 KEYWORDS:
	WAVELENGTH = wavelengths (microns) of bandpass filter transmission.
	TRANSMISSION = transmission coefficients at wavelengths.
	/MICRON : then assumes Flux is in units of energy/micron.
	/POWER_LAW_INT : use power law interp for flux, linear interp for
		transmission, and power law integral for flux * transmission.
	POWER_LAW_INT=2 : use power law interp/integral for flux & transmission.
 OUTPUTS:
	Returns the integral of the product of Flux times Transmission.
 EXTERNAL CALLS:
	function unique
	function finterpol
	function Trapow
	function Trapez
 PROCEDURE:
	Apply reform to inputs just in case they were passed as Flux(i,*) etc.
	Interpolate both flux and transmission to single merged wavelength grid
	and integrate the product. Optionally, flux and/or transmission
	is interpolated/integrated in Log-Log space (see keyword POWER_LAW),
	whereas default is interpolation/integration in Linear-Linear space.
 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1995.
	FV, 1998, mod to skip interp if wavelength grids match.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/bandpass.pro)


BIN2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Bin2D
 PURPOSE:
	Create a density image (2D histogram) from arrays of (x,y) points,
	or create an image of a function from arrays of ( x, y, f(x,y) ) data.
	In first case each pixel counts # of (x,y) points falling into
	a 2D bin (box), thus forming an image of counters. In optional case,
	each pixel is the average of all f(x,y) data falling into the box.
	Boxes are determined by dividing the (x,y) range into a uniform grid.
 CALLING EXAMPLES:
	imh = Bin2D( x, y, NPIX=64, XRAN=[0,20], YRAN=[-5,5] )
	imz = Bin2D( x, y, FXY=z, NPIX=[200,100] )
 INPUTS:
	X = array (any dimension) of x values.
	Y = array of y values, should correspond to x array.
		optionally, x can be of the form [[x],[y]]
		containing both x and y coordinates as rows of matrix,
		and then argument y should not be specified.
 KEYWORDS:
	XRAN and YRAN : specify the x,y range to be mapped into the image.
			Common Bin2D, xminc,xmaxc, yminc,ymaxc
			can also specify the x,y range if keywords are not used,
			otherwise the defaults = min-max ranges of x and y.
	NPIXELS = 1 or 2 element integer array specifying size of result,
			(single value means square image), default = [64,64].
      /NOCLIP means do not bother checking if (x,y) are within range (faster).
	TYPE_VAR = type code specifying the IDL variable type of result,
		(1=byte, 2=short, 3=Long, 4=float,... default=2, short integer).
 KEYWORDS (optional):
	IMAGE_DENSITY = an existing image of counters (2D histogram)
			to which the result is added (overrides NPIX=).
	FXY = array giving z = f(x,y) for the purpose of binning into an image
		however, bins with no (x,y) data points are left = zero.
		(NOTE: must specify XRAN and YRAN, or set /NOCLIP).
   if /BOTH is set and FXY=z is given, then the binned image of z=f(x,y) is
		returned by function, and an image of (x,y) density is
		returned via the keyword IMAGE_DENSITY.
 OUTPUTS:
	Result of function is an image of the density of (x,y) points, or an
	image of scalar field function if z values are given at (x,y) points.
 PROCEDURE:
	Binning is performed by finding number of (x,y) duplicates
	at each pixel,  using the IDL sort and where functions.
 HISTORY:
	written Frank Varosi, U.of MD., 1988.
		F.V. 1990, modif. for IDL-V2.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/bin2d.pro)


BIN3D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Bin3D
 PURPOSE:
	Create a volume density (3D histogram) from arrays of (x,y,z) points,
	or create a voxel matrix from arrays of ( x,y,z, f(x,y,z) ) data.
	In first case each voxel counts # of (x,y,z) points falling into
	a 3D bin (box), thus forming an image of counters. In optional case,
	each voxel value is the average of f(x,y,z) data falling in box.
	Boxes are determined by dividing the (x,y,z) range into a uniform grid.
 CALLING:
	imh = Bin3D( x, y, z, NVOX=64, XRAN=[0,20], YRAN=[-5,5] )

	imz = Bin3D( x, y, z, FXYZ=z, NVOX=[200,100,50] )

 INPUTS:
	x = array (any dimension) of x values.
	y = array of y values, should correspond to x array.
	z = array of z values, corresponding to x array.

	Optionally, x can be of the form [[x],[y],[z]]
		containing all x, y and z coordinates as rows of matrix,
		and then arguments y and z should not be specified.
 KEYWORDS:
	XRAN, YRAN, ZRAN : specify the x,y,z range to be mapped into the image.
			otherwise the defaults = min-max ranges of x and y.
	NVOXELS = 1 or 3 element integer array specifying size of result,
			(single value means square image), default = [64,64,64].
      /NOCLIP : do not bother checking if (x,y,z) are within range (faster).
	TYPE_VAR = type code specifying the IDL variable type of result,
		(1=byte, 2=short, 3=Long, 4=float,... default=2, short integer).

 KEYWORDS (optional):
	VOXEL_DENSITY = an existing image of counters (3D histogram)
			to which the result is added (overrides NVOX=).
	FXYZ = array giving f(x,y,z) for the purpose of binning into voxels,
		however, bins with no (x,y,z) data points are left = zero.
		(NOTE: must specify XRAN, YRAN, ZRAN, or set /NOCLIP).
   if /BOTH is set and FXYZ=f is given, then the binned image of z=f(x,y,z) is
		returned by function, and voxel density of (x,y,z) is
		returned via the keyword VOXEL_DENSITY.
 OUTPUTS:
	Result of function is voxel density of (x,y,z) points, or an
	scalar field of voxels if f(x,y,z) values are given.
 PROCEDURE:
	Binning is performed by finding number of (x,y,z) duplicates
	at each voxel,  using the IDL histogram, sort and where functions.
 HISTORY:
	written Frank Varosi, U.of MD., 1988.
		F.V. 1990, modif. for IDL-V2.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/bin3d.pro)


BIN_SCAT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Bin_Scat
 PURPOSE:
	Given two arrays of data that are in one-to-one correspondence
	(such as a functional relationship), calculate averages and
	standard devations of the second array within bins that
	are determined by the histogram of the first array.
	Using this technique, a scatter plot of y versus x can be
	displayed instead as a graph of bin averages with error bars.
	Results are returned via keywords.

 CALLING:
	Bin_Scat, x, y

 INPUTS:
	x = this array is binned using histogram
	y = usually a function of x, this array is averaged over bins
		corresponing to the x array.

 KEYWORD INPUTS:

	NBIN = # of bins desired, default=100.
	BINSIZE = the desired binsize, overrides NBIN,
		but NBIN will still limit the maximum # of bins.

	MIN = minimum data value to include in histogram.
	MAX = maximum data value to include in histogram
	     (defaults are actual min or max of data).

	/SUM : setting this keyword causes total of y-values in each bin
		to be computed (instead of the default mean, st.dev., median).

 KEYWORD OUTPUTS:

	XBINS = array of histogram bins between min & max.
	XHISTOGRAM = number of x values in each bin.
	MEAN = array of means of y values corresponding to x values in each bin.
	STDEV = array of standard deviations of y values corresponding to means.
	MEDIAN = array of medians of y values in each x-bin.
	TOTAL = array of totals of y values in each x-bin (if /SUM is set).

 EXTERNAL CALLS:
	function Histo	(this sets up and calls IDL histogram function)
	function stdev
 PROCEDURE:
	Use the reverse indices keyword of the IDL histogram function
	(called via function Histo for which third argument is reverse indices).
 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/bin_scat.pro)


BLINKDRAG_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	blinkdrag_image
 PURPOSE:
	Blink an image (alternately displaying image and background), 
	drag it across window using mouse-cursor until a button is pressed.
	New location of image and mouse button value are returned.
	In X-windows, the window backing store should be pixmap,
	that is, use device,RETAIN=2  or window,RETAIN=2,...
	for fastest blinking of image.
 CALLING:
	button = blinkdrag_image( ioffx, ioffy, image, Locx, Locy )
 INPUTS:
	ioffx & ioffy = Location of cursor inside the image (in device pixels)
			offset relative to lower-left corner.
	image = byte image to display, blink and drag.
	Locx & Locy = starting Location (pixels) of lower-left corner of image.
 KEYWORDS:
	WAIT_DISPLAY = seconds to wait after displaying image to equalize blink,
			default = 0.003 seconds, seems to work.
 OUTPUTS:
	Locx & Locy = ending Location of lower-left corner of image
				(in device pixels) after a button is pressed.
	Result of function is value of !mouse.button.
 EXAMPLE:
	Locx=100  &  Locy=100
	button = blinkdrag_image( 0, 0, image, Locx, Locy )
 COMMON BLOCKS:
	common blinkdrag1, wait_image, wait_back	;wait times in millisec.
	common blinkdrag2, aex, aey, cex, cey		;for overlay of ellipse.
 PROCEDURE:
	Sparcstation running SunView is faster than X-windows,
	so use waits to stall the blink times, otherwise too much flicker.
	For X-windows use PIXMAP and device,COPY=[...] instead of tv and tvrd.
 HISTORY:
	written Frank Varosi NASA/GSFC 1989
	F.V. 91, mod to keep tvrd in window, since idl-v.2.1.2 demands it.
	F.V. 92, split into two loop codes for different display types.
	F.V. 96, added option to overlay ellipse (coordinates in common).
	F.V. 97, can now set blinking image/background display times in common.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/blinkdrag_image.pro)


BORDER_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 Draw a one pixel width border around an image on screen at
  window device coordinates (xmin,ymin,xmax,ymax) (can be negative).
 If image is only partially in window, the partial border is drawn.
 Default color is !D.table_size-1,
  and if arg. number is specified it is printed at left bottom corner of image.
Frank Varosi NASA/GSFC 1989
F.V. 1991, option to pass (xmin,ymin,xmax,ymax) vector in 1st. arg. 
					and keyword COLOR overrides arg. color.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/border_image.pro)


BOX_CREATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	box_create
 PURPOSE:
	Interactively create a box using the cursor/mouse
	in a rubber-band fashion. First click LEFT button for corner,
	then drag and click MIDDLE or RIGHT for final corner.
	Device coordinates of lower left & upper right corners, are output.
	Function returns status = -4 if first click is RIGHT button (abort),
	else if first click is LEFT button (to start rubber-box) then
	return status = 2 or 4 for MIDDLE or RIGHT buttons, respectively.
 CALLING:
	status = box_create( xLow, yLow, xUp, yUp )
 INPUTS:
	none
 OUTPUTS:
	xLow, yLow = device coordinates of lower left corner.
	xUp,  yUp  = device coordinates of upper right corner.
 KEYWORDS:
	/CENTERED causes box to be centered on point selected
			by first mouse click
	/DATA_COORDIN causes coordinates of box to be converted to data space,
			(default is device coordinates).
	/DOUBLE_BOX : box is drawn as 2 rectangles,
			outer is dark, (min color index),
			inner is bright (max color index),
			to help assure visibility against any background.
 EXTERNAL CALLS:
	pro box_draw
	pro box_erase
	pro box_draw2
	pro box_erase2
 COMMON BLOCKS:
	common box_draw
 PROCEDURE:
	Loop on box_draw and box_erase while reading cursor coordinates.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1991 added option to center rubber box around first point selected.
	F.V. 1993 added option to convert to data coordinates.
	F.V. 1997 added /DOUBLE_BOX option.
	F.V. 1998, wait until mouse button is RELEASED (/UP) before returning.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_create.pro)


BOX_CURSOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Box_Cursor
 PURPOSE:
	Emulate the operation of a variable sized box cursor.
	The box is constrained to lie entirely within the window.
 CATEGORY:
	Interactive graphics.
 CALLING SEQUENCE:
	Box_Cursor, x0, y0, nx, ny [, /INIT, /FIXED_SIZE, /ADJACENT, /CONTIN ]
 INPUTS:
	No required input parameters.
 OPTIONAL INPUT PARAMETERS:
	x0, y0, nx, & ny : initial location and size of the box,
		required if the keyword INIT is set.
		Otherwise, the box is initially in the center of the screen.
 KEYWORD PARAMETERS:
	/INIT : x0,y0, nx,ny are used as the initial parameters for the box.
	/FIXED_SIZE : nx and ny contain the initial size of the box,
			and this size cannot be changed by the user.
	/ADJACENT : cursor is kept adjacent to box (one pixel lower than box).
	/CENTERED : cursor is kept centered in box.
	/CONTINUOUS : cursor movement is read continuously,
		any mouse button pressing will exit. Default is to click
		left button to move, middle to change size, right to exit.
	/KEEP_BOX : box is left drawn in window, otherwise it is erased on exit.
 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. 
 SIDE EFFECTS:
	A box is drawn in the currently active window.  It is erased on exit.
 RESTRICTIONS:
	Works only with window system drivers.
 EXTERNAL CALLS:
	pro box_draw	(if /KEEP_BOX)
 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 window.
	Operation is as follows:
	Left Mouse button:  Move the box by dragging or clicking.
	Middle Mouse button:  Resize the box by dragging or clicking.
	Right mouse button:  Exit procedure, returning current box parameters.
 MODIFICATION HISTORY:
	DMS, April, 1990.
	FV, 1992, rearranged and added more options: /ADJACENT, /CONTINUOUS
	FV, 1994, added more options: /KEEP_BOX, /CENTERED

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_cursor.pro)


BOX_DRAW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	box_draw
 PURPOSE:
	Draw a Box (rectangle) in the current window, with specified color,
	first saving the data in common,
	so it can be later restored with pro box_erase.
 CALLING:
	box_draw, x1,y1, x2,y2, color
 INPUTS:
	x1, y1 = device coordinates of lower left corner.
	x2, y2 = device coordinates of upper right corner.
	color = index to color table, default = !D.table_size-1
 KEYWORDS:
   Alternate (overrides args.) method of specifying box:
	RADIUS_XY = radius of box, 1 or 2 integers, default=1.
	SIZE_XY = diameter of box, 1 or 2 integers (overrides radius).
	POS_XY = 2 integers, specifying position of box center if RADIUS given,
		or specifying position of box lower-left corner if SIZE given.
	COLOR = index to color table, default = !D.table_size-1
 OUTPUTS:
	none
 COMMON BLOCKS:
	common box_draw
 PROCEDURE:
	If size of box > 16 :
	read pixels at sides of desired box using TVRD, store into common,
	display the four sides of box using TV.
	If size of box < 16 :
	read all pixels in desired box using TVRD, store into common,
	set the border to desired color, redisplay using TV.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1990, if Box < 16x16 then save and redisplay with interior also.
	F.V. 1992, added keywords POS=[x,y] and RADIUS=(radius or [radx,rady]).
	F.V. 1993, option to pass all 4 coordinates in first argument.
	F.V. 1995, option to pass [x,y] coordinates in first 2 arguments.
	F.V. 1997, added full argument presence checking.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_draw.pro)


BOX_DRAW2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	box_draw2
 PURPOSE:
	Draw two boxes (rectangles) in the current window,
	the first with specified color at specified location,
	the second just around the first with minimum color index (black)
	so that the double box can be seen against any background image.
	The window image data is saved in common
	so that the double box can be erased with box_erase2.
 CALLING:
	box_draw2, POS_XY=, RADIUS_XY=, SIZE_XY=, COLOR=
 KEYWORD INPUTS:
	RADIUS_XY = radius of box, 1 or 2 integers.
	SIZE_XY = diameter of box, 1 or 2 integers (overrides radius).
	POS_XY = 2 integers, specifying position of box center if RADIUS given,
		or specifying position of box lower-left corner if SIZE given.
	COLOR = index to color table, default = !D.table_size-1
 OUTPUTS:
	none
 EXTERNAL CALLS
	pro box_draw
	pro box_save
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_draw2.pro)


BOX_ERASE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	box_erase
 PURPOSE:
	Erase the box (restore what was there)
	drawn by previous call to box_draw,
	only if current window is the one in which box was drawn.
 CALLING:
	box_erase
 KEYWORDS:
	/RESET : just clear common block, no changes to window.
 OUTPUTS:
	none
 COMMON BLOCKS:
	common box_draw
 PROCEDURE:
 HISTORY:
	Frank Varosi NASA/GSFC 1989
	F.V.1992 added /RESET option to just forget box (clear out common).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_erase.pro)


BOX_ERASE2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	box_erase2
 PURPOSE:
	Erase the double box (restore what was there)
	drawn by previous call to box_draw2,
	only if current window is the one in which box was drawn.
 CALLING:
	box_erase2
 KEYWORDS:
 OUTPUTS:
	none
 COMMON BLOCKS:
	common box_draw
 EXTERNAL CALLS
	pro box_erase
	pro box_save
 PROCEDURE:
 HISTORY:
	Frank Varosi NASA/GSFC 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_erase2.pro)


BOX_SAVE

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/box_save.pro)


BREAK_FILE

[Previous Routine] [Next Routine] [List of Routines]
NAME:
	break_file
PURPOSE:
	Given a file name, break the filename into the parts
	of disk/logical, the directory, the filename, the
	extension, and the file version (for VMS)
INPUT:
	file	- The file name
OUTPUT:
	disk_log- The disk or logical (looks for a ":")
		  This is generally only valid on VMS machines
	dir	- The directory
	filnam	- The filename (excluding the ".")
	ext	- The filename extension (including the ".")
	fversion- The file version (only VMS)
	node	- The Node name (only VMS)
RESTRICTIONS:
	VMS:
		Assumes that : always precedes []
	ULTRIX:
		Right now it has trouble with the ultrix option of use
		of "." or ".."
HISTORY:
	Written 1988 by M.Morrison
	   Aug-91 (MDM) Changed to handle Unix filename convensions
	28-Feb-92 (MDM) * Adjusted to handle arrays
	11-Mar-92 (MDM) - Perform a STRTRIM(x,2) on input string before
			  doing the "break-up"
	 1-Dec-92 (MDM) - Moved code to do filename, extension and version
			  number for both VMS and Unix (previously it
			  did not do version number code for Unix)
       29-Jan-93 (DMZ/MDM) - checked for node in file name

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/break_file.pro)


CALL_FUNCTION

[Previous Routine] [Next Routine] [List of Routines]
 For compatibility of Sun386i version of IDL with newer versions.
 Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/call_function.pro)


CENTROID

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
     centroid
 PURPOSE:
     Compute centroid coordinates of a stellar image as in DAOPHOT FIND.
 CALLING SEQUENCE: 
     centroid, image, XCEN, YCEN, XY_PEAK=[x,y], [FWHM=fwhm], [/PEAK_LOC]
 INPUTS:     
     image - Two dimensional image array
 KEYWORDS:
     XY_PEAK = [x,y] vector of 2 integers giving approximate stellar center.
		Pixel at maximum in subimage will then be used to start.
		If not specified then max pixel of whole image is used.
     FWHM - floating scalar or 2 elements (for x & y), default FWHM = 3 pixels.
		Centroid computed in box of half width = 1.5*sigma = 0.637*FWHM
    /PEAK_LOCATE - causes the peak (maximum pixel) of image to be used
		as approximate stellar center (overrides XY_PEAK).
 OUTPUTS:   
     XCEN - floating scalar, giving the computed X centroid position
     YCEN - floating scalar, giving the computed Y centroid position
          Values for XCEN and YCEN will not be computed if the
          centroid falls outside of the box, or if the computed derivatives
          are non-decreasing.   If the centroid cannot be computed, then a 
          message is displayed and XCEN and YCEN are set to -1.
 RESTRICTIONS: 
    Program does not check if the input X and Y position falls within image.
 SYSTEM VARIABLES:
    !DEBUG - If set, the subarray used to compute the centroid is printed
 EXTERNAL CALLS:
		pro Locate_Peak, image, xmax, ymax
 PROCEDURE: 
    Maximum pixel within distance from input pixel X, Y  determined 
    by FHWM is found and used as the center of a square, within 
    which the centroid is computed as the value (XCEN,YCEN) at which 
    the derivatives of the partial sums of the input image over (y,x),
    with respect to (x,y), equal zero.
 MODIFICATION HISTORY:
    Written 2/25/86, by J. K. Hill, S.A.S.C., following
    			algorithm used by P. Stetson in DAOPHOT.
    Added vector subscripting, W. Landsman   5/21/87
    Mod: F.Varosi 1991-92, changed name from CNTRD to CENTROID, optimized,
		changed SUM calls to SUM_ARRAY, added keyword XY_PEAK=[x,y],
		option /PEAK_LOC to locate and use maximum,
		add 0.5 to centroid x & y values so it is in center of pixel.
    Edit: FV 1999, added more comments explaining keywords in header info.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/centroid.pro)


CHECK_DIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       check_dir
 PURPOSE:
	Check if a directory actually exists on a UNIX system,
	for VMS this function checks whether a sub-directory exits.
 CALLING:
       dir_existing = check_dir( directory )
 INPUT: 
       directory = string, full name of directory (sub-directory on VMS).
 OUTPUT:
       Function returns the directory name if it exists,
	else if directory does not exist it returns null string.
	On UNIX: directory name is appended with / ,
	on VMS if is string of form: [.sub-dir] .
 RESTRICTIONS:
	Have not tested on MacOS or Win32, probably does not work.
 HISTORY:
       Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/check_dir.pro)


CHISQ_FIT

[Previous Routine] [Next Routine] [List of Routines]
	chisq_fit

Example to show how to find the parameters of a nonlinear function
 which minimizes the chi-sq of fit to some (x,y) data, using minf_conj_grad.

Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/chisq_fit.pro)


CHKARG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	chkarg
 PURPOSE:
	determine calling arguments of procedure or function
 CATEGORY:
	utility
 CALLING SEQUENCE:
	chkarg
 INPUTS:
	name  = string containing the name of the procedure. 
 KEYWORDS:
	PATH  = optional directory/library search path.  Same format
		and semantics as !PATH.  If omitted, !PATH is used.
 OUTPUTS:
       name  = name of routine
	proc  = string array with lines of procedure 
       lname = libr/direc location of procedure
 PROCEDURE:
       Based on DOC_LIBRARY
 RESTRICTIONS:
       Cannot access built-in IDL procedures
 MODIFICATION HISTORY:
       Written DMZ (ARC) Oct 1990
       Converted to version 2 (DMZ Jul'92)

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/chkarg.pro)


CHOOSE_N_COLORS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	choose_N_colors
 PURPOSE:
	Allow user to choose number of colors to use for color table,
	or else take whatever number is available.
 CALLING:
	choose_N_colors
 INPUTS:
	None.
 KEYWORDS:
	DEFAULT_NCOL = (default = 100).
	/YES_CHOOSE : assume yes answer to first question, so as to skip
			ahead to choosing # of colors.
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function yes_no_menu
	function get_text_input
	pro print_struct
 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/choose_n_colors.pro)


CIRCINT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
    CIRCINT
 PURPOSE:
    Integrate flux in circular apertures.  User responsible for 
    subtracting sky first.  See notes (1) and (2) below.
 CALLING SEQUENCE:
    circint, image, x0, y0, radii, totdif, npixdif, t8, n8

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/circint.pro)


COLOR_MAP_LOAD

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

 PURPOSE:
	Apply pixel value to color index mapping, and load color tables.
	Pixel value zero is always mapped to color # zero,
	and max value mapped to color # Lastcolor,
	Mapping is saved in common adjct_map, cmap.

 CALLING:
	color_map_Load, color_map, Lastcolor, /RELOAD

 INPUTS:
	color_map = array of indices, mapping pixel values to color numbers.

	Lastcolor = optional, specifies last color index to use.
			(default Lastcolor = !D.table_size-1)

 KEYWORDS:
	/RELOAD just uses previous mapping from common adjct_map, cmap
		so that input color_map is ignored.

 EFFECTS:
	R_orig, G_orig, B_orig is mapped to R_curr, G_curr, B_curr,
	the common adjct_map, cmap, is updated,
	the new color table and mapping is applied to window system (tvlct).

 COMMON BLOCKS:
	common colors, R_orig, G_orig, B_orig, R_curr, G_curr, B_curr
	common adjct_map, cmap

 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_map_load.pro)


COLOR_RESTORE

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

 PURPOSE:
	Restore RGB_MAP structure variable  from an IDL save file
	and then load the color table and mapping.
	If variable  not in file then assume old type with .

 CALLING:
	color_restore, file_name

 INPUTS:
	file_name = string, name of IDL save file containing variable: colors.

 EFFECTS:
	Color table of frame buffer is modified (using TVLCT).

 EXTERNAL CALLS:
	pro color_st_Load

 COMMON BLOCKS:
	common colors, ro,go,bo, rc,gc,bc
	common adjct_map, color_map
	common adjct_ramp, rampx, rampy
	common color_options, ct_map_reset, ct_feedback
	common color_table1, table_name

 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991
		(code from pro color_tables, first written 1989).
	F.V.1997, interpolate the old rc,gc,bc color arrays if needed.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_restore.pro)


COLOR_SAVE

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

 PURPOSE:
	Save RGB table and mapping as an IDL save file,
	into subdirectory called "colors", or current directory.

 CALLING:
	color_save, filsav

 INPUTS:
	filsav = string, the name of file in which to save RGB table-mapping,
		(default = "current"), and ".rgb" is added at end of name.

 EFFECTS:
	File containing color-table-structure is created as "filename.rgb",
	in subdirectory "colors" if it exists, else in current directory.

 EXTERNAL CALLS:
	pro find_dir
	pro color_struct

 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1990, save as structure given by function color_struct.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_save.pro)


COLOR_SCALE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:	
	color_scale
 PURPOSE:
	Display a color bar with numerical scale in its own window,
	or optionally in some other window (see tvs.pro for example).
 CALLING:
	color_scale, minvalue, maxvalue, topval, scale_type, title
 INPUTS:
	minvalue = min value (bottom) of scale.
	maxvalue = max value (top) of scale.
	topval = # of colors used in table, default is !D.table_size-2 .
	scale_type = string: LINEAR or LOG10, default is do nothing.
	title = string.
 KEYWORDS:
	LOGMIN = number greater than zero.
	POSITION = default is [440,100]
	/LARGE
	WINDOW = optional window # to display color bar (at POSITION=).
 OUTPUTS:
	No explicit outputs.
	A new window is created in which color bar with scale is displayed,
	or if keyword WINDOW=win then color bar and scale are display in win.
 COMMON BLOCKS:
	common color_scale, xpos, ypos, scale_window, colorbar, region
 SIDE EFFECTS:
	A window is created and then kept for next display of color scale.
 PROCEDURE:
	Straightforward.
 HISTORY:
	written, Frank Varosi NASA/GSFC 1989.
	F.V. 1996, fixed bugs, improved, added WINDOW keyword (used by pro tvs).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_scale.pro)


COLOR_STRUCT

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

 PURPOSE:
	Save current info about color Lookup tables and ADJCT mapping
	into structure {RGB_MAP} and return it.
	Info in structure {RGB_MAP} can then be saved with pro color_save,
	or used to Load color Lookup tables by calling pro color_St_Load.

 CALLING:
	colors = color_struct( name )

 INPUTS:
	name = optional string to name the color table (default is null).

 RESULT:
	Returns structure {RGB_MAP}, containing all color table and
	mapping information. Saves a max of 256 colors.

 COMMON BLOCKS:
	common colors, Rorig,Gorig,Borig, Rcur,Gcur,Bcur
	common adjct_map, color_map
	common adjct_ramp, rampx, rampy
	common color_struct, defined

 PROCEDURE:
	Define the structure and insert current color table mapping.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_struct.pro)


COLOR_ST_LOAD

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

 PURPOSE:
	Use info in structure {RGB_MAP} to Load color Lookup tables.
	Intended to work with result of function color_struct.

 CALLING:
	color_St_Load, color_st

 INPUTS:
	color_st = scalar structure variable having structure {RGB_MAP},
		containing all color table and mapping information.
		(as returned by function color_struct).

 KEYWORDS:
	/RESET : the ADJCT mapping is reset to be one-to-one.

 EFFECTS:
	The common colors, Rorig,Gorig,Borig, loaded with table from color_st,
	the common adjct_map, color_map, is loaded with mapping from color_st,
	the common adjct_ramp, rampx, rampy, is set with saved ramp-map,
		the new color table and mapping is applied to window system.

 EXTERNAL CALLS:
	pro color_map_Load

 COMMON BLOCKS:
	common colors, Rorig,Gorig,Borig, Rcur,Gcur,Bcur
	common adjct_map, color_map
	common adjct_ramp, rampx, rampy

 PROCEDURE:
	Interpolate if color_st.Ncolor is different from !D.table_size.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_st_load.pro)


COLOR_TABLES

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

 PURPOSE:
	Provide interactive menu choice access to all IDL color table options.

 CALLING:
	color_tables, caller

 INPUTS:
	caller = string (optional), to indicate in menu what to return to.

 KEYWORDS (all optional):

	IMAGE_WINDOW = window number in which data or image is displayed.
	INFO_WINDOW = window number in which to write information & instructs.
	INIT_SEL = initial menu selection desired.
	MENU_WINDOW = for SunView only, window number associated with menu.

 EFFECTS:
	New color tables and/or mappings are applied to window system.

 EXTERNAL CALLS:
	pros:	adjCTmap	color_edit	palette
		color_map_Load	color_save	color_restore	Hist_Equal_CT
	function VarType
	function wmenux

 COMMON BLOCKS:
	common adjCT_map, color_map
	common adjCT_ramp, rampx, rampy
	common color_options, CT_map_reset, CT_feedback

 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V.1990, work with adjCTmap and Hist_Equal_CT using common blocks.
	F.V.1991, use RGB_Map structure given by function color_struct.
	F.V.1995, mod for IDLv4 change of colors1.tbl location.
	F.V.1996, use Varosi's wmenux instead of old IDL instrinsic wmenu.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_tables.pro)


COLOR_TRANS

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

 PURPOSE:
	Apply linear transform (matrix) to current RGB color table
	and Load result (with tvlct).

 CALLING:
	color_trans, transform

 INPUTS:
	transform = square matrix, size N_colors-1 by N_colors-1 elements.

 EFFECTS:
	Color tables are updated.

 COMMON BLOCKS:
	common colors, ro,go,bo, rc,gc,bc

 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/color_trans.pro)


COMPARE_STRUCT

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/compare_struct.pro)


CONVOL3D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONVOL3D
 PURPOSE:
	Convolution or correlation of two 3D arrays (volumetric data),
	or autocorrelation of a single 3D array.
	Default is to compute using product of Fourier transforms.

 CALLING SEQUENCE:

	imconv = convol3d( voldata, psf, FT_PSF = psf_FT )
  or:
	correl = convol3d( voldata1, voldata2, /CORREL )
  or:
	correl = convol3d( voldata, /AUTO )

 INPUTS:
	voldata = 3-D array to be convolved with PSF.
	psf = the 3-D array Point Spread Function,
		with size < or = to size of voldata.

 KEYWORDS:

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

	FT_VOLDATA = passes out/in the Fourier transform of voldata.

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

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

	/NO_FT overrides the use of FFT, using IDL function convol() instead.
		(then PSF is rotated by 180 degrees to give same result)
 METHOD:
	When using FFT, PSF is centered & expanded to size of voldata.
	Basically a copy of function convolve modified from 2D to 3D.
 HISTORY:
	written, Frank Varosi, NASA/GSFC 1997,

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/convol3d.pro)


CONVOLVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CONVOLVE
 PURPOSE:
	Convolution of an image with a Point Spread Function (PSF),
	or correlation two images, or autocorrelation of an image.
	Default is to compute using product of Fourier transforms.

 CALLING SEQUENCE:

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

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

 KEYWORDS:

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

	FT_IMAGE = passes out/in the Fourier transform of image.

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

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

	/NO_FT overrides the use of FFT, using IDL function convol() instead.
		(then PSF is rotated by 180 degrees to give same result)
 METHOD:
	When using FFT, PSF is centered & expanded to size of image.
 HISTORY:
	written, Frank Varosi, NASA/GSFC 1992.
	F.V.1993, added one to shift for case of odd size of image.
	F.V.1997, change in 93 was not exactly correct, instead:
		when PSF size is less than image size, fixed placement
		of PSF relative to image, for case of odd size of image.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/convolve.pro)


CONV_ASCII_TIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	conv_ascii_time
 PURPOSE:
	Convert time strings of form 'hh:mm:ss' into seconds (32-bit).
 CALLING:
	seconds = conv_ascii_time( times, dates )
 INPUTS:
	time_strings = string array in form  "hh:mm:ss".
	date_strings = string array in form  "mm/dd/yy"  or  "dd-mmm-yy"
 LIMITATIONS:
	If dates have different month or year the relative times will be wrong.
 OUTPUTS:
	Function results is seconds relative to begining of month.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/conv_ascii_time.pro)


CONV_VARTYPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	conv_vartype
 PURPOSE:
	Convert input variable to specified other type.
 CALLING:
	cvar = conv_vartype( variable, TYPE_CODE_OUT=type_out )
 INPUTS:
	variable = array, the variable to be converted.
 KEYWORDS:
	TYPE_CODE_OUT = the desired type code of returned array.
 OUTPUTS:
	Returns array of converted data.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/conv_vartype.pro)


CONV_VAX_UNIX

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

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

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

 MODIFICATION HISTORY:
       Written   F. Varosi               August 1990
       Modified  P. Keegstra             April 1992
           			Implemented MIPSEL architecture

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/conv_vax_unix.pro)


COPY_STRUCT

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

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

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

 KEYWORDS:

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

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

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

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

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

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

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/copy_struct.pro)


COPY_STRUCT_INX

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

	copy_struct_inx, struct_From, struct_To, NT_copied, INDEX_FROM=subf

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

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

 KEYWORDS:

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

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

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

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

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

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

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

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

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/copy_struct_inx.pro)


CORREL_IMAGES

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/correl_images.pro)


CORREL_OPTIMIZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	correl_optimize
 PURPOSE:
	Assuming the images are two detections of the same scene,
	find the optimal (x,y) pixel offset of image_B relative to image_A,
	by means of maximizing the cross-correlation function.
	Note that bad pixels or extremely noisy data will bias the
	cross-correlation function and give possibly erroneous results.
	Small amount of noise is no problem, pre-filtering is recommended,
	returned variable max_correl can be used to decide validity.
	Cross-correlation is computed directly by default, but if
	keyword /FFT is set it will be computed using FFTs of images.
 CALLING:
	correl_optimize, image_A, image_B, xoffset_optimum, yoffset_optimum 
 INPUTS:
	image_A, image_B = the two images to be analyzed, the offset of
			image_B relative to image_A is determined.
 KEYWORDS:
	XOFF_INIT = initial X pixel offset of image_B relative to image_A,
	YOFF_INIT = Y pixel offset, (default offsets are 0 and 0).
	MAX_REDUCTION = maximum reduction factor allowed, otherwise
		the first reduction rebins image into about 8 x 8 pixels.
	MAGNIFICATION = option to determine offsets up to fractional pixels,
			(example: MAG=2 means 1/2 pixel accuracy, default=1).
	/NUMPIX : (# overlap pixels)^(1/4) used as correlation weighting factor.
	/MONITOR causes the progress of computation to be briefly printed.
	/PRINT causes the results of analysis to be printed to standard output.
	/FFT : use FFT to compute correlation of images, usually faster,
		but may not be always accurate because periodic nature of FT
		may cause confusion (in this case /NUMPIX has no effect).
		But if data is well inside image boundaries it is accurate.
 OUTPUTS:
	xoffset_optimum = optimal X pixel offset of image_B relative to image_A.
	yoffset_optimum = optimal Y pixel offset.
	max_correl = the maximal correlation corresponding to optimal offset.
	edge = 1 if maximum is at edge of correlation domain, otherwise=0.
	plateau = 1 if maximum is in a plateau of correlation function, else=0.
 EXTERNAL CALLS:
	function  correl_images( image_A, image_B )
	function  convolve( image_A, image_B,/CORREL )	if /FFT is set.
	pro  corrmat_analyze
	IDL system variable !DEBUG should be defined.
 PROCEDURE:
	The combination of function correl_images( image_A, image_B ) and
	pro corrmat_analyze is used to obtain the (x,y) offset
	yielding maximal correlation. The combination is first executed at
	large REDUCTION factor (to speed up computation) and with
	all possible shifts to find the approximate optimal (x,y) offsets.
	The reduction factor is then decreased by factors of 2 and
	the x & y shifts are kept small, thus zooming into the optimal offsets.
	Finally, the MAGNIFICATION option (if specified)
	is executed to determine the (x,y) offset up to fractional pixels.
	If /FFT is set then just use function convolve( image_A,image_B,/CORR )
	and pro corrmat_analyze to obtain the optimal (x,y) offset,
	rebinning the images first if magnification is greater than one.
 NOTES:
	Recommend that the images be normalized so that maximim=1,
	and thresholded at some uniform percent of max=1.
	See for example function modify_image.
 HISTORY:
	Written: Frank Varosi, NASA/GSFC, 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/correl_optimize.pro)


CORRMAT_ANALYZE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	corrmat_analyze
 PURPOSE:
	Analyze the 2-D cross-correlation function of two images
	and find the optimal (x,y) pixel offsets.
	Intended to analyze to result of function CORREL_IMAGES,
	and called by pro CORREL_OPTIMIZE.
 CALLING:
	corrmat_analyze, correl_mat, xoffset_optimum, yoffset_optimum, [...]
 INPUTS:
	correl_mat = cross-correlation matrix of 2 images.
		(as computed by function CORREL_IMAGES( imA, imB ) or
		 function CONVOLVE( imA, imB, /CORREL ) ).
 NOTE:
	If correl_mat(*,*,1) is the number of pixels for each correlation,
	(the case when /NUMPIX was specified in call to CORREL_IMAGES)
	then (# overlap pixels)^(1/4) is used as correlation weighting factor.
 KEYWORDS:
	XOFF_INIT = initial X pixel offset of image_B relative to image_A.
	YOFF_INIT = Y pixel offset, (both as specified to correl_images).
	REDUCTION = reduction factor used in call to CORREL_IMAGES.
	MAGNIFICATION = magnification factor used in call to CORREL_IMAGES,
		this allows determination of offsets up to fractions of a pixel.
	PLATEAU_THRESH = threshold used for detecting plateaus in 
		the cross-correlation matrix near maximum, (default=0.01),
		used only if MAGNIFICATION > 1
	/PRINT causes the result of analysis to be printed.
 OUTPUTS:
	xoffset_optimum = optimal X pixel offset of image_B relative to image_A.
	yoffset_optimum = optimal Y pixel offset.
	max_correl = the maximal correlation corresponding to optimal offset.
	edge = 1 if maximum is at edge of correlation domain, otherwise=0.
	plateau = 1 if maximum is in a plateua of correlation function, else=0.
 EXTERNAL CALLS:
	function  round_off( number )	to round off fractions.
	IDL system variable !DEBUG should be defined.
 PROCEDURE:
	Find point of maximum cross-correlation and calc. corresponding offsets.
	If MAGNIFICATION > 1:
	the  correl_mat is checked for plateau near maximum, and if found,
	the center of plateau is taken as point of maximum cross-correlation.
 HISTORY:
	Written: Frank Varosi, NASA/GSFC, 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/corrmat_analyze.pro)


CUBIC_ZEROS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	cubic_zeros
 PURPOSE:
	Attempt to implement Cardano's formula for the zero solutions
	of a cubic equation. Presently written to solve reduced form,
	with parameters input by keywords:  x^3 + px + q
 CALLING:

 INPUTS:

 KEYWORDS:

 OUTPUTS:

 PROCEDURE:
	Not yet finished. Must handle more special cases.
 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1998.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/cubic_zeros.pro)


CURSOR_SCALE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	cursor_scale
 PURPOSE:
	Interactively select min-max on a color bar using mouse-cursor,
	or input range/levels by typing.
 CALLING:
	range = cursor_scale( minval, maxval, scaling )
 INPUTS:
	minval, maxval, scaling
 KEYWORDS:
	MAXLIM=
	MINLIM=
	INITIAL_MARKS=
	LOGMIN=
	/INCREMENT
 OUTPUTS:
	mosaic_spec, NLev, Levels
 EXTERNAL CALLS:
	pro color_scale
	pro window_set_show
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.
	F.V. 1991, added keyword /INCREM to enter Min & Increment.
	F.V. 1993, modified /INCREM option to get & return sequece of Levels.
	F.V. 1997, added 0.3 sec wait before cursor query.
	F.V. 1997, added option to read contours from a file (*.levels).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/cursor_scale.pro)


CW_DRAW_AXES

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

 PURPOSE:
	This compound widget merges a central scrolling draw widget,
	for displaying an image or some user defined graphics,
	with two smaller scrolling draw widgets for the X and Y axes
	of the image/graphics. The scroll bars of all the draw widgets
	are ganged so that moving any one will move the others, thus
	all viewport events are swallowed. Button events in the X & Y axes
	draw widgets cause all viewports to scroll and are then swallowed.
	All motion/button events occuring in the central draw widget
	are reported to the parent or higher level widgets.

 CATEGORY:
	Compound widgets.

 CALLING:
	Widget = CW_Draw_Axes( Parent )

 INPUTS:
       Parent = the ID of the parent widget.
		If not specified, a base is created just for this widget.

 KEYWORDS:
	RETAIN:	Controls the setting for backing store for both windows.
		If backing store is provided, a window which was obscured
		will be redrawn when it becomes exposed. Set RETAIN=0 for
		no backing store. Set RETAIN=1 to "request backing store
		from server" (this is the default). Set RETAIN=2 for IDL
		to provide backing store.

	/FRAME:	causes frame to be drawn around the widget,default is no frame.
	UVALUE = the user value for the widget.

	SIZE_XY	= two integer array specifying the width and height of
		the draw window (in pixels), default = [ 2048, 2048 ].

	SCROLL_SIZE_XY = two integer array specifying the width and height of
			the visible part of the draw window, default =[512,512].

 OUTPUTS:
       The ID of the created widget is returned (widget is not realized).

 PROCEDURE:

	WIDGET_CONTROL, id, SET_VALUE=value
		can be used to change the display.

	Action depends on the "value" variable type:

		string: name of user provided procedure to be called.
			The argument passed to procedure is that state of CW,
			which has window numbers and other info, so that
			graphics can be directed into the draw widgets.

		two integers:  sets all draw viewports to the (x,y) specified.

		single integer equaling zero:  erases all 3 draw windows.

		image (matrix):  it is displayed in central draw window.

		structure:  tags should be handles pointing to images which are
			then displayed in central, x-axis, y-axis windows, resp.

	WIDGET_CONTROL, id, GET_VALUE=state
		can be used to obtain the state (structure var.) of widget.

 HISTORY:
	written: Frank Varosi 1994 HSTX @ NASA/GSFC.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/cw_draw_axes.pro)


DATATYPE

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/datatype.pro)


DDL_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DDL_struct
 PURPOSE:
	Convert a DDL record-structure definition file
			into IDL structure(s) code, packaged as a function.
 CATEGORY:
			Structures
 CALLING SEQUENCE:
		status = DDL_struct( DDL="DDL_name", /ABBREV,/TRUNC,VARIANT=# )
	examples:
			print, ddl_struct( ddl="FDQ_SDF", /ABBREV, /TRUNC )
			print, ddl_struct( ddl="BET_LT_ET", VARIANT=2 )
 INPUTS/OUTPUTS:
   keywords:
		DDL_NAME = string giving DDL file name (type .DDL is assumed )
   optional:
		/ABBREV performs Field name abbreviations as defined 
							by DDL_abbrev.pro
		VARIANT = variant number to choose for structure definition,
							(default variant = 1)
		/TRUNC causes the output file name (not including .PRO)
				to be truncated to 15 characters,
			so IDL will compile it automatically when invoked.

   inputs used recursively:
		DDL_Lun = Logical unit number for reading DDL file.
		Lun_out = Logical unit number for writing .PRO code.
		ABBREV = keyword to indicate use of abbreviations.
		VARIANT = variant number to choose for structure definition.

   function returns a string which is not important to user
		(it is just the final return from chain of recursion).
 SIDE EFFECTS:
		"DDL_name".DDL file is read,
		"DDL_name"_struct.PRO is created (IDL function code).
 PROCEDURE:
  The DDL file (given by "DDL_name".DDL) is read one line at a time,

  if declaration STRUCTURE is encountered,
		then DDL_struct is called recursively,
    		obtaining the complete IDL structure definition,
		which is then printed to file "DDL_name"_struct.pro ,

  otherwise the field type and size is used to construct IDL definition,
	(calling DDL_abbrev,Tag_Name for name abbreviations if /ABBREV),
	which is then concatenated with the other IDL definitions,
   	and returned when declaration END STRUCTURE is encountered in DDL file.

 EXTERNAL CALLS:
		pro DDL_ABBREV		(should be in same directory)
		function GET_WORDS	(from [varosi.idl.lib]VAROSI.TLB) 
 MODIFICATION HISTORY:
	written June,1990 Frank Varosi STX @ NASA/GSFC
	modif. Aug.1990 by F.V. to process field variants in DDL.
	modif. Sep.1990 by F.V. to handle multi-dimensional array declarations,
				and option to truncate filename to 15 chars.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/ddl_struct.pro)


DDL_TO_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
create IDL function code which defines record structure for DATASET.
check for DDL file (describing DATASET) and invoke DDL_STRUCT function.
Frank Varosi Sep.1990

check if IDL structure definition code exists?

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/ddl_to_struct.pro)


DIR_GENERIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dir_generic
 PURPOSE:
       Convert string specifying a subdirectory into a string array
	of sub-directories which determine a path in generic fashion.
       (result is thus independent of operating systems).
 CALLING:
       direct_array = dir_generic( directory )
 INPUT: 
       directory = string, full name of directory.
 OUTPUT:
       Function returns string array giving a path of sub-directories,
	which do not include the OS specific syntax for directories,
	that is, leaving out the "/" or ".".
 EXTERNAL CALLS
	function get_words
 HISTORY:
       Written, Frank Varosi NASA/GSFC 1994.
	F.V. 1995, handle case for MacOS and Win32.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/dir_generic.pro)


DIR_PATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       dir_path
 PURPOSE:
       Construct and return a string specifying a directory (with OS syntax)
       from a string array of sub-directories (with no OS syntax)
	which determine a path in generic fashion, thus independent of OS.
 CALLING:
       directory = dir_path( direct_array, dir_delim )
 INPUT: 
       direct_array = string array giving a path of sub-directories, which
                     upon concatenation specifies the subdirectory.
                                               (default is current directory).
                     Do not include the operating system specific syntax for
                     directories, that is, leave out the "/" or ".",
                     they are automatically added depending on op.sys.
                     Leading & trailing blanks are trimmed, default ="".
 OUTPUT:
       dir_delim = optional, string used to delimit (end) the directory name.
                     (this is "]" on VMS, otherwise uses "/" on UNIX, etc.).

       Function returns string specifying the directory on current OS.

 EXTERNAL CALLS:
	function strconcat
 HISTORY:
       Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1994, simplified by using function strconcat.
	F.V. 1995, handle case for MacOS and Win32.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/dir_path.pro)


DISK_REGION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Disk_Region
 PURPOSE:
	Function returns a matrix of 0 and 1, 1 indicating the inside of circle.
 CALLING:
	disk_mask = Disk_Region( center, SIZE=sz, RADIUS=radius, COUNT=npix )
 INPUTS:
	center =
 KEYWORDS:
	SIZE =
	RADIUS =
	COUNT =
 OUTPUTS:

 PROCEDURE:

 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/disk_region.pro)


DISPLAY_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	display_image
 PURPOSE:
	Display the visible portion of an image in window.
 CALLING:
	display_image, image, x,y
 INPUTS:
	image =
	x,y =
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1991, added option (xmax,ymax) to display just central subset
		of image, (so that edge regions of image are not displayed).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/display_image.pro)


DL_VMS2

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

 PURPOSE:
	Extract the documentation template of one or more procedures.

 CATEGORY:
	Help, documentation.

 CALLING SEQUENCE:
	DL_VMS2		;For prompting.
	DL_VMS2, Name	;Extract documentation for procedure Name using
				the current !PATH.

 INPUTS:
	Name:   A string containing the name of the procedure.

 KEYWORDS:
	FILE:   If this keyword is set, the output is sent to the file
		"userlib.doc", in the current directory.

	PRINT:  If set, this keyword sends the  output of DL_VMS2 to lpr.

	PATH:   An optional directory/library search path.  This keyword uses
		the same format and semantics as !PATH.  If omitted, !PATH is
		used.
 OUTPUTS:
	Documentation is output to terminal or printer.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Output is produced on terminal or printer.

 RESTRICTIONS:
	None.

 PROCEDURE:
	Straightforward.

 MODIFICATION HISTORY:
	Written, DMS, Sept, 1982.
	Added library param, Jul 1987.
	Unix version, Feb, 1988.
	Revised for VMS Version 2, 15 December 1989
	Modified by Jim Pendleton, GRO/OSSE NU, July 30, 1992 to handle
		!PATH's gt 255 characters.
	AB, 21 September 1992, renamed from DOC_LIB_VMS to DL_VMS2 to
		avoid DOS filename limitations.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/dl_vms2.pro)


DOC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DOC
 PURPOSE:
	Provides online documentation for IDL procedures found in the IDL
	search path.
 CATEGORY:
	Help, documentation.
 CALLING SEQUENCE:
	DOC	  ;For prompting.
	DOC, NAME ;Extract documentation for procedure NAME.
 OPTIONAL INPUT PARAMETERS:
	NAME = String containing the name of the procedure.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Decides whether the graphics device supports X-windows widgets, in
	which case it calls SCANPATH, else it calls DOC_LIBRARY.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/doc.pro)


DOC_LIB_UNIX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DOC_LIB_UNIX
 PURPOSE:
	Extract the documentation template of one or more procedures.
 CATEGORY:
	Help, documentation.
 CALLING SEQUENCE:
	doc_lib_unix	;For prompting.
	doc_lib_unix, Name ;Extract documentation for procedure Name using
			the current !PATH.
 INPUTS:
	Name = string containing the name of the procedure or "*" for all.
	
 OPTIONAL INPUT PARAMETERS:
	PRINT = keyword parameter which, if set to 1, sends output
		of doc_lib_unix to lpr.  If PRINT is a string, it is a shell
		command used for output with its standard input the
		documentation.  I.e. PRINT="cat > junk"
	DIRECTORY = directory to search.  If omitted, use  current directory
		and !PATH.
	MULTI = flag to allow printing of more than one file if the module
		exists in more than one directory in the path + the current
		directory.
 OUTPUTS:
	No explicit outputs.  Documentation is piped through more unless
	/PRINT is specified.
 KEYWORDS:
       OUT = redirected output of spawn command
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	output is produced on terminal or printer.
 RESTRICTIONS:
	??
 PROCEDURE:
	Straightforward.
 MODIFICATION HISTORY:
	DMS, Feb, 1988.
       DMZ, Oct 1992 -- added keyword to capture output

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/dl_unix2.pro)


DOC_MENU

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Doc_menu
 PURPOSE:
	Extract the documentation template of one or more procedures.
 CATEGORY:
	Help, documentation.
 CALLING SEQUENCE:
	Doc_menu	;For prompting.
	Doc_menu, Name ;Extract documentation for procedure Name using
		the current !PATH.
 OPTIONAL INPUT PARAMETERS:
	Name = string containing the name of the procedure.
	Under Unix, Name may be "*" for all modules.

	If Name is not passed, then Doc_menu will go into an interactive
	mode to prompt the user for the directory or library to search, and
	then for the routine to get information on.
	
 KEYWORDS:
	PRINT = keyword parameter which, if set to 1, sends output
		of doc_menu to the default printer. Under Unix, if PRINT
		is a string, it is a shell command used for output with
		its standard input set to the documentation
		(i.e. PRINT="cat > junk")
 Unix KEYWORDS:
	DIRECTORY = directory to search.  If omitted, use  current directory
		and !PATH.
	MULTI = flag to allow printing of more than one file if the module
		exists in more than one directory in the path + the current
		directory.
 VMS KEYWORDS:
	FILE - If present and non-zero, the output is left in the file
		userlib.doc, in the current directory.
	PATH = optional directory/library search path.  Same format
		and semantics as !PATH.  If omitted, !PATH is used.

 OUTPUTS:
	Documentation is sent to the standard output unless /PRINT
	is specified.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	Output is produced on terminal or printer.
 RESTRICTIONS:
	The DIRECTORY and MULTI keywords are ignored under VMS. The
	FILE and PATH keywords are ignored under Unix.
 PROCEDURE:
	If NAME is not passed, then this procedure will first display a list of
	the directories in !PATH, and ask for the user to select one.  Then a
	list of procedures in the selected directory are displayed, and the
	user is again asked to select one of them.  Finally, the routine
	DOC_LIB_xxx, where xxx represents the operating system, is called to
	display the documentation in the file between the lines containing the
	characters ";+" and ";-".

	VMS text libraries can also be searched by this routine.

	If a file named "aaareadme.txt" is also found in the selected
	directory, then this can be selected as the topic "*INFO*".

 MODIFICATION HISTORY:
	Written, DMS, Sept, 1982.
	Added library param, Jul 1987.
	Unix version, DMS, Feb, 1988.
	New VMS version, DMS, Dec. 1989
	Wrapper procedure to call the correct version
		under Unix and VMS, AB, Jan 1990
       Added support for DOS, SNG, Dec, 1990
	Added interactive capabilities, William Thompson, July 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/doc_menu.pro)


DOUBLE_TICKS

[Previous Routine] [Next Routine] [List of Routines]
Double the number of tick marks on an axis,
 but Label only the current   (assumed equally spaced, increasing).
 Use  to specify ![XYZ].TICKV
  and   to specify ![XYZ].TICKS
  and   to specify ![XYZ].TICKNAME
 (thus every other major tick will be labeled, in between will be blank).
 /NEG will reverse order of labels, so values will be descending.
Frank Varosi STX @ NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/double_ticks.pro)


DRAW_MARK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	draw_mark
 PURPOSE:
	Draw a mark of requested symbol and diameter on graphics device.
	Default symbol is cross, which for X or SUN device
       is composed of foreground cross over background (darker) cross.
	By default the image data from marked area is first read
	(unless /NOSAVE or area is not in a window)
	and this saved image data is returned, and then symbol is drawn.
	Diameter is in DEVICE coordinates (max diam of mark is 256 pixels).
 CALLING:
	imsav = draw_mark( xcur, ycur, diameter, xsave, ysave )
 INPUTS:
	xcur, ycur = desired location of mark, in device coordinates.
	diameter = diameter of mark in DEVICE units (max diam is 256 pixels).
 KEYWORDS:
	SYMBOL = "circle", "box", "diamond", "cross", or "asterisk".
		Default is "cross" with black around white center lines.
	FORE_COLOR = center color of cross, default is white.
	BACK_COLOR = border color of cross, default is black.
	THICKNESS = thickness of lines drawing the mark,
		this is always 1 (one) for window displays,
		and default is 4 when drawing on PostScript (non windows).
	/NOSAVE : default is save pixels in display that the mark overwrites.
		Setting /NOSAVE skips this part, thus faster.
 OUTPUTS:
	xsave, ysave = the location of saved window region (if NOSAVE=0).

	Funtion returns window pixel values from marked region, as read by TVRD,
	or returns integer 1 if /NOSAVE.
 EXTERNAL CALLS:
	function rot2d
 COMMON BLOCKS:
	common draw_mark, Hmark, Vmark, Fcol, Bcol
	common draw_marks, circle, box, diamond, cross, asterisk
 PROCEDURE:
	Call TV if windows and symbol = cross, else call PLOT.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.
	F.V. 1991, added keyword /NOSAVE to skip the tvrd.
	F.V. 1991, adapted for PostScript, added keywords SYMBOL & THICKNESS.
	F.V. 1999, added print of help with syntax and MAGF keyword.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/draw_mark.pro)


EXPAND_PATH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	EXPAND_PATH
 PURPOSE:
	Expands any logical names in an IDL search PATH (e.g. !PATH) into the
	directories defined by that logical name.   *** VMS only. ***
 CALLING SEQUENCE:
	Result = EXPAND_PATH(PATH)
 INPUTS:
	PATH = Valid IDL search path, e.g. !PATH.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	The variable PATH must be in the proper format for !PATH.
 PROCEDURE:
	TRNLOG is called with the /FULL_TRANSLATION switch to translate the
	logical names.
 MODIFICATION HISTORY:
	William Thompson

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/expand_path.pro)


EXPECT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	expect
 PURPOSE:
	Compute expectation (mean, first moment) of a probability distribution.
 CALLING:
	mean = expect( x, Px )
 INPUTS:
	x = array of independent variable values, strictly increasing.
	Px = array of probability distribution values (positive) at points x.
 KEYWORDS:
	/EXP : integrate in Linear-Log space,
		increases accuracy for exponentially varying functions.
	/POW : integrate in Log-Log space,
		increases accuracy for functions with power-law variation.
 OUTPUTS:
	Function returns scalar mean value of probability distribution.
 EXTERNAL CALLS:
	function Trap_Int
 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1998.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/expect.pro)


EXTRACT_REGION

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

 PURPOSE:
	Interactively extract a sub-region of image array, using mouse.
	Optionally, sub-region can be specified by entering position & size.
	To active this option, press the MIDDLE mouse button first, then
	widget will appear into which region position & size can be typed.

 CALLING:
	imsub = extract_region( image )

 INPUTS:
	image = 2D array.

 KEYWORDS:
	VALUE_FILL = value to use in filling empty pixels of result, default=0.
	SIZE_REGION = 2 integers, desired size of extracted region,
			default is variable (interactive).
	MAGNIFICATION = magification factor of displayed image.
	WINDOW = IDL window number for displayed image.
	WPOS_XY = 2 integers, position of displayed image in window coordinates.

	/LIMIT_REGION : selection of region is limited to actual image size.
	/ERASE_BOX : erase the region selection box upon completion (def=no).
	/DISPLAY : automatically create a window and display the image.
	/LOG10 : display ( image > 1 ) in Log base 10 scaling.
	LOG10 = ( image > LOG10 ) is displayed in Log base 10 scaling.

 KEYWORD OUTPUTS:
	SIZE_REGION = 2 integers, actual size of extracted region.
	START_XY = 2 integers, begining Location of extracted region.
	LAST_XY = 2 integers, ending Location of extracted region.

 OUTPUT:
	Function returns the extracted image array,
	which is a subset, or possibly an extension, of input image.

 EXTERNAL CALLS:
	pro get_window
	pro box_cursor
	function box_create
	pro box_erase
 COMMON BLOCKS:
	common extract_region, xy_region	;saved position & size.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.
	F.V. 1994: options to fix sub-region and edit position & size.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/extract_region.pro)


EXT_FRAC_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 Extract a part of image specified up to fractional pixels
 by resampling image on fractionally shifted grid, using REBIN twice.

 ( xbot:xtop , ybot:ytop ) is sub-image location in MAGNIFIED image
				(virtual magnified grid coordinates),
 	thus performing fractional pixel extraction when MAGF=Magf > 1.
 Sub-image is returned at normal magnification (=1).

 Frank Varosi NASA/GSFC 1990
 F.V. 1991, fixed bugs, use /SAMPLE for Magnify and averaging for De-Magnify.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/ext_frac_image.pro)


EXT_MOD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:  
             EXT_MOD
 PURPOSE:
             to extract modules from VMS libraries
 CALLING SEQUENCE: 
             ext_mod,lib_nam,targ_dir
 INPUTS:
             lib_nam  = name of source library
             targ_dir = target directory of modules
 HISTORY:                           
             written Jan'93 by DMZ (ARC)

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/ext_mod.pro)


FACTOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FACTOR
 PURPOSE:
       Find prime factors of a given number.
 CATEGORY:
 CALLING SEQUENCE:
       factor, x, p, n
 INPUTS:
       x = Number to factor.		in
 KEYWORD PARAMETERS:
 OUTPUTS:
       p = Array of prime numbers.		out
       n = Number of each element of p.	out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner.  4 Oct, 1988.
       RES 25 Oct, 1990 --- converted to IDL V2.
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1988, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/factor.pro)


FILTER_IMAGE

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

 PURPOSE:
	Computes the average and/or median of pixels in moving box,
	replacing center pixel with the computed average and/or median,
		(using the IDL smooth or median functions).
	The main reason for using this function is the options to
	also process the pixels at edges and corners of image, and,
	to apply iterative smoothing simulating convolution with Gaussian,
	and/or to convolve image with a Gaussian kernel.

 CALLING:
	Result = filter_image( image, SMOOTH=box_width, /MEDIAN, /ALL )

 INPUT:
	image = 2-D array (matrix)

 KEYWORDS:
	SMOOTH = width of square box for moving average, in # pixels.
	/SMOOTH  means use box width = 3 pixels for smoothing.

	MEDIAN = width of square moving box for median filter, in # pixels.
	/MEDIAN  means use box width = 3 pixels for median filter.

	/ALL_PIXELS causes the edges of image to be filtered as well,
		accomplished by reflecting pixels adjacent to edges outward.

	/ITERATE : apply smooth(image,3) iteratively for a count of
		[ (box_width-1)/2 = radius ] times, when box_width >= 5.
		This is equivalent to convolution with a Gaussian PSF
		of FWHM = 2 * sqrt( radius ) as radius gets large.
		Note that /ALL_PIXELS is automatically applied,
		giving better results in the iteration limit.
		(also, MEDIAN keyword is ignored when /ITER is specified).
		Can also specify FWHM = # pixels when using /ITER.

	FWHM_GAUSSIAN = Full-width half-max of Gaussian to convolve with image. 
			FWHM can be a single number (circular beam),
			or 2 numbers giving axes of elliptical beam.
		However, if /ITERATE is set then convolution with a Gaussian
			is approximated by iteration of smooth( image, 3 ).

	/NO_FT_CONVOL causes the convolution to be computed directly,
		with IDL function convol.
		The default is to use FFT when factors of size are all LE 13.
		(note that external function convolve handles both cases)

 RESULT:
	Function returns the smoothed, median filtered, or convolved image.
	If both SMOOTH and MEDIAN are specified, median filter is applied first.

 EXAMPLES:
	To apply 3x3 moving median filter and
	then 3x3 moving average, both applied to all pixels:

		Result = filter_image( image, /SMOOTH, /MEDIAN, /ALL )

	To iteratively apply 3x3 moving average filter for 4 = (9-1)/2 times,
	thus approximating convolution with Gaussian of FWHM = 2*sqrt(4) = 4 :

		Result = filter_image( image, SMOOTH=9, /ITER )

	To convolve all pixels with Gaussian of FWHM = 3.7 x 5.2 pixels:

		Result = filter_image( image, FWHM=[3.7,5.2], /ALL )

 EXTERNAL CALLS:
	function psf_gaussian
	function convolve
	pro factor
	function prime		;all these called only if FWHM is specified.

 PROCEDURE:
	If /ALL_PIXELS or /ITERATE keywords are set then
	create a larger image by reflecting the edges outward,
	then call the IDL median and/or smooth function on the larger image,
	and just return the central part (the orginal size image).
 HISTORY:
	Written, 1991, Frank Varosi, NASA/GSFC.
	FV, 1992, added /ITERATE option.
	FV, 1993, added FWHM_GAUSSIAN= option.
	FV, 1999, option FWHM_GAUSSIAN=#pixels can be used with /ITER approx.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/filter_image.pro)


FIND_DIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       find_dir
 PURPOSE:
       Check for existence of a sub-directory (independent of op.sys.)
	and return the name with correct op.sys. syntax.
 CALLING:
       dirspec = find_dir( dir )
 INPUT: 
       dir = string, the directory name to look for
                 do not specify wildcards (*) or op.sys. syntax.
 KEYWORD:
      /LINKS = assume all Links (UNIX only) are actually directories
                                      and include them in the search.
 OUTPUT:
       Returns the directory name with appropriate op.sys. syntax ([] or /).
 EXTERNAL CALLS:
       function find_dirs
 PROCEDURE:
       Use function findfile in VMS, but otherwise use function find_dirs,
	and then see if requested directory is in list.
 HISTORY:
       Written, Frank Varosi NASA/GSFC 1990.
	F.V. 1994, handle case for MacOS and Win32.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/find_dir.pro)


FIND_DIRS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       find_dirs
 PURPOSE:
       Return a list of sub-directories (and links) in specified directory.
       Can also wildcard search with specific characters in directory names.
 CALLING EXAMPLE:
       subdirs = find_dirs( dirspec, DIR=["data","images"], NDIR=Ndir )
 INPUT:
       dirspec = characters to look for in directory name (default = *),
                 do not specify wildcards (*) because
                 they are added automatically, ( search is on "*dirspec*" ).
 KEYWORDS:
       DIRECTORY_PATH = string array giving a path of directories, which
                      upon concatenation specifies the subdirectory to search.
                                               (default is current directory).
                      Do not include the operating system specific syntax for
                      directories, that is, leave out the "/" and ".",
                      they are automatically added depending on op.sys.
       NDIR = returned number of directories found (not including # Links)
      /LINKS = assume all Links (UNIX only) are actually directories
                     and include them at the end of the List.
       NLINK = number of Links found, if /LINKS was set.
 OUTPUT:
       Returns array of directory names (minus directory delimeters ] or /).
 RESTRICTIONS:
	Have not tested on Win32, probably does not work.
 EXTERNAL CALLS:
       function dir_path
       function VarType
 PROCEDURE:
       Use function findfile in VMS, but otherwise use "spawn ls -F" on UNIX.
 HISTORY:
       Written, Frank Varosi NASA/GSFC 1990.
	F.V. 1994, handle case for MacOS.
	F.V. 1995, fixed for case of no dirs but found Links.
	F.V. 1999, handle case for OS = Win32.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/find_dirs.pro)


FIND_FILES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       find_files
 PURPOSE:
	Search for files with specified file-extension in specified directory.
 CALLING EXAMPLE:
	find_files, files, filnams, FILEXT=".fits", DIR=["data","images"]
 KEYWORDS:
	FILEXT = the file-extension (name ending) to look for (e.g. ".dat"),
		do not use wildcard, because * is automatically placed in front.
       DIRECTORY_PATH = string array giving a path of directories, which
                      upon concatenation specifies the subdirectory to search.
                                               (default is current directory).
                      Do not include the operating system specific syntax for
                      directories, that is, leave out the "/" and ".",
                      they are automatically added depending on op.sys.
 OUTPUT:
	files = array of complete file names found (nothing if none found)
	filnams = array file names (without the directory spec in name).
 EXTERNAL CALLS:
       function dir_path
 PROCEDURE:
       Use function findfile and then manipulate the strings.
 HISTORY:
       Written, Frank Varosi NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/find_files.pro)


FIND_OUTLIERS

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

 PURPOSE:
	Find outlier (bad) pixels in an image and return array of subscripts.
	Outliers are flagged if value exceeds N_SIGMA times local standard
	deviation (assuming that good data pixels do not deviate that much).
	This procedure uses the histogram of image with reverse indices
	to home in on pixels that have values outside the distribution
	of most pixel values, and so is faster and usually better than
	function sigma_filter, except when bad pixel values are within the
	distribution of good pixels.

 CALLING:
	subscripts = find_outliers( image, box_width, N_SIGMA=# )

 INPUTS:
	image = 2-D array (this input will be modified).

	box_width = width of square box in which to test statistics of
		outlier candidate pixels, units in # pixels (default=3).

 KEYWORDS:

	N_SIGMA = number of standard deviations flagging outliers (float),
			minimum = 1, default = 5.

	STOP = integer, the checking for outliers will stop after this
		number of candidates are found to be NOT outliers (default=9).

	RADIUS = specify test box size with radius, so box_width = 2*radius+1.

	/MEDIAN : causes the median of values in test box to be used as
		the replacement value, and in estimation of standard deviation.

	/NO_MIN_OUT : outlier pixels related to minimum extremes of image
		are NOT checked or replaced. This takes precedence over /NO_MAX.

	/NO_MAX_OUT : outlier pixels related to maximum extremes of image
		are NOT checked or replaced.

	/MONITOR : prints information about % of pixels replaced.

 OUTPUT:
	image = the input array is modified by replacing outliers as found.

 KEYWORD OUTPUT:

	N_FOUND = total # of pixels found to be outliers, optional output.

 NOTES:
	For a flat gaussian noise image:
		N_sigma = 2 finds about 5% of pixels to be outliers,
		N_sigma = 3 finds about 1% of pixels to be outliers,
		N_sigma = 4 finds 0.5% of pixels to be outliers, and so on.
	Setting /MEDIAN causes less pixels to be replaced and at same time
	is then more successful at replacing adjacent pairs of outlier pixels.
	The algorithm is semi-iterative since the image is modified during
	the processing, thus changing the local deviations in test boxes,
	and this feature actually helps to remove adjacent outliers.
	Increasing box_width (or RADIUS) will usually replace more pixels.
	Setting STOP= larger values causes more pixels to be checked and so
	takes longer time, and results in more pixels being replaced,
	whereas STOP=0 will replace only the maximum and/or minimum pixels
	(if they are outliers, and if they occur first in reverse indices).

 PROCEDURE:
	Possible outliers are found using the reverse indices from the
	histogram of image. Starting from the maximum bin and working down,
	each outlier candidate is checked by finding the mean (or median) and
	standard deviation of pixels in box centered at candidate pixel
	of the image (excluding that pixel), and if the center value exceeds
	specified number of standard deviations from the mean (or median),
	the subscript is added to array of subscripts. The process is repeated
	starting at the minimum bin and working to more positive values.
	This method of using histograms is faster than function sigma_filter
	for large images, and is more successful at finding outliers.
 HISTORY:
	Written, 1997, Frank Varosi, HSTX @ NASA/GSFC
	FV, 8/97, for case of int/Long image, histogram binsize must be >= 1.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/find_outliers.pro)


FINTERPOL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FINTERPOL
 PURPOSE:
	Linear interpolation of a table of function values onto a new grid.
	Finterpol is faster than the old IDL lib routine interpol
	when the arrays (xold & xnew) have more than about 10 elements,
	and speedup factor increases to > 15 when number of elements > 100.
	This is acheived by first calling function InterLeave( xold, xnew ),
	which then allows subsequent computations to be vectorized.
	Intermediate computations are stored in a common block so that
	after the first call, further interpolations of different functions
	evaluated on the same grids can be performed even faster (10 X)
	by omitting the xold & xnew arguments in further calls. The array
	of points at which function is known must be strictly increasing,
	but the new interpolation points can be in any order. If the new
	grid points are beyond the range of old points extrapolation is
	performed, and a message is printed (unless /QUIET is set).
	See keywords for options to interpolate exponential or power-law
	functional behaviours.

 CALLING:
	fxnew = finterpol( fxold, xold, xnew )

 INPUTS:
	fxold =	array of function values at the points xold.

	xold = array of points (strictly increasing) where func is evaluated.

	xnew = array of new points at which linear interpolations are desired.

 KEYWORDS:
	/QUIET : do not check or print any messages if extrapolation is done.
		Default is to give warning messages about # points extrapolated.

	/INITIALIZE : use only the xold & xnew arrays to compute arrays
		that are kept in the common block for use in fast repetitive
		interpolations of different functions from/to same grids.
		No interpolation is performed and just status (0/1) is returned.

	/EXPONENTIAL_INTERP: perform interpolation/extrapolation in Log-Linear
		space, thereby giving correct result for exponential function.
		(Function values are then assumed > 1e-37).

	/POWER_LAW_INTERP: perform interpolation/extrapolation in Log-Log space,
		thereby giving correct result for power-law function.
		(Function and X coordinate values are then assumed > 1e-37).

 OUTPUTS:
	Function returns array of linear interpolates at new grid points,
	or it returns just the number 1 if /INIT is set, or 0 if calling error.
 COMMON BLOCKS:
	common finterpol
	common finterpol2
 EXTERNAL CALLS:
	function InterLeave
	function scalar
 PROCEDURE:
	Call function InterLeave to find old grid points which bracket
	the new grid points, and then interpolate in vectorized form.
	Take natural log of function values for exponential interpolation,
	then exponentiating on return, take log of grid points and function
	for interpolation of power-law behaviour.
 HISTORY:
	Written: Frank Varosi, HSTX @ NASA/GSFC, 1997.
	F.V. 1998, added /EXPONENTIAL_INTERP and /POWER_LAW_INTERP options.
	F.V. 1999, /EXP and /POWER options are remebered for repeat calls,
		and scalar value is returned if result has just one element.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/finterpol.pro)


FITEXY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	fitexy
 PURPOSE:
	Linear Least-squares approximation in one-dimension (y = a + b*x),
		when both x and y data have errors (e.g. Gaussian noise).
 CALLING EXAMPLE:
	fitexy, x, y, A, B, X_SIG=sigx, Y_SIG=sigy, [sigmas, covar, chi_sq]
 INPUTS:
	x = array of values for independent variable.
	y = array of data values assumed to be linearly dependent on x.
 KEYWORDS:
	X_SIGMA = scalar or array specifying the standard deviation of x data.
	Y_SIGMA = scalar or array specifying the standard deviation of y data.
	TOLERANCE = desired accuracy of minimum & zero location, default=1.e-3.
 OUTPUTS:
	A_intercept = constant parameter result of linear fit,
	B_slope = slope parameter, so that:
			( A_intercept + B_slope * x ) approximates the y data.
 OPTIONAL OUTPUT:
	sigma_A_B = two element array giving standard deviation of 
			A_intercept and B_slope parameters, respectively.
	chi_sq = resulting minimum Chi-Square of Linear fit.
 COMMON:
	common fitexy, communicates the data for computation of chi-square.
 CALLS:
	function chisq_fitexy
	pro minf_bracket
	pro minf_parabolic
	function zbrent
 PROCEDURE:
	From "Numerical Recipes" column: Computer in Physics Vol.6 No.3
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/fitexy.pro)


FITSBYTE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FITSBYTE
 CALLING SEQUENCE:
	fitsbyte, im [, host=conversion_flag]
 PURPOSE:
	To convert an image array from FITS byte ordering to the ordering
	used by the computer.
 INPUT/OUTPUT:
	im  The image array (both input and output).
 OPTIONAL KEYWORDS:
 	HOST  If present and non-zero, the image is converted to "host" 
	      form.  Otherwise, it is converted to "network", or FITS,
	      form.
 COMMON BLOCKS:
	None
 PROCEDURE:
	The byteorder procedure is used to perform the conversion.  The
	form of this conversion depends upon the datatype of the array.
	If it is of I*2 format, a short integer swap is performed.  If it 
	is of I*4 format, a long integer swap is performed.  Otherwise, 
	nothing is done.
 MODIFICATION HISTORY:
	Written by Michael R. Greason, STX, 21 August 1990.
	Mod F.Varosi Oct.1991, do short integer byte swap for floating point.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/fitsbyte.pro)


FLAT_BY_SORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	flat_by_sort
 PURPOSE:
	Estimate sky or row/column pattern background in an image by
	sorting rows (or columns) and then subtract the background
	to return flat fielded image.
 CALLING EXAMPLE:
	image_flat = flat_by_sort( image, imback, /TRANSPOSE, MIN_SORT=9 )
 INPUTS:
	image = 2D array of data
 KEYWORDS:
	/TRANSPOSE : work on transpose so columns are sorted to get background.
	MIN_SORT = index of which element of sorted row to use at background,
		MIN=1 causes 1st value above minimum to be the background,
		MIN = #pixels_per_row/2 causes median to be used,
		MIN=0 (default) causes the first statistically favorable value
			above minimum to be selected as the row background.
 OUTPUTS:
	imback = the estimated sky or row/column pattern background.
 RESULT:
	Function returns the flat fielded image (background subtracted).
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/flat_by_sort.pro)


FORCE_EVENTS

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

 PURPOSE:
	To set timers on widgets that match the requested values,
	causing them to generate events in sequence.

 CALLING:
	Force_Events, widget_map, event_values

 INPUTS:
	widget_map = array of structures with at least the following tags:
		{ id:0L, value:"" } for each widget of interest.
		This can be obtained from function widget_Tree_Map.

	event_values = array of strings, corresponding to widget values.
			The matches need not be exact but must be unique.

 KEYWORD:
	TIMER_INCREMENT = seconds between each sequential event, default = 0.1.

 OUTPUT:	none.

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/force_events.pro)


FRAC_PIX_SHIFT[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	frac_pix_shift
 PURPOSE:
	Extract a part of image specified up to fractional pixels
	by calling function frac_pix_shift( image ) with x & y shifts,
	which resamples image onto fractionally shifted grid
	using the bilinear interp feature of intrinsic IDL function poly_2d.

 CALLING:
	imex = frac_pix_extrac( image, xBegin, yBegin, xSize, ySize )

 INPUTS:
	image =
	xBegin, yBegin =
	xSize, ySize =

 KEYWORDS:
	BEGIN_PIXEL =
	SIZE_EXTRACT =

 OUTPUTS:
	The extracted image is returned.
 EXTERNAL CALLS:
	function frac_pix_shift( image )
 PROCEDURE:
	Setup and call function frac_pix_shift, return subimage.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/vlib/allpro/frac_pix_extrac.pro)


FRAC_PIX_SHIFT[2]

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

 PURPOSE:
	Shift the image by fraction of a pixel in x and/or y directions
	using the bi