Harris 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:20:26 2000.

List of Routines


Routine Descriptions

ADJCT

[Next Routine] [List of Routines]
 NAME:
	ADJCT
 PURPOSE:
	Interactively adjusts color tables using mouse input.
 CATEGORY:
	Image display.
 CALLING SEQUENCE:
	ADJCT
 INPUTS:
	No explicit inputs.
 OUTPUTS:
	No explicit outputs.
 COMMON BLOCKS:
	Colors - color table common block.
 SIDE EFFECTS:
	Color tables are modified.
 RESTRICTIONS:
	None.
 PROCEDURE:
	A new window is created and a graph of the color output value
	versus pixel value is created.  The user can adjust this function
	a number of ways using the mouse.
 MODIFICATION HISTORY:
	DMS, March, 1988, written.
	DMS, April, 1989, modified cursor handling to use less CPU
	TJH, March, 1991, set plot scale to always be the range of colours
			  rather than using the default settings,
			  also insulated the plot from the defaults

(See /host/bluemoon/usr2/idllib/contrib/harris/adjct.pro)


AMULTI

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

 PURPOSE:		Automatically select the !p.multi values to allow 
			reasonable display of "number" plots.
			Tries to force 4 columns.

 CATEGORY:		Screen utilities

 CALLING SEQUENCE:	amulti,number

 INPUTS:	
		NUMBER	= the number of plots to display

	KEYWORDS:	
		COLUMN	= force more columns than rows
		ROWS	= force more rows than columns

 OUTPUTS:
		no explicit outputs;

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	
		Sets the system varaible, !p.multi

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/amulti.pro)


AMULTI2

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

 PURPOSE:		Automatically select the !p.multi values to allow 
			reasonable display of "number" plots.
			Tries to force 2 columns.

 CATEGORY:		Screen utilities

 CALLING SEQUENCE:	amulti2,number

 INPUTS:	
		NUMBER	= the number of plots to display

	KEYWORDS:	
		COLUMN	= force more columns than rows
		ROWS	= force more rows than columns

 OUTPUTS:
		no explicit outputs;

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	
		Sets the system varaible, !p.multi

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/amulti2.pro)


CAT_FILE

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

 PURPOSE:	To enable generic opening/reading of files 
			(be they on the current host or on another host, 
			 be they normal, compressed or in a zoo file)

 CATEGORY:	File input

 CALLING SEQUENCE:
		
	CAT_FILE,lun,thisfile, EXIT=exit, WILD_SPEC=wild_spec, DIR=dir, $
		ONCE=once, RESULT=result, FILENAME=datafile, REMOTE=remote, $
		SUPPRESS=suppress

 INPUTS:
	All optional, BUT one of 'lun' or 'RESULT' must be used to allow output

	thisfile	==> 	force CAT_FILE to use this file 
				(also inhibits prompt for filename)
	WILD_SPEC	==>	Use this string as the file specifier. 
				Follows standard UNIX conventions for 
				wild_cards. 
				Default is WILD_SPEC='*.*' so that everything 
				is found, to give the user the full choice.
	DIR		==>	Use this string as the default directory in 
				which to search for files on the remote system.
				Will also search this directory in the local
				system if the search file is not found in the
				current directory, prior to asking for a remote
				system to search.
	ONCE		==>	Give only one choice for the files, otherwise 
				CAT_FILE will let you keep choosing files 
				until you select the EXIT option on the menu. 
				Then all the selected files will be CATted,
				ZCATted or Zoo piped as one continuous file.
	REMOTE		==>	Use this string to define the default remote 
				host
	SUPPRESS	==>	Suppress CAT_FILE's informative messages

 OUTPUTS:
	All optional, BUT one of 'lun' or 'RESULT' must be used to allow output

	lun		==>	The unit number which has the open file 
				attached to it, ready for reading using 
				READF,LUN
	RESULT		==>	If used then force IDL to read ALL the file 
				into an array which is passed out to RESULT.
				This is an efficient way to read a small file,
				but may take a long time or use alot of memory
				for a large file.
				Overrides the lun parameter.
	EXIT		==>	= 0 if everything is fine
				= 1 if you have chosen EXIT from the menu 
					without having chosen any file
				= 2 if you have chosen to CONTINUE with the 
					same data 
				When EXIT <> 0 CAT_FILE exits without doing 
				anything. The EXIT keyword is there so that 
				your program knows why CAT_FILE has exitted.
	FILENAME	==>	Will contain the name of the file chosen


 COMMON BLOCKS:
	none.

 RESTRICTIONS and SIDE EFFECTS:
	Uses my routine CHOICES
	Will spawn a process (one or a combination of CAT,ZCAT,ZOO,RSH,
	and your default shell). If you abort IDL, or exit without closing 
	or deallocating LUN (by using free_lun,lun) then these spawned 
	processes may hang around to annoy you and the system administrator.

 COMMENTS:

       You can use this routine to read a normal/compressed/zoo-ed file from
	the current host or any other remote host.
	NB: the files must be in the working directory on the current host
	otherwise a remote host is asked for and the files searched for on that
	system

       Then to use the procedure within your program use the line

       cat_file,lun,dir='whatever_directory_the_file_is_in',$
			rem='name_of_remote_host',/once

       "lun" need not be defined
       What the procedure will do is ask you for a file name, then prompt
       for a remote device (which you have set to default to 
	'name_of_remote_host' by using the REM keyword, so you can just hit 
	return). It will then go to the directory set in the DIR keyword on 
	the remote device and try to cat/zcat/zoo the file. 
	If you DONT enter a file name at the file prompt BUT ENTER r INSTEAD 
	then it will go to the remote device and list the directory contents
	(using the WILD_SPEC) and let you choose a file. 
	If you DONT enter anything at the file prompt then the current host 
	and directory are used (try this first).
	Once the file is selected it is opened for reading and attached to a 
	unit number which is passed to lun. 
	So once you exit "cat_file" the file you want is opened for reading 
	on unit lun, so use something like
				readf,lun,whatever

       CAT_FILE simply replaces the openr,lun,file,/get_lun call.

	REMEMBER to free the unit, if you use the lun option, by calling
			free_lun,lun
	BEFORE you exit IDL.


	EXAMPLES ----

	To see what it does, use cat_file like this,

	cat_file,lun

	OR

	cat_file,lun,wild='*.data data/*.data',rem='eve',dir='DATA/winds'

       If you want the ENTIRE file read into an array, use cat_file like this,

       cat_file,result=array,dir='/mod/tharris/DATA',$
		rem='strato.physics',/once

	BEWARE, this may take a LONG time and use ALOT of memory if the file 
	is TOO LARGE !!!!

       If you already know the file name, use cat_file like this,

       cat_file,lun,filename,result=array,dir='/mod/tharris/DATA',$
		rem='strato.physics',/once

       with or without the RESULT keyword.

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	Ammended: 
		Added SUPPRESS keyword and ZOO option on local host
		April 1992, T.J.H.
	Ammended to also handle VMS operating system
		At this stage the file to be read must be in standard format
		(NOT zooed NOR compressed)
		Temporary patch July, 1992, T.J.H.

(See /host/bluemoon/usr2/idllib/contrib/harris/cat_file.pro)


CLEAN_PHASE

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

 PURPOSE:		"unravels" phase and other cyclic data
 			function will add or subtract PERIOD in order to make 
 			the phases more logical in sequence
 			Uses first element as reference

 CATEGORY:		Utility

 CALLING SEQUENCE:	result = clean_phase(modulo_period_data, period)

 INPUTS:
			modulo_period_data = input data (VECTOR) which can be
						 cyclic in period

			period = the basic periodicity of the data 
				EG. 2!pi, or 360 degrees, T

		KEYWORDS:
			open	= unravel as far as it can go
					The default operation is to only 
					unravel out to +/- 1.5*period

			suppress = keep those informative message to itself

 OUTPUTS:
			result	= the cleaned up phases


 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/clean_phase.pro)


CLEAR

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

 PURPOSE:		This is a generic procedure to close windows  
			(if they are not part of a widget), 
			redraw TEK screens, close PostScript files etc.. 
			It will also attempt to close and free all LUNs.

 CATEGORY:		Utility

 CALLING SEQUENCE:	clear

 INPUTS:		none

 OUTPUTS:		none

 COMMON BLOCKS:
			none.
 SIDE EFFECTS:
			Windows are deleted, files closed and LUNs freed

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	Mods, 13-Oct-93 T.J.H. to take into account the window unit numbers 
		allocated to Draw Widgets
	Mods, 09-Mar-94 T.J.H. to avoid trying to close units attached
		to special files such as the .help and journal files

(See /host/bluemoon/usr2/idllib/contrib/harris/clear.pro)


CLEARPLT

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

 PURPOSE:		This procedure will clear or zero all or a selection 
			ofthe system plot variables

 CATEGORY:		Plot Utility

 CALLING SEQUENCE:	clearplt,/all		;clear the !p, !x, !y, !z 
			clearplt,/x,/z		;clear the !x and !z variables 
			clearplt,/x		;only clear the !x variable
			clearplt,/x,/invert	;clear all except the !x 

 INPUTS:		
	KEYWORDS:
		x,y,z,p	= clear the appropriate variable
		all	= clear all, this is equivalent to /x,/y,/z,/p
		invert	= invert the logic. Clear all unselected variables.
			  Therefore "clearplt,/all,/invert" does nothing.

 OUTPUTS:	none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
		The sytem plot variables are changed.
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/clearplt.pro)


CLEAR_WIDGETS

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

 PURPOSE:		This procedure will DESTROY ALL widgets

 CATEGORY:		Utility

 CALLING SEQUENCE:	clear_widgets
			clear_widgets, base_id

 INPUTS:		
	(OPTIONAL)	base_id	= id of widget to be destroyed

 OUTPUTS:		none

 COMMON BLOCKS:
			none.
 SIDE EFFECTS:
			ALL widgets (or the nominated base widget) will be 
			DESTROYED

 MODIFICATION HISTORY:
	Written by: Trevor Harris, IE, HFRD, DSTO
		March, 1994

(See /host/bluemoon/usr2/idllib/contrib/harris/clear_widgets.pro)


CLOSEST

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

 PURPOSE:
	Find the element of ARRAY that is the closest in value to VALUE

 CATEGORY:
	utilities

 CALLING SEQUENCE:
	index = CLOSEST(array,value)

 INPUTS:
	ARRAY = the array to search
	VALUE = the value we want to find the closest approach to

 OUTPUTS:
	INDEX = the index into ARRAY which is the element closest to VALUE

   OPTIONAL PARAMETERS:
	none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/closest.pro)


COHERENCY

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

 PURPOSE:		determine the statistical COHERENCY between two 
			time series

 CATEGORY:		Time-series/Spectral analysis

 CALLING SEQUENCE:
			COHERENCY, ts1,ts2, DF=df

			COHERENCY, ts1,ts2, n_smooth

			COHERENCY, ts1,ts2, DF=df
				SIGLEVELS=siglevels, CONFIDENCE=confidence

 INPUTS:
			ts1,ts2	= input time series vectors, of same length
   OPTIONAL PARAMETERS:
		One of n_smooth or DF should be set
			n_smooth = number of elements to smooth over. The 
				significance level will increase with greater 
				smoothing. With no smoothing, all results are  
				insignificant (siglevel = 0). 
				n_smooth will default to 0.5*DF if that 
				keyword is supplied otherwise 3 is used.
			DF	 = degrees of freedom to be achieved. 
				NB: there are 2 d.f. per spectral estimate.

 OUTPUTS:

   KEYWORD PARAMETERS:
			XSPEC	= the complex cross-spectrum used.
				  vector of same length as ts1 and ts2 
			SMXSPEC	= the smoothed complex cross-spectrum used
				  vector of same length as ts1 and ts2 
			SIGLEVELS = normalised significance levels. 
				  vector of same length as ts1 and ts2 
					0 ==> not significant
					1 ==> very highly significant
			CONFIDENCE = 90% confidence intervals. 
				 (n,2) element vector where n = length of ts1.
				 CONFIDENCE(*,0) = lower limit of 90% interval
				 CONFIDENCE(*,1) = upper limit of 90% interval

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: R.A.Vincent, Physics Dept., University of Adelaide,
		Early 1989.
	Enhanced:   T.J.Harris, Physics Dept., University of Adelaide,
		Late 1989.

(See /host/bluemoon/usr2/idllib/contrib/harris/coherency.pro)


COPYRIGHT

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

 PURPOSE:		Put a current date/time stamp and user id at bottom of 
			plot (but outside plot region). Generally only useful  
			for PostScript plots as the plotted page is smaller  
			than the physical page therefore text outside the plot
			region can still be seen. Not so useful for window  
			dumps unless the user has reduced the plot region by  
			setting !P.REGION.

 CATEGORY:		Utility

 CALLING SEQUENCE:	copyright
			copyright,"use this text string instead",size=1.2
			copyright,xoff=0,yoff=-1

 INPUTS:
			txt	= a string to be used instead of the 
				  default USERNAME and SYSTEM DATE

		KEYWORDS:
			SIZE	= size in character units. Default is 1.5
			XOFF	= the offset (in character units) towards the 
				  -ve x-axis from the extreme +ve x-axis, 
				  where the end of the text string will be 
				  aligned (default is +3.5)
			YOFF	= the offset (in character units) towards the 
				  +ve y-axis from 0, 
				  where the end of the text string will be 
				  aligned (default is -2.2)

 OUTPUTS:
		Uses XYOUTS to write a text string

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
		Uses XYOUTS to write a text string
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/copyright.pro)


CURVEFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CURVEFIT
 PURPOSE:
	Non-linear least squares fit to a function of an
	arbitrary number of parameters.
	Function may be any non-linear function where
	the partial derivatives are known or can be approximated.
 CATEGORY:
	E2 - Curve and Surface Fitting
 CALLING SEQUENCE:
	YFIT = CURVEFIT(X,Y,W,A,SIGMAA)
 INPUTS:
	X = Row vector of independent variables.
	Y = Row vector of dependent variable, same length as x.
	W = Row vector of weights, same length as x and y.
		For no weighting
		w(i) = 1., instrumental weighting w(i) =
		1./y(i), etc.
	A = Vector of nterms length containing the initial estimate
		for each parameter.  If A is double precision, calculations
		are performed in double precision, otherwise in single prec.

 OUTPUTS:
	A = Vector of parameters containing fit.
	Function result = YFIT = Vector of calculated
		values.
 OPTIONAL OUTPUT PARAMETERS:
	Sigmaa = Vector of standard deviations for parameters
		A.
	
 COMMON BLOCKS:
	NONE.
 SIDE EFFECTS:
	The function to be fit must be defined and called FUNCT.
	For an example see FUNCT in the IDL User's Libaray.
	Call to FUNCT is:
	FUNCT,X,A,F,PDER
 where:
	X = Vector of NPOINT independent variables, input.
	A = Vector of NTERMS function parameters, input.
	F = Vector of NPOINT values of function, y(i) = funct(x(i)), output.
	PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
		PDER(I,J) = DErivative of function at ith point with
		respect to jth parameter.  Optional output parameter.
		PDER should not be calculated if parameter is not
		supplied in call (Unless you want to waste some time).
 RESTRICTIONS:
	NONE.
 PROCEDURE:
	Copied from "CURFIT", least squares fit to a non-linear
	function, pages 237-239, Bevington, Data Reduction and Error
	Analysis for the Physical Sciences.

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

	Iterations are perform until the chi square changes by
	only 0.1% or until 15 attempts at minimisation (with maximum of
	20 iterations) have been performed.

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

 MODIFICATION HISTORY:
	Written, DMS, RSI, September, 1982.
	       Amended to output CHISQR, and to set A=0 if no convergence
	T.J.Harris, Dept. of Physics, University of Adeliade,  August 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/th_curvefit.pro)


DATE_LABEL

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

 PURPOSE:			Label a time axis with meaningful dates/time
				The JHUAPL routine "timeaxis" generally does 
				a better job, with more flexible labelling 
				format. DATE_LABEL works best for time ranges 
				from a few days to several years.

 CATEGORY:			Utility

 CALLING SEQUENCE:		
		date_label, year, range, YAXIS=yaxis, XAXIS=xaxis, $
			FIRST=first, MID=mid, TITLE=title, NONE=none, $
			NUM_TICKS=num_ticks, NMINOR=nminor, $
			NOYEAR=noyear, ALLMONTHS=allmonths

 INPUTS:
		year	= the year of the first day in the range
		range 	= the range of the data in DAYS 
			  (will default to one of !x.range or !y.range)
	KEYWORDS:
		yaxis,xaxis	= set one or the other to define either the 
				  x or y axis as the time-axis
		first,mid	= put ticks either at the first or at the 
				  middle day of each month
		title		= title to label axis with
		none		= dont put the days in the labels
		num_ticks	= number of ticks to use (a suggestion only)
		nminor		= number of minor ticks
		noyear		= dont put years in the label
		allmonths	= put every month in the labels. 
				  The default is to choose the middle months  
				  of each season, or every second month  
				  (dependent on the time range),  
				  if the time range allows.

 OUTPUTS:		none

 COMMON BLOCKS:
			none.
 SIDE EFFECTS:
			Changes either the !x or !y system variables.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/date_label.pro)


DATE_SEL

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

 PURPOSE:
	To allow interactive selection from a series of dates

 CATEGORY:
	Utility

 CALLING SEQUENCE:
	DATE_SEL, fullsetdates, currentdate, INDEX=index

 INPUTS:
	fullsetdates = array(5,*) containing the full set of dates from
		which the choice can be made. Must be an integer or real
		array 5xNUMBERCHOICES.
		The 5 elements are assumed to be [day,mth,year,hour,minutes]
	currentdate = array(5) containing the current date selection
	INDEX = will contain the index into fullsetdates for currentdate. 
		If currentdate is not passed and index is a valid index 
		then this determines the current date
	TITLE = this will be the title displayed (replacing the default)

 OUTPUTS:
	currentdate is updated (along with index)

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		March, 1991

(See /host/bluemoon/usr2/idllib/contrib/harris/date_sel.pro)


DAYMONTH

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

 PURPOSE:
	This subroutine returns a 3 char mnemonic for month (lower case),
	the day in the month, the number of days in the month,
	and the month number, when given a year number and day of the year
	NB: Leap years ARE taken into accoount

	if the day is invalid then  dayofmth = -1

 CATEGORY:	Utility

 CALLING SEQUENCE:
		daymonth, year, days, month, dayofmth, ndays, mthnum, $
					YEAR=year, DAYS=day

 INPUTS:
		year	= year values of data. May be an array
		days	= day of year for the input year values.
			These values may be fractional and may extend beyond 
			day 366.

 OUTPUTS:
		month	= 3 character mnemonic for the month (in lowercase), 
			of same dimension as "days"
		dayofmonth = the day of month for each element in "days"
		ndays	= the total number of days in the month
		mthnum	= month number froim 1-12

	KEYWORDS:
		YEAR	= an array of same dimensions as "days" containing 
			  the years for each element of "days"
		DAY	= the day of year (given in output keyword YEAR)

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		17 Nov, 1988.

	modified so that if the doy is greater than the number of days
	in the year then the year will be incremented
	T.J.H.  23/10/89

	modified so that the doy can be fractional (by integerising doy)
	T.J.H.  20/07/91

(See /host/bluemoon/usr2/idllib/contrib/harris/daymonth.pro)


DEFINECT

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

 PURPOSE:		defines a colour table with given number of colours

 CATEGORY:		Display

 CALLING SEQUENCE:	definect, ncolours, /load
			definect, ncolours, /load, ct=ct
			definect, ncolours, red=r, blue=b, green=g

 INPUTS:
			ncolours = number of colours

		KEYWORDS:
			load	= load the newly defined colour table 
				  onto the plot device
			ct	= load the standard colour table number "ct" 
				  and modify to have only "ncolours" colours


 OUTPUTS:
		KEYWORDS:
			red,green,blue = the newly defined colour table

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/definect.pro)


DEF_CIRCLE

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

 PURPOSE:		defines the user symbol (#8) to be a circle,
			either hollow or filled. Use !p.sym=8 to use it

 CATEGORY:		Utility

 CALLING SEQUENCE:	def_circle
			def_circle,/fill,color=120
			def_circle,size

 INPUTS:
			size	= option size of the symbol in units of 
				  character size (default = 1.2)

		KEYWORDS:
			fill	= fill to make a solid circle. Default is open
			color	= color index used for the filling
			thick	= thickness of the line defining the symbol

 OUTPUTS:

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/def_circle.pro)


DEMOD

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

 PURPOSE:		perform a complex-demodulation
			Shifts wanted frequency down to base-band.
 			Then applies a low-pass filter

 CATEGORY:		Time-series/Spectral analysis

 CALLING SEQUENCE:	demod,time-series,ampl,phase,period,df=df
			demod,time-series,ampl,phase,period,fil_per,df=df

 INPUTS:
			time-series = input time series (possibly complex)
			period	    = period for the complex-demodulation

   OPTIONAL PARAMETERS:
		One of these parameters must be specified in order to 
		determine the bandpass to use
			fil_per     = cutoff index of bandpassed filter 
					(1 or 2 element vector)
			DF	    = degrees of freedom to be achieved.

 OUTPUTS:
			ampl,phase  = amplitude and phase of the 
					complex-demodulated time-series

   OPTIONAL PARAMETERS:
			DF	    = degrees of freedom achieved.


 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: R.A.Vincent, Physics Dept., University of Adelaide,
		Early 1989.
	Enhanced:   T.J.Harris, Physics Dept., University of Adelaide,
		Late 1989.

(See /host/bluemoon/usr2/idllib/contrib/harris/demod.pro)


DISP3

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		DISP3
 PURPOSE:
	Show a 2d array three ways in a display that combines  
		SHADE_SURF, CONTOUR, and an IMAGE.
 CATEGORY:
	Display, graphics.
 CALLING SEQUENCE:
	DISP3, Image [, Interp = Interp]
 INPUTS:
	Image = a 2 dimensional array to display.
 OPTIONAL INPUT PARAMETERS:
	Interp keyword, set to interpolate pixel display.  Slightly
		slower, but for small images makes a better display.
	Sscale = Reduction scale for surface.  Default = 1.  If not 1 then
		the image size is reduced by this factor for the surface
		display.  If the image dimensions are not an integral multiple
		of Sscale the image is reduced to the next smaller multiple.
	ax,az = passed to shade_surf
	other parameters passed to contour

 OUTPUTS:
	No explicit outputs.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	Display is changed.
 RESTRICTIONS:
	The display gets too "busy" when displaying larger (say 50 by 50),
	images, especially if they are noisy.  It might be a good idea
	to use SMOOTH or REBIN or both to smooth the surface plot.

	You might want to modify the calls to contour and surface slightly
	to customize the display to your tastes, i.e. with different colors,
	skirts, linestyles, contour levels, etc.

 PROCEDURE:
	First, do a SURFACE with no data to establish the 3d to 2d scaling.
	Then convert the coordinates of the corner pixels of the array to
	2d using.  Use POLYWARP to get the warping polynomial to warp the
	2d image into the area underneath the surface plot.  Output the image,
	output the surface (with data) and then output the contour plot at
	the top (z=1).
 MODIFICATION HISTORY:
	Modified from SHOW3 by	DMS. April, 1988.
	Added axis rotation options and automated the separation of the
	surface from the image so that they dont overwrite each other.
						T.J.Harris April 1991

(See /host/bluemoon/usr2/idllib/contrib/harris/disp3.pro)


DIST2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		DIST2
 PURPOSE:	Form a square array in which each element is proportional
		to its radius from the centre.
 CATEGORY:	Signal Processing.
 CALLING SEQUENCE:
	Result = DIST2(N)
 INPUTS:
	N = size of result.
	ANGLE = if set output angle not distance array
 OUTPUTS:
	Result = (N,N) floating array in which:
	R(i,j) = sqrt(F(i)^2 + F(j)^2)   where:
		F(i) = i - (n-1)*0.5
	or (if ANGLE set) = (atan(F(i)/F(j))*180/pi + 360) mod 360

 SIDE EFFECTS:	None.
 RESTRICTIONS: None.
 PROCEDURE:	Straightforward.  Done a row at a time.
 MODIFICATION HISTORY:
		Based on DIST.pro
		1/8/91 T.J.H.

(See /host/bluemoon/usr2/idllib/contrib/harris/dist2.pro)


DIST3

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		DIST3
 PURPOSE:	Form a square array in which each element is an elliptical
		function proportional to its radius from the centre.
 CATEGORY:	Signal Processing.
 CALLING SEQUENCE:
		Result = DIST3(N)
 INPUTS:
		N = size of result.
		major	= major axis length
		minor 	= minor axis length
	KEYWORDS:
		STEPS	= number of steps to create (default = 0)
 OUTPUTS:
	Result = (N,N) floating array in which:
	R(i,j) = sqrt((F(i)/major)^2 + (F(j)/minor)^2)   where:
		F(i) = i - (n-1)*0.5

 SIDE EFFECTS:	None.
 RESTRICTIONS: None.
 PROCEDURE:	Straightforward.  Done a row at a time.
 MODIFICATION HISTORY:
		Based on DIST2.pro
		11/8/92 T.J.H.

(See /host/bluemoon/usr2/idllib/contrib/harris/dist3.pro)


DIST4

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		DIST4
 PURPOSE:	Form a square array in which each element is an elliptical
		function proportional to its radius from the centre.
		This is then stepped steps times
 CATEGORY:	Signal Processing.
 CALLING SEQUENCE:
		Result = DIST4(N)
 INPUTS:
		N 	= size of result.
		major	= major axis length
		minor 	= minor axis length
	KEYWORDS:
		STEPS	= number of steps to create (default = 0)
 OUTPUTS:
	Result = (N,N) floating array in which:
	R(i,j) = sqrt((F(i)/major)^2 + (F(j)/minor)^2)   where:
		F(i) = i - (n-1)*0.5

 SIDE EFFECTS:	None.
 RESTRICTIONS: None.
 PROCEDURE:	Straightforward.  Done a row at a time.
 MODIFICATION HISTORY:
		Based on DIST3.pro
		11/8/92 T.J.H.

(See /host/bluemoon/usr2/idllib/contrib/harris/dist4.pro)


ELLIPSOID

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

 PURPOSE:		create an ellipsoidal gaussian volume density function

 CATEGORY:		Signal Processing.

 CALLING SEQUENCE:	
			result = ELLIPSOID(n)
			result = ELLIPSOID(n,aspect=aspect)

 INPUTS:
			
		n 	= size of result. (default = 50)
	KEYWORDS:
	ASPECT	= aspect ratio of the ellipse  (default = 0.75)
		STEPS	= number of steps to create (default = 0)
 OUTPUTS:
	Result = (N,N,N) floating array in which each 2-d layer is created 
		 by the ellipse generating function DIST4

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/ellipsoid.pro)


ENCAPS

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

 PURPOSE:		Toggles Encapsulate PS switch
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	encaps
			encaps,/RESET

 INPUTS:
	KEYWORDS:
			RESET	= reset the number that the /NEXT keyword in 
				  PSETUP uses. This number is appended to the 
				  file name to allow multiple files to be 
				  generated without overwriting each other. 
				  The number is reset = RESET
				  The number is incremented with each call to 
				  PSETUP,/next

 OUTPUTS:		none

 COMMON BLOCKS:
			PSET
 SIDE EFFECTS:		sets ENCAPS flag in common PSET
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/encaps.pro)


EVERY_2ND_XTICK

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

 PURPOSE:		reduce the tick axis labelling to label only 
			every 2nd tick

 CATEGORY:		Utility

 CALLING SEQUENCE:	newticknames = every_2nd_xtick(oldticknames)

 INPUTS:		oldticknames = string array of tick labels
				if not specified will default to !x.tickname

 OUTPUTS:		newticknames = oldticknames where every 2nd label 
				has been blanked out
 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

	Modified  4/11/93 TJH 	Renamed from EVERY_SECOND_XTICK to 
				EVERY_2ND_XTICK as the original name was too  
				long for auto-recognition by IDL.  
				Now handles case of !x.ticks = 0

(See /host/bluemoon/usr2/idllib/contrib/harris/every_2nd_xtick.pro)


FFT_XCORR

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

 PURPOSE:		Perform a cross-correlation using an FFT

 CATEGORY:		Time-Series/Spectral analysis

 CALLING SEQUENCE:	fft_xcorr, tdata1, tdata2, NORMAL_FACTOR=nf

 INPUTS:		tdata1,tdata2 = (Complex) vectors containing the 
					time series

 OUTPUTS:
   KEYWORD PARAMETERS:	NORMAL_FACTOR = the normalisation factor used. 
					This allows the user to recreate the  
					Covariance function

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
MOD 6/11/92	T.J.H.	needed to shift the function by n/2

(See /host/bluemoon/usr2/idllib/contrib/harris/fft_xcorr.pro)


FILTER

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

 PURPOSE:		perform digital filtering in the frequency domain 
			via FFT

 CATEGORY:		Time-series/Spectral analysis

 CALLING SEQUENCE:	
			result = filter(time_series, /TIME, $
			     lowperiod_cutoff, highperiod_cutoff, /BANDPASS)

			result = filter(time_series, /FREQ, $
			     lowfreq_cutoff, highfreq_cutoff, /BANDPASS)

			result = filter(time_series, /FREQ, $
			     lowfreq_cutoff, highfreq_cutoff, /NOTCH)

			result = filter(time_series, maxperiod, /LOWPASS)

			result = filter(time_series, $
			     highfreq_cutoff, /FREQ, /LOWPASS)

			result = filter(time_series, $
			     lowfreq_cutoff, /FREQ, /HIGHPASS)

			result = filter(time_series, /FREQ, WTS = wts)

 INPUTS:	time_series = input time series to filter
		low_cutoff, high_cutoff = the limits (either in 
			frequency or time, dependent on the keyword usage) for 
			the filter. Only one paramter is required if the filter
			is one-sided (LOWPASS or HIGHPASS). These paramters 
			are ignored if the WTS keyword is used
	KEYWORD PARAMETERS:
		FREQ, TIME = signals how the cutoff parameters will be 
			interpretted. Either as PERIODS in the time domain or 
			FREQUENCIES in the frequency domain. Default is /TIME
			These paramters	are ignored if the WTS keyword is used
		LOWPASS = low-pass filter. Use the first cutoff parameter as 
			the step function cutoff value 
		HIGHPASS = high-pass filter. Use the first cutoff parameter as 
			the step function cutoff value  
		BANDPASS = band-pass filter. Use both cutoff parameters as 
			the limits of the rectangular pass window. 
		NOTCH    = notch filter. Use both cutoff parameters as 
			the limits of the rectangular rejection window.
		WTS 	= independently set the window weights in the 
			frequency domain. This will override all other 
			parameters.
		TYPE 	= can have 1 of four values (case insensitive). 
			"LOWPASS", "HIGHPASS", "NOTCH", "FREQ_FILTER_WTS"
 OUTPUTS:
		result  = filtered time series 

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: R.A.Vincent, Physics Dept., University of Adelaide,
		Early 1989.
	Enhanced:   T.J.Harris, Physics Dept., University of Adelaide,
		Late 1989.

(See /host/bluemoon/usr2/idllib/contrib/harris/filter.pro)


FMOFT

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

 PURPOSE:		Performs a DFT on unequally spaced data by finding 
			an orthogonal basis set based on the sine function.

 CATEGORY:		Signal Processing and Data Analysis

 CALLING SEQUENCE:	result = FMOFT(time_values, data, direction)

 INPUTS:
			time_values 	= relative spacing of the data
			data		= data to be transformed
			direction	= direction of the transform
	KEYWORDS:
			OVER_SAMPLE	= over-sampling factor. Since this is 
					a DFT, frequency space can be sampled  
					at any arbitrary resolution. This  
					gives the integer factor to  
					over-sample by. Default = 1  
					(no over-sampling)
			WEIGHTS		= weights for the data
 OUTPUTS:
			Result = (n_elements(data)*OVER_SAMPLE) Complex array

   OPTIONAL PARAMETERS:


 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
	17/9/92 Based on the fortran sub "fmoft.f" in my library source

c	v1.0  T.J.H.  14/11/89  based on method of S. Ferraz-Mello
c		" Estimation of Periods from Unequally spaced Observations "
c		'The Astronomical Journal', vol 86, pg 619, 1981
c
c	v1.1  T.J.H.  18/01/91  Corrected mintime and maxtime

(See /host/bluemoon/usr2/idllib/contrib/harris/fmoft.pro)


FUNCTION DECILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FUNCTION DECILE

 PURPOSE:
	This function will compute the 10,50 and 90 %iles from the given
	input vector unless the second parameter is supplied, in which case 
	those values will be used.

 CATEGORY:
	utilities

 CALLING SEQUENCE:
	coeff = DECILE (vector)
	coeff = DECILE (vector, percentile_values)

 INPUTS:
	vector = any vector
	percentile_values (optional) = a vector containing percentile values 
		to be calculated (as %ages 0-100)

 OUTPUTS:
	coeff = [lowerdecile,median,upperdecile]
		a 3 element vector, fltarr(3)
	coeff = [percentiles] as for parameter percentile_values
		NOTE: if coefficient is a SINGLE element then it is a SCALAR,
			OTHERWISE it is a VECTOR

 COMMON BLOCKS:
	none.

 SIDE EFFECTS:
	none.

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		September, 1990.
	Modified April 8, 1991, T.J.H. to give variable percentage input.
       Modified September 9, 1994, T.J.H.
		If input decile is a scalar value then output is a scalar

(See /host/bluemoon/usr2/idllib/contrib/harris/decile.pro)


FUNCT[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FUNCT
 PURPOSE:
	EVALUATE THE SUM OF A GAUSSIAN AND A CONSTANT
	AND OPTIONALLY RETURN THE VALUE OF IT'S PARTIAL DERIVATIVES.
	NORMALLY, THIS FUNCTION IS USED BY CURVEFIT TO FIT THE
	SUM OF A SPECTRAL LINE AND A VARYING BACKGROUND TO ACTUAL DATA.

 CATEGORY:
	E2 - CURVE AND SURFACE FITTING.
 CALLING SEQUENCE:
	FUNCT,X,A,F,PDER
 INPUTS:
	X = VALUES OF INDEPENDENT VARIABLE.
	A = PARAMETERS OF EQUATION DESCRIBED BELOW.
 OUTPUTS:
	F = VALUE OF FUNCTION AT EACH X(I).

 OPTIONAL OUTPUT PARAMETERS:
	PDER = (N_ELEMENTS(X),4) ARRAY CONTAINING THE
		PARTIAL DERIVATIVES.  P(I,J) = DERIVATIVE
		AT ITH POINT W/RESPECT TO JTH PARAMETER.
 COMMON BLOCKS:
	NONE.
 SIDE EFFECTS:
	NONE.
 RESTRICTIONS:
	NONE.
 PROCEDURE:
	F = A(0)*EXP(-Z^2) + A(3) 
	Z = (X-A(1))/A(2)
 MODIFICATION HISTORY:
	WRITTEN, DMS, RSI, SEPT, 1982.

	MOD,	Amended to use only constant term, a3, in the poly fit
		and removed error messages for EZ
		and a2 is now the 1/e width not 1/2 width as before !!
	T.J.Harris, Dept. of Physics, University of Adeliade,  August 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/gaussfit.pro)


FUNCT[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FUNCT
 PURPOSE:
	EVALUATE THE SUM OF A x*GAUSSIAN AND A CONSTANT
	AND OPTIONALLY RETURN THE VALUE OF IT'S PARTIAL DERIVATIVES.
	NORMALLY, THIS FUNCTION IS USED BY CURVEFIT TO FIT TO ACTUAL DATA.

 CATEGORY:
	E2 - CURVE AND SURFACE FITTING.
 CALLING SEQUENCE:
	FUNCT,X,A,F,PDER
 INPUTS:
	X = VALUES OF INDEPENDENT VARIABLE.
	A = PARAMETERS OF EQUATION DESCRIBED BELOW.
 OUTPUTS:
	F = VALUE OF FUNCTION AT EACH X(I).

 OPTIONAL OUTPUT PARAMETERS:
	PDER = (N_ELEMENTS(X),4) ARRAY CONTAINING THE
		PARTIAL DERIVATIVES.  P(I,J) = DERIVATIVE
		AT ITH POINT W/RESPECT TO JTH PARAMETER.
 COMMON BLOCKS:
	NONE.
 SIDE EFFECTS:
	NONE.
 RESTRICTIONS:
	NONE.
 PROCEDURE:
	F = A(0)*Z*EXP(-Z^2) + A(3) 
	Z = (X-A(1))/A(2)
 MODIFICATION HISTORY:
	WRITTEN, DMS, RSI, SEPT, 1982.

	MOD,	Amended to use only constant term, a3, in the poly fit
		and removed error messages for EZ
		and a2 is now the 1/e width not 1/2 width as before !!
	T.J.Harris, Dept. of Physics, University of Adeliade,  August 1990.

	MOD,	Changed function to be  x.exp(-x^2)
	T.J.Harris, HFRD, DSTO,  September 1993.

(See /host/bluemoon/usr2/idllib/contrib/harris/xexfit.pro)


GAUSSFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GAUSSFIT
 PURPOSE:
 	Fit y=f(x) where:
 	F(x) = a0*exp(-z^2) + a3 
 		and z=(x-a1)/a2
	a0 = height of exp, a1 = center of exp, a2 = 1/e width,
	a3 = constant term
 	Estimate the parameters a0,a1,a2,a3 and then call curvefit.
 CATEGORY:
	?? - fitting
 CALLING SEQUENCE:
	yfit = gaussfit(x,y,a)
 INPUTS:
	x = independent variable, must be a vector.
	y = dependent variable, must have the same number of points
		as x.
 OPTIONAL INPUT PARAMETERS:
	init = a four element vector containing initial estimates of the
		 parameters 'a'.
	weights = weightings for the data points
 OUTPUTS:
	yfit = fitted function.
 OPTIONAL OUTPUT PARAMETERS:
	a = coefficients. a four element vector as described above.
	sigma = the standard deviations of the parameters 'a'

 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	The peak or minimum of the gaussian must be the largest
	or respectively the smallest point in the Y vector.
 PROCEDURE:
	If the (max-avg) of Y is larger than (avg-min) then it is assumed
	the line is an emission line, otherwise it is assumed there
	is an absorbtion line.  The estimated center is the max or min
	element.  The height is (max-avg) or (avg-min) respectively.
	The width is foun by searching out from the extrem until
	a point is found < the 1/e value.
 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.

		Reduced the poly fit to be only a constant term, a3
		Added optional input and output parameters.
	T.J.Harris, Dept. of Physics, University of Adeliade,  August 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/gaussfit.pro)


GAUSSIAN_FIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GAUSSIAN_FIT
 PURPOSE:
	Fits a gaussian using a least square polynomial fit (poly_fit) 
	to the log of the data.
 CATEGORY:
	?? - CURVE FITTING.
 CALLING SEQUENCE:
	COEFF = GAUSSIAN_FIT(X,Y[,YFIT,YBAND,WEIGHT = WEIGHT] )
 INPUTS:
	X = independent variable vector.
	Y = dependent variable vector, should be same length as x.

 OUTPUTS:
	Function result= Coefficient vector, length 2.
	first coeff is the 1/e width,
	second coeff is the x value of the peak
	third coeff is the peak y value
   OPTIONAL PARAMETERS:
	YFIT = Vector of calculated Y's.  Has error + or - YBAND.
	YBAND = Error estimate for each point = 1 sigma (untested)
	WEIGHT = weighting of data for fitting

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/gaussian_fit.pro)


GETPERIOD_SCL

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

 PURPOSE:	to calculate the positions of the ticks for a period scale,
		when the main scaling is linear in frequency.

 CATEGORY:	utility

 CALLING SEQUENCE:
		getperiod_scl,period_tick_values,period_tick_names,
		minor_tick_values,nticks=nticks,scale=scale,
		xaxis=xaxis,yaxis=yaxis,mnticks=mnticks,factor=factor,
		labelfraction=labelfraction

 INPUTS:	none (but the plot scaling must already be defined,
			so a call to plot,/nodata,/noerase,xstyle=4,ystyle=4
			may be required before calling this procedure)

		NOTE: set !x.minor or !y.minor = -1 to inhibit auto-minor 
			ticks when calling axis

 OUTPUTS:
		(all parameters are optional. If no parameters given then the
			system parameters !(x/y).tickv and !(x/y).tickname will
			be set. The default axis is the x-axis)

		period_tick_values = an array that can be used in the tickv 
				parameter in axis to draw a period scale
		period_tick_names = an array that can be used in the tickname
				parameter in axis to label the period scale
		minor_tick_values = an array that can be used in the tickv 
				parameter in axis to draw minor ticks for the
				period scale

   KEYWORD PARAMETERS:

		nticks = the nominal number of major ticks to draw
			The actual number may be different depending on the 
			frequency limits of the plot scale.
			The number of minor ticks will be a multiple of this
			number < 30 unless keyword mnticks set
			This is output as the correct number of major-ticks

		mnticks = the nominal number of minor ticks to draw
			This is output as the correct number of minor-ticks

		factor = the number of minor ticks for each major tick
			(remember that mnticks limitted to < 30)

		scale = the scaling to apply to the frequency, to give
			appropriate period ranges. 
			EG: scale=24. for frequencies in cycles/day to give
				periods in hours

		xaxis,yaxis = which system variable to use to get the plot
			scaling from. Default is xaxis

		labelfraction = the fraction of the frequency scale to label
			down to. Default is 0.125
			Normally, if the frequency scale is linear, then the
			periods will cluster at the low frequency end.
			Sometimes this causes a multitude of ticks at the low 
			frequency end. 
			Especially as the minimum frequency --> 0

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none if parameters have been passed,
	otherwise !(x/y).ticks,.tickname,.tickv are changed to be period scales
		and !(x/y).minor set to -1 to inhibit minor ticks

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		May, 1991.

(See /host/bluemoon/usr2/idllib/contrib/harris/getperiod_scl.pro)


GET_TIMES

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

 PURPOSE:
	To allow interactive selection from a series of dates

 CATEGORY:
	Utility

 CALLING SEQUENCE:
	GET_TIMES, fullsetdates, mdate, num_plts, TITLE=title

 INPUTS:
	fullsetdates = array(5,*) containing the full set of dates from
		which the choice can be made. Must be an integer or real
		array 5xNUMBERCHOICES.
		The 5 elements are assumed to be [day,mth,year,hour,minutes]
	TITLE = this will be the title displayed (replacing the default)

 OUTPUTS:
	mdate = array(5,num_plts) will contain the "num_plts" selected dates, 
	by recursively calling DATE_SEL

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		March, 1991

(See /host/bluemoon/usr2/idllib/contrib/harris/get_times.pro)


HISTO_2D

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

 PURPOSE:
	produces an histogram from arbitrary x,y data

 CATEGORY:
	mathematical functions

 CALLING SEQUENCE:
	histo_array = HISTO_2D (xarray,yarray, $
				binsize=binsize,bmax=bmax,bmin=bmin)

 INPUTS:
	XARRAY,YARRAY = the x,y data VECTORS to be histogrammed. 
		These define points on the cartesian plane, so should be 
		of the same length.

   KEYWORD PARAMETERS:
	XBINSIZE,YBINSIZE = the size of the bin used for the x,y data
				defaults to 1
	XMAX,YMAX = maximum value considered for the histogram
			defaults to the maximum value in the data
	XMIN,YMIN = minimum value considered for the histogram
			defaults to the minimum value in the data
	BINSIZE = if used then this will be the size of the bin used for both
		 the x,y data (overridden by the explicit x,y binsize)
	BMAX = maximum value considered for the histogram used for both
		 the x,y data (overridden by the explicit x,y max)
	BMIN = minimum value considered for the histogram used for both
		 the x,y data (overridden by the explicit x,y min)

 OUTPUTS:
	The histogram of the data,
	dimensions are ((xmax-xmin)/xbinsize,(ymax-ymin)/ybinsize)

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	produces output array

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

	Modified: 29 April, 1994, TJH (HFRD, DSTOS)
		Fixed problem where if ?min/max set to zero then it was
		ignored. This occurred because the function KEYWORD_SET was
		used so that a value of 0 was interpretted as being NOT
		SET. Now use N_ELEMENT call.

(See /host/bluemoon/usr2/idllib/contrib/harris/histo_2d.pro)


LEAPYR

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

 PURPOSE:		determine whether the input year is a leap year or not
			Very useful for finding number of days in a year.
			eg. NUM_DAYS_IN_YR = 365 + leapyr(year)

 CATEGORY:		Utility

 CALLING SEQUENCE:	result = leapyr(year)

 INPUTS:		year	= test if year is a leap year 
				  year may be a vector and may be in the  
				  form MCDU eg. 1788 else defaults to 19XX

 OUTPUTS:		result 	= 0 then not a leap year
				= 1 then year is a leap year
				= (399+(yr mod 400))/400 - (3+(yr mod 4))/4

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		20/09/88

(See /host/bluemoon/usr2/idllib/contrib/harris/leapyr.pro)


MTHNUMDAY

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

 PURPOSE:
	This subroutine calculates the day number of the start of the month,
	the number of days in the month, and a 3 char mnemonic for month 
	(lower case), when given a year number and the month number
	if the month number is invalid then stday=-1

 CATEGORY:	Utility

 CALLING SEQUENCE:
		mthnumday,mthnumber,year,stday,ndays,month

 INPUTS:
		mthnumber = months from the set [1,12]
		year	= year values of data. May be an array

 OUTPUTS:
		stday	= start day of year for the months
		ndays	= number of days in the months
		month	= 3 character mnemonic for the month (in lowercase), 

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		17 Nov, 1988.

(See /host/bluemoon/usr2/idllib/contrib/harris/mthnumday.pro)


OPLOTGAPPY

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

 PURPOSE:
 a procedure to oplot the sections of the x,y arrays that contain values
  that are less than ymax and or xmax

 CATEGORY:		plotting

 CALLING SEQUENCE:	OPLOTGAPPY,x,y,xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax

 INPUTS:
			x,y	= the x and y data arrays to be plotted
		KEYWORDS:
			xmin	= x values smaller than this signify bad data
			xmax	= x values larger than this signify bad data
			ymin	= y values smaller than this signify bad data
			ymax	= y values larger than this signify bad data
			symsize	= size of symbols to use

 OUTPUTS:
	data is over-plotted

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Damian Murphy (djm) 5/8/89,
		Physics Dept., University of Adelaide

  Modified Aug. 1991 Trevor Harris, to treat non-finite values as bad points
  Modified Jan. 1992 Trevor Harris, pass some oplot parameters through
  Modified Feb. 1993 Trevor Harris, allow x gaps as well as y
  Modified Sep. 1994 Brenton Vandepeer, allow minimum x and y limits
  Modified Feb. 1995 Brenton Vandepeer, remove a few bugs.

(See /host/bluemoon/usr2/idllib/contrib/harris/oplotgappy.pro)


OPLOTGAPPY_1

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

 PURPOSE:
 a procedure to oplot the sections of the x,y arrays that contain values
  that are less than ymax and or xmax

 CATEGORY:		plotting

 CALLING SEQUENCE:	OPLOTGAPPY,x,y,xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax

 INPUTS:
			x,y	= the x and y data arrays to be plotted
		KEYWORDS:
			xmin	= x values smaller than this signify bad data
			xmax	= x values larger than this signify bad data
			ymin	= y values smaller than this signify bad data
			ymax	= y values larger than this signify bad data
			symsize	= size of symbols to use

 OUTPUTS:
	data is over-plotted

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Damian Murphy (djm) 5/8/89,
		Physics Dept., University of Adelaide

  Modified Aug. 1991 Trevor Harris, to treat non-finite values as bad points
  Modified Jan. 1992 Trevor Harris, pass some oplot parameters through
  Modified Feb. 1993 Trevor Harris, allow x gaps as well as y
  Modified Sep. 1994 Brenton Vandepeer, allow minimum x and y limits

(See /host/bluemoon/usr2/idllib/contrib/harris/oplotgappy_1.pro)


PLACETITLES

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

 PURPOSE:		places titles (up to two lines), subtitles and 
			information line onto page. Useful for multiple plots  
			to label the entire set of figures. Also useful for  
			single page plots which already have labelling on the  
			top and bottom, for example when there are multiple  
			scales such as frequency at the bottom and period at  
			the top. This routine is most useful for postscript  
			files as the titles are placed near the borders of  
			the plot region (!p.region). This may cause the titles
			(and always causes the infoline) to be partially off  
			of the window in X-window applications.

 CATEGORY:		Plot Utility

 CALLING SEQUENCE:	PLACETITLES,title,subtitle,SIZE=size,/NOCOPYRIGHT

 INPUTS:
			title	= string or strarr(2) containing the title
   OPTIONAL PARAMETERS:
			subtitle= string containing the subtitle
	KEYWORDS:
			SIZE	= titles will be 1.3*SIZE in character units 
				 (default=1.3*!p.charsize)
			NOCOPYRIGHT = disable the information line.
				This line is written using COPYRIGHT routine

 OUTPUTS:		none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:		writes onto current pliot window
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/placetitles.pro)


PLOTERR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PLOTERR
 PURPOSE:
	Plot data points with accompanying error bars.
 CATEGORY:
 CALLING SEQUENCE:
	OPLOTERR, [ X ,]  Y , ERR [, PSYM = psym] [,symsize=SYMSIZE] [,/xaxis] [,/yaxis] [,lerr=lerr, uerr=uerr]
 INPUTS:
	X = array of abcissae.
	Y = array of Y values.
	ERR = array of error bar values.
 OPTIONAL INPUT KEYWORD PARAMETERS:
	PSYM = plotting symbol array (default = +7)
	SYMSIZE = plotting symbol size  (default = 1)
	XAXIS,YAXIS = the direction of the error (defaults to yaxis)
	LERR,UERR = lower and upper error values (overrides ERR)
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	Arrays must not be of type string.  There must be enough points to
	plot. Assumes linear-linear plot of the data
 PROCEDURE:
	A plot of X versus Y with error bars drawn from Y-ERR to Y+ERR 
	(or X-ERR to X+ERR if /XAXIS set) is over-written to the output device.
 MODIFICATION HISTORY:
	William Thompson	Applied Research Corporation
	July, 1986		8201 Corporate Drive
				Landover, MD  20785
	DMS, April, 1989	Modified for Unix
	TJH, July,  1990	Modified to overplot and allows different
				symbols for each point
	TJH, September, 1991	Modified to allow x or y error bars (not both)

(See /host/bluemoon/usr2/idllib/contrib/harris/oploterr.pro)


PLOTUTES_MENU

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

 PURPOSE:		provides a simple menu of often used plot utilities

 CATEGORY:		plot utility

 CALLING SEQUENCE:	plotutes_menu
			plotutes_menu,ps,IMAGE=image

 INPUTS:
   OPTIONAL PARAMETERS:
			IMAGE	= image array that the colour functions can use
 OUTPUTS:

   OPTIONAL PARAMETERS:
			ps  = 	flag denoting that PostScript plotting has 
				been selected

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:		can change colour tables etc...
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/plotutes_menu.pro)


PLOT_CIRCLE

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

 PURPOSE:		plots a circle on the current plot device

 CATEGORY:		plot utility

 CALLING SEQUENCE:	plot_circle, size, /FILL, COLOR=c, THICK=t, /OVERPLOT

 INPUTS:		size	= radius of circle in data units

	KEYWORDS:
			FILL	= solid fill the circle
			COLOR	= colour to fill with
			THICK	= thickness of the line defining the circle
			OVERPLOT = overplot rather than create a new plot

 OUTPUTS:		none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:		plots to current plot device
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/plot_circle.pro)


POLAR_HIST

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

 PURPOSE:
	produces a 2D histogram from polar data

 CATEGORY:
	mathematical functions

 CALLING SEQUENCE:
	histo_array = POLAR_HIST (rarray,aarray,number, $
	rbinsize=rbinsize,abinsize=abinsize,rmax=rmax,rmin=rmin)

 INPUTS:
	RARRAY,AARRAY = the radial and angle (degrees) data to be histogrammed.
		These define points on the cartesian plane, so should be 
		of the same length.
		Angle in range 0.-360. degrees
	NUMBER = the number of elements per side for the output xy image,
		defaults to (20*RMAX/RBINSIZE)

   KEYWORD PARAMETERS:
	RBINSIZE = the size of the bin used for the radial data
				defaults to 1
	RMAX = maximum radial value considered for the histogram
			defaults to the maximum value in the data
	RMIN = minimum radial value considered for the histogram
			defaults to the minimum value in the data
	ABINSIZE = the size of the bin used for the angle data
				defaults to 1 degree increments

 OUTPUTS:
	The histogram of the data,
	dimensions are (number,number)

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	produces output array

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1991.

(See /host/bluemoon/usr2/idllib/contrib/harris/polar_hist.pro)


PSCOLOUR

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

 PURPOSE:		Toggles the colour switch
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	pscolour
			pscolour, /RESET, /COLOR

 INPUTS:
	KEYWORDS:
			RESET	= reset the number that the /NEXT keyword in 
				  PSETUP uses. This number is appended to the 
				  file name to allow multiple files to be 
				  generated without overwriting each other. 
				  The number is reset = RESET
				  The number is incremented with each call to 
				  PSETUP,/next
			GREY = create gray-scale PS (.ps) 
				This is the reverse toggle of /COLOR
			COLOR	 = create colour PS (.cps), 
				default = gray-scale (.ps)

 OUTPUTS:		none

 COMMON BLOCKS:
			PSET
 SIDE EFFECTS:		sets COLOUR flag in common PSET
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/pscolour.pro)


PSETUP

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

 PURPOSE:		Suite of procedures that provide easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	psetup
			psetup,filename	
			psetup,file, /NEXT, /LANDSCAPE, /HIGH_RES, /INCOLOUR

 INPUTS:
   OPTIONAL PARAMETERS:
			file 	= the name of the created PS file 
				  (default = idl.ps)
	KEYWORDS:
			NEXT 	= if set then append a number to the file name
				  thus the default becomes idl-1.ps.
				  This number is appended to the 
				  file name to allow multiple files to be 
				  generated without overwriting each other. 
				  The number is reset with the /RESET keyword 
				  using PSFILE
				  The number is incremented with each call to 
				  PSETUP,/next
			HORIZONTAL = setup plot in landscape mode
				(longer side aligned with x-axis)
			LANDSCAPE = setup plot in landscape mode
				(longer side aligned with x-axis)
			VERTICAL = setup plot in portrait mode
				(longer side aligned with y-axis)
			PORTRAIT = setup plot in portrait mode
				(longer side aligned with y-axis)
			LO_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 4 shades
			MED_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 16 shades
			HIGH_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 256 shades
			INCOLOUR = create colour PS (.cps), 
				default = gray-scale (.ps)
			COLOR	 = create colour PS (.cps), 
				default = gray-scale (.ps)
			ENCAPSULATE = create encapsulated PS (.eps or .cep)
			LONGSIDE = set the length (in cm) of the long side of  
				the plot page. NB: this is the long side of  
				the paper, not the x or y axis as this  
				relationship will vary with the /LAND and  
				/PORT keywords. The "longside" is the x-axis  
				in landscape mode and the y-axis in potrait  
				mode. (default = 29.7 - 8.0 cm = A4 + border)
			SHORTSIDE = set the length (in cm) of the short side of
				the plot page. NB: this is the short side of  
				the paper, not the x or y axis as this  
				relationship will vary with the /LAND and  
				/PORT keywords. The "shortside" is the y-axis  
				in landscape mode and the x-axis in potrait  
				mode. (default = 21.0 - 5.3 cm = A4 + border)
			CENTRE = set the offsets so that the diagram is 
				centred on an A4 page. 
				Overrides LONG/SHORTOFFSET
			LONGOFFSET = set the length (in cm) of the long side 
				origin offset. This will be the from the lower
				left-hand-side of the plot.
				NB: this is for the long side of the paper,
				not the x or y axis as this relationship will
				vary with the /LAND and /PORT keywords.  
			SHORTOFFSET = set the length (in cm) of the short side 
				origin offset. This will be the from the lower
				left-hand-side of the plot.
				NB: this is for the short side of the paper,
				not the x or y axis as this relationship will
				vary with the /LAND and /PORT keywords. 
			NB: a default offset is used that allows room for 
			binding and a border around the page

 OUTPUTS:		none

 COMMON BLOCKS:
			PSET
			colors	;to get the original colour table

 SIDE EFFECTS:		sets device to PS and sets PS device parameters
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	Mods 15-Oct-93	T.J.H. allowed for the use of a different size colour 
		table on the PS and previous plot devices.
	Mods 22-Dec-93	T.J.H. Added ability to change the origin offset via
		KEYWORDS CENTRE, SHORTOFFSET and LONGOFFSET
	Mods 20-Sep-94  T.J.H. corrected intention of LONG/SHORTOFFSET. They
		relate to the lower LHS of plot. Zero is now a valid value

(See /host/bluemoon/usr2/idllib/contrib/harris/psetup.pro)


PSFILE

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

 PURPOSE:		Set the PS file name and resoltuion 
			(sets plot device to PS)
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	psfile
			psfile,filename	
			psfile,file, /RESET, /HIGH_RES, /INCOLOUR

 INPUTS:
   OPTIONAL PARAMETERS:
			file 	= the name of the created PS file 
				  (default = idl.ps)
	KEYWORDS:
			RESET	= reset the number that the /NEXT keyword in 
				  PSETUP uses. This number is appended to the 
				  file name to allow multiple files to be 
				  generated without overwriting each other. 
				  The number is reset = RESET
				  The number is incremented with each call to 
				  PSETUP,/next
			LO_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 4 shades
			MED_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 16 shades
			HIGH_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 256 shades
			INGREY = create gray-scale PS (.ps) 
				This is the reverse toggle of /INCOLOUR
			INCOLOUR = create colour PS (.cps), 
				default = gray-scale (.ps)
			COLOR	 = create colour PS (.cps), 
				default = gray-scale (.ps)
			ENCAPSULATE = create encapsulated PS (.eps or .cep)

 OUTPUTS:		none

 COMMON BLOCKS:
			PSET
 SIDE EFFECTS:		sets device to PS and sets PS device parameters
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	Mods 15-Oct-93	T.J.H. allowed for the use of a different size colour 
		table on the PS and previous plot devices.

(See /host/bluemoon/usr2/idllib/contrib/harris/psfile.pro)


PSRES

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

 PURPOSE:		Toggles the resolution switch
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	psres
			psres, /RESET, /HI

 INPUTS:
	KEYWORDS:
			RESET	= reset the number that the /NEXT keyword in 
				  PSETUP uses. This number is appended to the 
				  file name to allow multiple files to be 
				  generated without overwriting each other. 
				  The number is reset = RESET
				  The number is incremented with each call to 
				  PSETUP,/next
			LO_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 4 shades
			MED_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 16 shades
			HIGH_RESOLUTION = set the PS colour (gray-scale) 
				resolution to be 256 shades

 OUTPUTS:		none

 COMMON BLOCKS:
			PSET
 SIDE EFFECTS:		sets RESOLUTION flag in common PSET
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/psres.pro)


RCLEAR

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

 PURPOSE:		This is a generic procedure to close windows  
			(if they are not part of a widget), 
			redraw TEK screens, close PostScript files etc.. 
			It will also attempt to close and free all LUNs.
			The user is then returned to the top level

 CATEGORY:		Utility

 CALLING SEQUENCE:	rclear

 INPUTS:		none

 OUTPUTS:		none

 COMMON BLOCKS:
			none.
 SIDE EFFECTS:
			Windows are deleted, files closed and LUNs freed
			Uses the CLEAR procedure then RETALL

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/rclear.pro)


RESAMPLE

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

 PURPOSE:		Use a spline or linearly interpolate gappy data in 
			order to resample. Any resampled points which are too  
			large (1.5*YLIMIT) are set to the mean. These points  
			are labelled by the BADPTS keyword 

 CATEGORY:		Time-Series/Spectral analysis

 CALLING SEQUENCE:	newy = resample(x,y,newx)

			newy = resample(x,y,newx,ylimit,BADPT=badpts,/SPLINE)


 INPUTS:
			x,y	= the data to be resampled
   OPTIONAL PARAMETERS:
			newx	= the new x coords (defines the resampling).
				  If this is not passed then the data is 
				  simply resampled onto the existing x values,
				  which is useful to interpolate over bad  or 
				  missing data by use of the YLIMIT keyword
			ylimit 	= y values greater than this limit are treated 
				  as missing or bad.
   KEYWORD PARAMETERS:
			YLIMIT	= same as the ylimit parameter
			SPLINE_FIT = if set then use spline interpolants 
				  rather than the default linear interpolants 
				  (the INTERPOL routine)

 OUTPUTS:
			newy	= the interpolated/resampled y values
   KEYWORD PARAMETERS:
			YMAX	= the determined maximum(abs(y)) over the 
				  good data prior to resampling
			MAX	= YMAX but after resampling
			GOOD	= the indices of the determined GOOD data
			BADPTS	= the indices of the determined BAD data. 

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/resample.pro)


RESETPLT

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

 PURPOSE:		This procedure will reset all or a selection 
			of the system plot variables to their initial values

 CATEGORY:		Plot Utility

 CALLING SEQUENCE:	resetplt,/all		;clear the !p, !x, !y, !z 
			resetplt,/x,/z		;clear the !x and !z variables 
			resetplt,/x		;only clear the !x variable
			resetplt,/x,/invert	;clear all except the !x 

 INPUTS:		
	KEYWORDS:
		x,y,z,p	= clear the appropriate variable
		all	= clear all, this is equivalent to /x,/y,/z,/p
		invert	= invert the logic. Clear all unselected variables.
			  Therefore "clearplt,/all,/invert" does nothing.

 OUTPUTS:	none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
		The sytem plot variables are changed.
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/resetplt.pro)


RESET_SIZE

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

 PURPOSE:		Resets the size of the PS page
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	reset_size
 INPUTS:		none

 OUTPUTS:		none

 COMMON BLOCKS:	SCREENSMEM
			
 SIDE EFFECTS:		resets sizes stored in common SCREENSMEM
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/reset_size.pro)


RND

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

 PURPOSE:
	This function will round the given value up/down/in or out using the
	second parameter as the modulo (default is 1)

 CATEGORY:
	utilities

 CALLING SEQUENCE:
	rounded_value = RND(value [,round])

 INPUTS:
	VALUE = value to round

   OPTIONAL INPUT PARAMETERS:
	ROUND = option parameter to round to nearest of. (Can be non-integer)
  
   KEYWORD PARAMETERS:
	UP   = if set then round VALUE up (towards greater +ve values)
	DOWN = if set then round VALUE down (towards greater -ve values)
	OUT  = if set then round VALUE out (away from zero)
	IN   = if set then round VALUE in (towards zero)

 OUTPUTS:
	ROUNDED_VALUE = value rounded to the nearest ROUND (default is 1)

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/rnd.pro)


SAVE_SYS[1]

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

 PURPOSE:		Restore the previously saved (save_sys) system plot
			variables. Since these routines use a stack system 
			they should always be used in pairs to ensure correct 
			restoration. RESTORE_SYS pops the last set of 
			variables off the stack

 CATEGORY:		Utility

 CALLING SEQUENCE:	restore_sys
			restore_sys, /quiet

 INPUTS:
	KEYWORDS:
			QUIET	= if set then dont write restoration message

 OUTPUTS:		no explicit outputs, but redefines the system plot 
			variables, !p, !x, !y, !z

 COMMON BLOCKS:	sys_vars

 SIDE EFFECTS:
			redefines the system plot variables, !p, !x, !y, !z

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/save_sys.pro)


SAVE_SYS[2]

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

 PURPOSE:		Save the previously saved (save_sys) system plot
			variables. Since these routines use a stack system 
			they should always be used in pairs to ensure correct 
			restoration. SAVE_SYS pops the last set of 
			variables off the stack

 CATEGORY:		Utility

 CALLING SEQUENCE:	save_sys
			save_sys, /quiet
			save_sys, x=sav_x,y=sav_y,z=sav_z,p=sav_p, /quiet

 INPUTS:
	KEYWORDS:
			X,Y,Z,P = current system variable is written into these
			QUIET	= if set then dont write restoration message

 OUTPUTS:		no explicit outputs, but redefines the system plot 
			variables, !p, !x, !y, !z

 COMMON BLOCKS:	sys_vars

 SIDE EFFECTS:
			Saves the system plot variables, !p, !x, !y, !z

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/save_sys.pro)


SCREENS

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

 PURPOSE:		Generic routine to open a display on the default 
			device regardless of the device type. Thus a  
			procedure can call this routine and begin to plot  
			without having to worry about whether it is displaying 
			to a windowed or plot device. Currently only handles  
			X, Sun, PS, HP, NULL and TEK devices properly.

 CATEGORY:		Plot Utility

 CALLING SEQUENCE:	SCREENS
			SCREENS,title1,/NEXT,/PORTRAIT

 INPUTS:
   OPTIONAL PARAMETERS:
			title1 	= message which is printed to the screen
			title2 	= Window title if on a windowed device
				  (defaults to title1)
	KEYWORDS:
			NEXT 	= if set then append a number to the file name
				  if a plot device (see PSETUP), otherwise 
				  create a new window on windowed devices or 
				  clear the plot screen if in TEK 
				  This keyword allows multiple files/screens 
				  to be generated without overwriting each  
				  other. The LUN or append file number is
				  incremented with each call to SCREENS,/next
				  For the PS device the number is reset with 
				  the /RESET keyword using PSFILE
			HORIZONTAL = setup display in landscape mode
				(longer side aligned with x-axis)
			LANDSCAPE = setup display in landscape mode
				(longer side aligned with x-axis)
			VERTICAL = setup display in portrait mode
				(longer side aligned with y-axis)
			PORTRAIT = setup display in portrait mode
				(longer side aligned with y-axis)

 OUTPUTS:		no explicit outputs.
			New files/windows may be opened or screens erased 

 COMMON BLOCKS:	SCREENSMEM
	
 SIDE EFFECTS:
			New files/windows may be opened or screens erased 
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

	Ammended call to PSETUP to cater for updates in that routine
		TJH Februrary, 1994,	IE, HFRD, DSTO

(See /host/bluemoon/usr2/idllib/contrib/harris/screens.pro)


SEASON

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

 PURPOSE:
	given input date outputs season in code
		0  -- summer
		1  -- autumn
		2  -- winter
		3  -- spring

	handles doy > 365, given year = startyr 
	leap years are handled using routine LEAPYR

 CATEGORY:	Utility function

 CALLING SEQUENCE:	result = season(doy, year)
			summer = where(season(doy, year) eq 0)

 INPUTS:
		doy  = vector containing the day-of-year. Handles doy > 365
		year = either vector containing the year for each doy or a 
		       single year which applies to all the doy

 OUTPUTS:
		result = vector of same number of elements as doy containing
			the code for each season
			0  -- summer
			1  -- autumn
			2  -- winter
			3  -- spring

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/season.pro)


SECTIM

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

 PURPOSE:
	this function returns the date and time in the format ydhms, given the 
	elapsed seconds since the start of 1965

 CATEGORY:	Utility

 CALLING SEQUENCE:	ydhms = sectim(numsec)

 INPUTS:
	numsec  = array of number of seconds since 01/01/1965  0000 hr


 OUTPUTS:
	ydhms  = array of ( yr, day_of_yr, hour, min, sec )
		 yr is year in modulo 100
		 day_of_yr may extend beyond 365
		 will return -1 if the number of seconds is invalid

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: T.J.H  26/08/91 Physics Dept., University of Adelaide,
					

(See /host/bluemoon/usr2/idllib/contrib/harris/sectim.pro)


SECTIME

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

 PURPOSE:
	this function gives the date in the format dmyhms given
	the time in seconds from 1/1/1965,
	uses the routine sectim then converts the time format 
	from ydhms to dmyhms

 CATEGORY:	Utility

 CALLING SEQUENCE:	dmyhms = sectime(numsec)

 INPUTS:
	numsec  = array of number of seconds since 01/01/1965  0000 hr


 OUTPUTS:
	dmyhms  = array of ( day, month, year, hour, min, sec ) 
		year is in modulo 100
		 will return -1 if the number of seconds is invalid

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: T.J.H  26/08/91, Physics Dept., University of Adelaide,
		

(See /host/bluemoon/usr2/idllib/contrib/harris/sectime.pro)


SET_SIZE

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

 PURPOSE:		Sets the size of the PS page
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	set_size, width, height

 INPUTS:		width, height = dimensions of page
				the height is the longside and 
				the width is the shortside (see PSETUP)

 OUTPUTS:		none

 COMMON BLOCKS:	SCREENSMEM
			
 SIDE EFFECTS:		sets sizes stored in common SCREENSMEM
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/set_size.pro)


SHOWVOLUME

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

 PURPOSE:	To display a contour surface of a volume density.
		Based on the example in the RSI IDL manual. 
		Uses SURFACE, SHADE_VOLUME, POLYSHADE and TVSCL to produce 
		a surface in 3-D coords.

 CATEGORY:

 CALLING SEQUENCE:
		ShowVolume, volume, thresh, LOW = low, VERTICES=v, POLYGONS=p

 INPUTS:
		volume	= 3-d array specifying a volume density function
		thresh	= the value of the density function at which 
			  to form a surface
	KEYWORDS:
		LOW	= If set then the surface will enclose the higher 
			  valued data (the LOW side of the surface is shown) 
			  othewrwise the HIGH side of the sirface will be 
			  shown which encloses the lower valued data.
			  (passed directly to the SHADE_VOLUME routine)


 OUTPUTS:
	KEYWORDS:
		VERTICES= the vertices defining the contour surface 
			(direct from SHADE_VOLUME)
		POLYGONS= the polygons defining the contour surface 
			(direct from SHADE_VOLUME)

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:		draws on the current graphics device
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1992.

(See /host/bluemoon/usr2/idllib/contrib/harris/showvolume.pro)


SHOW_SIZE

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

 PURPOSE:		Prints the currently selected size of the PS page
			Part of the PSETUP Suite of procedures that provide 
			easy and versatile 
			customisation of the plotted page for PostScript 
			(plus other functionality)

 CATEGORY:		plot Utility

 CALLING SEQUENCE:	show_size
 INPUTS:		none

 OUTPUTS:		none

 COMMON BLOCKS:	SCREENSMEM
			
 SIDE EFFECTS:		resets sizes stored in common SCREENSMEM
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990

(See /host/bluemoon/usr2/idllib/contrib/harris/show_size.pro)


SIDES

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

 PURPOSE:		Uses !p.multi to determine whether the current plot is
			positioned at the top, bottom, left or right of the 
			page for the current set of displays.

 CATEGORY:		Plot Utility

 CALLING SEQUENCE:	sides, left=leftedge, right=rightedge, 
			top=topedge, bottom=bottomedge

 INPUTS:		reads the !p.multi system plot variable

 OUTPUTS:
	KEYWORDS:	top, bottom, left, right = variable is set if the 
				position matches the description

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1992.

(See /host/bluemoon/usr2/idllib/contrib/harris/sides.pro)


SIGFIG

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

 PURPOSE:
	This function will return the number of significant figures in 
	the value "range"

 CATEGORY:
	utilities

 CALLING SEQUENCE:
	result = sigfig(range)

 INPUTS:
	range = range for the significance, may be an array.

 OUTPUTS:
	result = the number of significant figures expressed in base 10,
		Example: sigfig(1000) = 3,
			 sigfig(0.01) = -2

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/sigfig.pro)


STDEV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	STDEV
 PURPOSE:
	Compute the standard deviation and optionally the
	mean of any array.
 CATEGORY:
	G1- Simple calculations on statistical data.
 CALLING SEQUENCE:
	Result = STDEV( ARRAY)  ... or:
	Result = STDEV( ARRAY, MEAN)
 INPUTS:
	Array =data array, may be any type except string.

 OUTPUTS:
	function result = standard deviation (sample variance
		because the divisor is N-1) of array.
		
 OPTIONAL OUTPUT PARAMETERS:
	MEAN = mean of data array.
 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	None.
 PROCEDURE:
	Mean = total(array)/n_elements(array)
	stdev = sqrt((total(array^2) - n*mean^2)/(n-1))
 MODIFICATION HISTORY:
	DMS, RSI, Sept. 1983.
	TJH, rewrote to add half max range , Oct. 1991
	TJH, changed the stdev calc to use (sumsq - meansq) as this is more 
		precise (doesnt take sum of differences), Nov, 1992

(See /host/bluemoon/usr2/idllib/contrib/harris/stdev.pro)


STEP_DIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:		STEP_DIST
 PURPOSE:	Form a square array in which each element is an elliptical
		function proportional to its radius from the centre.
		This is then stepped steps times
 CATEGORY:	Signal Processing.
 CALLING SEQUENCE:
	Result = STEP_DIST(N)
 INPUTS:
	N = size of result.
 OUTPUTS:
	Result = (N,N) floating array in which:
	R(i,j) = sqrt((F(i)/major)^2 + (F(j)/minor)^2)   where:
		F(i) = i - (n-1)*0.5

 SIDE EFFECTS:	None.
 RESTRICTIONS: None.
 PROCEDURE:	Straightforward.  Done a row at a time.
 MODIFICATION HISTORY:
		Based on DIST3.pro
		11/8/92 T.J.H.

(See /host/bluemoon/usr2/idllib/contrib/harris/step_dist.pro)


STRESS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       STRESS
 PURPOSE:
       String edit by sub-string. Precede, Follow, Delete, Replace.
 CATEGORY:
 CALLING SEQUENCE:
       new = stress(old,cmd,n,oldss,newss,ned)
 INPUTS:
       old = string to edit.                               in
       cmd = edit command:                                 in
         'P' = precede.
         'F' = follow.
         'D' = delete.
         'R' = replace.
       n = occurrence number to process (0 = all).         in
       oldss = reference substring.                        in
       oldss may have any of the following forms:
         1. s	  a single substring.
         2. s...    start at substring s, end at end of string.
         3. ...e    from start of string to substring e.
         4. s...e   from subs s to subs e.
         5. ...     entire string.
	  6. An array of the the above
       newss = substring to add. Not needed for 'D'        in
	newss may also optionally be an array, then each element
	  is associated with the same element in oldss
 KEYWORD PARAMETERS:
 OUTPUTS:
       ned = number of occurrences actually changed.       out
       new = resulting string after editing.               out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       Written by R. Sterner, 6 Jan, 1985.
       RES --- 23 May, 1988 fixed a bug in SSTYP = 2.
       Converted to SUN 13 Aug, 1989 --- R. Sterner. (FOR loop change).
       Johns Hopkins University Applied Physics Laboratory.

 Copyright (C) 1985, 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.

	--- 8 Dec, 1992 added recursion so that OLDSS and NEWSS may be arrays
		T.J.Harris, University of Adelaide.

(See /host/bluemoon/usr2/idllib/contrib/harris/stress.pro)


TH_CHOICE

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

 PURPOSE:	Allow the user to select (with mouse on a window device) from 
		a number of choices

 CATEGORY:	Utilities

 CALLING SEQUENCE:
	selection = TH_CHOICE ( choice_array, TITLE=title, $
			QUESTION=question, DEF_SELECTION=def_selection, $
			/NOCHOICE, /FINDFL, /INDEX, /NOPOPUP, /LIST)

 INPUTS:

	choice_array 	= input string array of choices

   OPTIONAL KEYWORD PARAMETERS:
	TITLE		= title of the created widget
	QUESTION	= the question to be asked of the user
	DEF_SELECTION	= initial/default selection  
	NOCHOICE	= if set then dont offer the user a choice
	FINDFL		= if set then choice_array is a filter,
			  and FIND_FILE is used to obtain the file choices
	INDEX		= if set then return the index chosen rather than the
			  actual choice string
	NOPOPUP		= if set then dont use the widget popup facility
	LIST   		= if set then use a list widget rather than button menu


 OUTPUTS:

	selection	= the chosen string, or if INDEX is set then the index
			  into the choice_array is output.

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	Ammended to handle VMS filename expansion syntax 
	(in otherwords, limit the filename expansion capabilities !!)
		TJH July 1992 

	Ammended to use widgets if available. Calls TH_WMENU instead of WMENU
		TJH February 1994, IE, HFRD, DSTO

	Ammended to use a list widget if requested.
		TJH January 1995, IE, HFRD, DSTO

(See /host/bluemoon/usr2/idllib/contrib/harris/th_choice.pro)


TH_HISTOGRAM

[Previous Routine] [Next Routine] [List of Routines]
The in-built histogram routine in IDL does not produce consistent binning
given an arbitrary binsize and/or max/min keywords. In other words, if you
randomly choose your binsize and try to predict the number of histogram bins
resulting you'll (or rather, it will!) get it wrong every now and then.
New histogram routine follows.

 B.Vandepeer	24-Feb-1995	Atmos. Physics Group, University of Adelaide


(See /host/bluemoon/usr2/idllib/contrib/harris/th_histogram.pro)


TH_IMAGE_CONT

[Previous Routine] [Next Routine] [List of Routines]
******************** HIGH FREQUENCY RADAR DIVISION, SRL **********************
*************************** Ionospheric Effects ******************************
HELP
1 TH_IMAGE_CONT
	Overlays an image and a contour plot and optionally adds a scale bar.
	Based on the IDL USERLIB routine IMAGE_CONT. This routine supersedes 
	the USERLIB one, having far more functionality, yet capable of EXACTLY
	reproducing the effect of IMAGE_CONT. Scale bar appears on the 
	right-hand-side unless /NOBAR is set. NB: the scale bar is
	automatically created by a recursive call to this routine using the
	same colour and image parameters 

 Format:
	In its simplest form (allowing all parameters to default)

    IDL> TH_IMAGE_CONT, IMAGE

	And in its most complex form, specifying ALL parameter

    IDL> TH_IMAGE_CONT, IMAGE, $
		ASPECT=aspect, $
		BADPTS=badpts,$
		BAR_RANGE=bar_range, $
		BAR_SEPARATION=bar_separation, $
		BAR_TICKLEN=bar_ticklen, $
		BAR_TICKNAME=bar_tickname, $
		BAR_TICKS=bar_ticks, $
		BAR_TICKV=bar_tickv,$
		BARSZ_CHARS=barsz_chars, $
		BOTTOMCOLOUR=bottomcolour,$
		C_COLORS=c_colors,$
		C_LINESTYLE=c_linestyle, $
		C_THICK=c_thick, $
		CONGRID=congrid, $
		CONT=cont, $
		CRANGE=crange, $
		CT=ct, $
		CUBIC=cubic, $
		DEBUG=debug, $
		EXACT=exact, $
		RAISE_PTITLE=raise_ptitle
		IMAGE_WINDOW=image_window, $
		INTERP=interp,$
		LEVELS=levels,$
		MAX_VALUE=max_value, $
		NLEVELS=nlevels, $
		NOBAR=nobar, $
		NOCONT=nocont, $
		NOERASE=noerase,$
		TOPCOLOUR=topcolour,$
		TSIZE=tsize, $
		WINDOW_SCALE=window_scale, $
		XRANGE=xrange, $
		YRANGE=yrange
 
2	IMAGE
		2-dimensional array to display as an image.

2	/ASPECT
		set to retain image's aspect ratio.  Assumes square
		pixels.  If /WINDOW_SCALE is set, the aspect ratio is retained.

2	BADPTS
		indices into IMAGE data which define the bad points.
		These will not be contoured

2	BAR_RANGE	
	 	set the range limits for the colour scale bar
		(same as CRANGE, defaults to autoscaling if
		 BAR_TICKV not set)

2	BAR_SEPARATION	
		the separation, in characters (default = 2), between the scale
		bar and the image. Note that the |y-ticklength| will be added
		to this value if y-ticklength < 0.
		Both the image and the colour bar need to fit 
		into the space allowed for the plot window, otherwise an
		informative message will be printed and unpredictable results
		may occur for the displayed image 

2	BAR_TICKS
		set the number of tick intervals for the labelling
		of the scale bar 
		(defaults to !z.ticks)

2	BAR_TICKV
		the values to label on the scale bar. If this is set
		then the scale bar will have AT LEAST this range
		(defaults to !z.tickv)

2	BAR_TICKNAME
		the labels to use on the scale bar 
		(defaults to !z.range)

2	BAR_TICKLEN
		the length of the ticks on the scale bar  in fractions of tick
		bar window, (defaults to !z.ticklen)

2	BARSZ_CHARS
		the size of the scale bar in characters (default = 2). 
		Both the image and the colour bar need to fit 
		into the space allowed for the plot window, otherwise an
		informative message will be printed and unpredictable results
		may occur for the displayed image. If the value of this
		keyword is <=0 then no bar will be displayed BUT the scaling
		and window size will be calculated as those a colour bar is to
		be used. This is useful when doing multiple plots per page
		where only some scale bars are not required but you want the
		plots to all be the same size. Set BARSZ_CHARS = -#chars to
		allow room for a bar of #chars size but not to put a scale bar
		on the plot. Then set BARSZ_CHARS = +#chars to plot the bar on
		alongside another plot, to end up with images of the same
		size. Useful in collaboration with the SIDES procedure (which
		will set flags for when the plot is on the Left,Right,Top and
		Bottom of the plot window).


2	BOTTOMCOLOUR
		Set this keyword to the colour index of the desired bottom
		colour (range from 0 to TOPCOLOUR-1).
		Note that the default value for this keyword is 1,
		which allows the colour of the image to
		be independent of the background and axes colours
		(!P.background and !P.color). If the user sets this keyword
		then allowance should be made for these colours as they are
		generally swapped for POSTSCRIPT and X-Window devices

2	/CONGRID 	
		if the image has to be resampled then use the USERLIB CONGRID
		routine 

2	/CONT 	
		only do the contouring (no image)

2	CRANGE	
		set the range limits for the colour scale bar
		(same as BAR_RANGE, defaults to autoscaling if
		 BAR_TICKV not set)

2	CT	
		load a color table (uses LOADCT)

2	/CUBIC	
		if the image has to be resampled AND interpolated then use the
		CUBIC interpolation rather than the bi-linear (see INTERP
		Keyword) 

2	/DEBUG	
		write out some inforamtion as it goes


2	/EXACT
		When set this will force the contour routine to fit to the
		exact positions relative to the image.
		When data is displayed as an image each datum is expanded out
		to fill a pixel of finite dimensions. The assignment of where
		the "data value" resides within this space is open to debate,
		but is most appropriately (to this author) assigned to the
		geometric centre of the pixel. Most defaults assign this
		position to be at the bottom left-hand corner of the
		pixel. Contour will fit to the 2-d plane assuming that the
		data value is associated with the bottom left-hand corner. To
		reconcile this with the notion of the value being in the
		middle of the pixel the contour call is made with the x/y
		values and ranges for the image adjusted (effectively by half
		a pixel in the x/y directions). This is the EXACT mapping. By
		default, the mapping will be the default contour one.

2	RAISE_PTITLE
		Raise the plot title by this many character units above the
		plot to allow room to put a label on the top x-axis. Default
		is raise by 1 char. If not called then the default y-position
		is 1 char unit above plot (allowing room for xticks, and
		scaled by !P.charsize)

2	IMAGE_WINDOW
		the position of the image window, can be used to set
		!p.position so you can over-plot the image.
		Only useful when the scale-bar has been used

2	/INTERP 
		set to bi-linear interpolate if image is resampled.
		(see also the CUBIC keyword)

2	/NOBAR 
		dont put a scale bar on the right-hand-side

2	/NOCONT
		only do the imaging (no contours)

2	/NOERASE
		dont erase the previous plot

2	TOPCOLOUR
		Set this keyword to the colour index of the desired bottom
		colour (range from BOTTOMCOLOUR+1 to !D.n_colors-1). Note that
		the default value for this keyword is !D.n_colors-2, which
		allows the colour of the image to be independent of the
		background and axes colours (!P.background and !P.color). If
		the user sets this keyword then allowance should be made for
		these colours as they are generally swapped for POSTSCRIPT and
		X-Window devices 

2	TSIZE	
		size of the plot title (default = 1)
 
2	/WINDOW_SCALE
		set to scale the window size to the image size,
		otherwise the image size is scaled to the window size.
		Ignored when outputting to devices with scalable pixels.

2	XRANGE
		will set the ranges for the x-axes labelling

2	YRANGE
		will set the ranges for the y-axes labelling

2	Contour
		most of the CONTOUR parameters are passed directly

2 Examples
 IDL>   th_image_cont, image

 IDL>	th_image_cont, image, /nocont, /nobar

 IDL>	!p.title = "!17 This is an example of what can be done"
 IDL>	!x.title = "X Title"	& !y.title = "Y Title"	& !z.title = "Z Title"
 IDL>	!x.ticklen = -0.02	& !y.ticklen = -0.02	& !z.ticklen = -0.02
 IDL>	!p.charsize = 1.5
 IDL>	levels = findgen(5)*2
 IDL>	image = findgen(20,20)/40.
 IDL>	th_image_cont, image, crange=[0,10], /follow, level=levels, $
			tsize=1.5*!p.charsize, bar_tickv=levels, c_char=1.5

2 Error_responses
 Returns to the calling procedure on an error

2 Limitations/Assumptions 
	The currently selected display is affected.
	If the device has scalable pixels then the image is written over
	the plot window.
	As with all TV style image displays, the axes range is independent of 
	the image, so it is up to the user the ensure correct labelling of the
	axes.
	NOTE: if the user aborts while this routine is processing then the 
	system variables (in particular !p.position) will have 
	been changed, causing subsequent plots to appear different. Issue the 
	command "resetplt,/all" to reset all the system variables back to the 
	startup state.

2 References 
 	See USERLIB IMAGE_CONT

2 Keywords
	Graphics images contours

2 Build_details
 Project: IEgroup:[IDL.LIBRARY.HARRIS]
 Source:  TH_IMAGE_CONT.PRO
 Help:    GET/HELP/LIBRARY=IEgroup:[IDL.LIBRARY.HARRIS] TH_IMAGE_CONT.PRO

2 Amendments;	
 	May, 1988, DMS		1.00

	May 1991, T.J.H.	2.00
		Numerous mods - (1) to allow passing parameters to CONTOUR
				(2) to put scale bar on side of image
				(3) contour or no contour options
			        (4) made it safe to call with any plot
				   device set
				(5) reverse the colours for postscript output
				(6) plot title and subtitle now set relative 
				   to the tick lengths (to overcome a 
				   short-coming in IDL v2.1.0 when ticklen < 0)
				(7) safe to call with any !p.multi setting
				(8) debug option allows monitoring of progress
		Trevor J Harris

	Apr 1992, T.J.H.	2.09
		added BADPTS so that contour will handle bad points correctly
		by setting image(badpts) = 10*max(image) and max_val = max+1

	Sept 1992, T.J.H.	2.10
		reduced colour range to free up the first and last colour 
		indices. This is to allow the user to change the colours of 
		the axes and background (usually indices 0 and 255) without 
		affecting their image colours (disabled for BW PostScript)

	Oct 1992, T.J.H.	2.11
		Added clause for Colour PostScript so that colour PS is 
		treated the same as any other device except that image values 
		at 0b are replace with max_col so that dark background become 
		light
		Requires use of common PSET which is set by the psetup routines

	Dec 1992, T.J.H.	2.12
		Now Colour PS is treated EXACTLY the same as any other device

	Nov 1993, T.J.H.	2.13
		Updated the common PSET so that conflicts do not occur with
		PSETUP routines

	Dec 1993, T.J.H.	2.14
		Added keywords CRANGE and BAR_RANGE. 
		Made BAR values default to the system !z values (except range)
		Now uses bytscl min/max parameters to restrict or expand the 
		colour range used for the image.
		
	Dec 1993, T.J.H.	2.15
		Amended the positioning of the image window and bar to allow 
		for large numbers along the bar.

	Feb 1994, T.J.H.	2.16 
		Corrected bug introduced by mods v2.14 ("Now uses bytscl  
		min/max parameters to restrict or expand the colour range used 
		for the image.") which incorrectly handled Grey_scale_PS due  
		to the image being inverted (a=-a) but the min and max  
		variables used in bytscl were not !!.

	Apr 1994, T.J.H.	2.17
		Now use the _EXTRA keyword feature to pass any extra parameters
		directly to CONTOUR. Corrected minor bug with colours of
		contours when the BAR_RANGE differed from the value range of
		the image

	Jun 1994, T.J.H.	2.18
		Added ability to choose between CONGRID and POLY_2D for image
		resampling. Incorporated the new CUBIC feature for
		interpolation for POLY_2D and CONGRID. Added the TOPCOLOUR and
		BOTTOMCOLOUR keywords to allow the user to choose specific
		colour ranges for the image. Modified the separation of the
		colour bar from the image, and the height of the image and bar.
		The BAR_RANGE and BAR_TICKV keywords are now checked and
		interpretted regardless of whether the NOBAR keyword is set or
		not (these keywords used to be only checked if a bar was
		requested). The way that Grey_scale Postscript is detected has
		been changed so that colour PS can be created without the use
		of the PSCOLOUR,/COLOUR or PSETUP,/COLOUR calls.
		In order to get PS grey-scale output then one of the following
		has to be done:
			1. Use PSCOLOUR,/GREY before calling TH_IMAGE_CONT,
			regardless of whether PSETUP or Set_plot,'PS' has been
			used 
			2. use LOADCT,0 before calling TH_IMAGE_CONT
			3. Do NOT load a colour table (the default table is
			B/W Linear) but proceed to set the PS device using
			either Set_plot,'PS' or PSETUP, and call TH_IMAGE_CONT

	Aug 1994, T.J.H.	2.19
		Added BAR_SEPARATION keyword

	Aug 1994, T.J.H.	2.20
		Forced to make ammendments to the contour calls to be
		consistent with changes in that routine in going from IDL
		VMS/AXP v3.5 --> v3.6. Specifically, the /DEV and /NOERASE
		calls behaved differently on the second call to
		contour. Replaced by the /OVERPLOT call. 
		Added EXACT keyword and modified the default axes ranges.

	Aug 1994, T.J.H.	2.21
		Further mods to accomodate BUG in v3.6 which causes the plot
		call to IGNORE the (x/y)range values but trim to the data.
		The combination of PLOT and the /OVERPLOT keyword on CONTOUR
		means that the plot call was setting the axes ranges now
		rather than contour as before. Therefore the plot call
		requires a style=1 bitmask

	Oct 1994, T.J.H.	2.22
		Mods to handle 24-bit colour displays. Specifically,
			- Changed the definition of the bardat array by
                         limiting !D.n_colors < !D.table_size
                         (a not too big number).
                       - Limited the top colour variable, topc, to be 
                         < !D.table_size -2 
		Nb: Can detect 24-bit by the !D.flag (true OR pseudo-color)
		but there is no need.
		Removed the -0.5 in the default x/yrange setting.
		Use the EXACT keyword to get this action.

	Nov 1994, T.J.H.	2.23
		Allowed BARSZ_CHARS to be negative or zero. If <-0 then no bar
		is produced although the calc are done for it and space
		allowed. Values of <0 allow space for a bar of size
		|BARSZ_CHARS| but no bar is produced.
		Limited the top colour variable, topc,
		to be < !D.table_size-1 again !! but default value is
		!D.table_size-2 so user can use entire colour table.
		Added keyword RAISE_PTITLE to allow the plot title position to
		be modified. Default is the same value used prior to this MOD
		(=1char unit * !P.charsize)


 IDENT = "2.23" ! The ident number must be incremented by .01
                ! for every revision and reflected in amendments.

(See /host/bluemoon/usr2/idllib/contrib/harris/th_image_cont.pro)


TH_NEAREST

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

 PURPOSE:
	This function will find the nearest multiple or fraction of VALUE
	that is just under or just over LIMIT.
	Particularly useful for REBINning.

 CATEGORY:
	utilities

 CALLING SEQUENCE:
	newvalue = TH_NEAREST(limit,value)

 INPUTS:
	LIMIT = the value that we want the result to be near
	VALUE = the value we want to find the multiple or fraction of

 OUTPUTS:
	NEWVALUE = the nearest multiple or fraction of VALUE to LIMIT

   OPTIONAL PARAMETERS:
	none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
       23-May-1994 T Harris, IE Group, HFRD, DSTO. 
		renamed from NEAREST to TH_NEAREST

(See /host/bluemoon/usr2/idllib/contrib/harris/th_nearest.pro)


TH_SMOOTH

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

 PURPOSE:	Variant on the IDL smooth routine. Does a boxcar average but 
		replicates the end elements in the window to get right size, 
		hence will smooth the entire array, including the end points.

 CATEGORY:	Utility

 CALLING SEQUENCE:	result = th_smooth(input,width)

 INPUTS:		input = is the unsmoothed array
			width = the widht of the boxcar

 OUTPUTS:		result = the smoothed array

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1992.

(See /host/bluemoon/usr2/idllib/contrib/harris/th_smooth.pro)


TH_WMENU[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       TH_WMENU
 PURPOSE:
       Like wmenu but allows non-mouse menus. Uses widgets if available.
 CATEGORY:
 CALLING SEQUENCE:
       i = th_wmenu(list)
 INPUTS:
       list = menu in a string array.        in
 KEYWORD PARAMETERS:
       Keywords:
         TITLE=t  item number or a string to use as title (def = no title).
         INITIAL_SELECTION=s  initial item selected (=default).
         /NOMOUSE   forces no mouse mode.
         /NOWIDGETS forces no widget mode.
	  /LIST      use a list widget rather than button menu.

 OUTPUTS:
       i = selected menu item number.        out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       Based on WMENU2 in JHUAPL which was written by R. Sterner, 22 May 1990
		--- T.J. Harris 	IE HFRD DSTO.  2 Feb 1994
	Now utilises xmenu facility to create a nice number of columns
		--- T.J. Harris 	IE HFRD DSTO. 23 Feb 1994
	Ammended to use a list widget if requested.
		--- T.J. Harris 	IE HFRD DSTO. 12 Jan 1995 

(See /host/bluemoon/usr2/idllib/contrib/harris/th_wmenu.pro)


TH_WMENU[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       TH_WMENU
 PURPOSE:
       Like wmenu but allows non-mouse menus. Uses widgets if available.
 CATEGORY:
 CALLING SEQUENCE:
       i = th_wmenu(list)
 INPUTS:
       list = menu in a string array.        in
 KEYWORD PARAMETERS:
       Keywords:
         TITLE=t  item number or a string to use as title (def = no title).
         INITIAL_SELECTION=s  initial item selected (=default).
         /NOMOUSE   forces no mouse mode.
         /NOWIDGETS forces no widget mode.
 OUTPUTS:
       i = selected menu item number.        out
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       Based on WMENU2 in JHUAPL which was written by R. Sterner, 22 May 1990
		--- T.J. Harris 	IE HFRD DSTO.  2 Feb 1994
	Now utilises xmenu facility to create a nice number of columns
		--- T.J. Harris 	IE HFRD DSTO. 23 Feb 1994

(See /host/bluemoon/usr2/idllib/contrib/harris/th_wmenu_mod.pro)


TH_WSCREENS

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

 PURPOSE:		Widget based routine to open multiple draw widgets
			If the device does not have widgets, then the result 
			is the same as calling SCREENS

 CATEGORY:		Plot Utility

 CALLING SEQUENCE:	base_id = TH_WSCREENS(	number_windows,$
						LUN=lun, $
						TITLE=title,$
						NEXT=next,$
						HORIZONTAL=horizontal,$
						VERTICAL=vertical,$
						PORTRAIT=portrait,$
						LANDSCAPE=landscape,$
						MESSAGE_ID=message_id)

	Example:
			base_id = TH_WSCREENS(2,TITLE="two windows",/PORTRAIT)

 INPUTS:
   OPTIONAL PARAMETERS:
			multi	= number of individual draw widgets (default=1)
	KEYWORDS:
			TITLE 	= Window title if on a windowed device
			PARENT	= the id of a parent widget if any
			NEXT 	= if set then append a number to the file name
				  if a plot device (see PSETUP), otherwise 
				  create a new window on windowed devices or 
				  clear the plot screen if in TEK 
				  This keyword allows multiple files/screens 
				  to be generated without overwriting each  
				  other. The append file number is incremented
				  with each call to TH_WSCREENS,/NEXT
				  For the PS device the number is reset with 
				  the /RESET keyword using PSFILE
			HORIZONTAL = setup display in landscape mode
				(longer side aligned with x-axis)
			LANDSCAPE = setup display in landscape mode
				(longer side aligned with x-axis)
			VERTICAL = setup display in portrait mode
				(longer side aligned with y-axis)
			PORTRAIT = setup display in portrait mode
				(longer side aligned with y-axis)

 OUTPUTS:		
			base_id	= the id of the main base for the draw widgets
	KEYWORDS:
			LUN	= Array of dimension multi containing the unit
				  number of each draw widget
			MESSAGE_ID = the id of a base that can be used for 
				  user messages
			
			New files/windows may be opened or screens erased 

 COMMON BLOCKS:	SCREENSMEM
	
 SIDE EFFECTS:
			New files/windows may be opened or screens erased 
	
 MODIFICATION HISTORY:
	Based on SCREENS, which was..
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	This routine written by,
		TJH March, 1994,	IE, HFRD, DSTO

(See /host/bluemoon/usr2/idllib/contrib/harris/th_wscreens.pro)


TICKLIMIT

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

 PURPOSE:		Ensure that the number of ticks/tickvalues is less 
			than 30, the limit set by IDL. If the number of  
			tickvals is larger than 30 then every second tick is  
			chosen, and the number checked again. The end values  
			are retained though.

 CATEGORY:		Utility

 CALLING SEQUENCE:	newtickvals = ticklimit,tickvals
			newtickvals = ticklimit,tickvals,ticks
			newtickvals = ticklimit,tickvals,/yaxis

 INPUTS:
			tickvals = vector of tick values whose number of 
				elements is to be limited

   OPTIONAL PARAMETERS:
			ticks = if present then use this as the limitting 
				number of ticks
   KEYWORD PARAMETERS:
			XAXIS,YAXIS = if set then use !x.axis/!y.axis as the 
				limitting number of ticks


 OUTPUTS:
   OPTIONAL PARAMETERS:
			ticks = if present then use the actual number of ticks
				needed is written out to this variable
   KEYWORD PARAMETERS:
			XAXIS,YAXIS = if present then use the actual number of 
				ticks needed is written out to !x.axis/!y.axis

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:		may change the !x.axis/!y.axis variables
	
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		August, 1991.

(See /host/bluemoon/usr2/idllib/contrib/harris/ticklimit.pro)


TIMEFMTCONV

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

 PURPOSE:
	this subroutine converts from the time format of YDHMS to DMYHMS 

 CATEGORY:		Utility

 CALLING SEQUENCE:	dmyhms = timefmtconv(ydhms)

 INPUTS:
	ydhms  = array of ( yr, day_of_yr, hour, min, sec )
		 yr is year in modulo 100
		 day_of_yr may extend beyond 365

 OUTPUTS:
	dmyhms  = array of ( day, month, year, hour, min, sec ) 
		year is in modulo 100
		 will return -1 if the input format is invalid

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: T.J.H.  17/11/88, Physics Dept., University of Adelaide
	
	MODIFIED so that if the doy is greater than the number of days
	in the year then the year will be incremented
	T.J.H.  23/10/89 

(See /host/bluemoon/usr2/idllib/contrib/harris/timefmtconv.pro)


TIMESEC

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

 PURPOSE:
	this function gives the time in seconds from 1/1/1965 given the date 
	in the format dmyhms.
	Reverse function of SECTIME 
	Uses the routine TIMSEC once the date format has been converted

 CATEGORY:	Utility

 CALLING SEQUENCE:	numsec = timesec(dmyhms)

 INPUTS:
	dmyhms  = array of ( day, month, year, hour, min, sec ) 
		year is in modulo 100

 OUTPUTS:
	numsec  = array of number of seconds since 01/01/1965  0000 hr
		 will return -1 if the number of seconds is invalid

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: T.J.H  17/11/88, Physics Dept., University of Adelaide,
	

(See /host/bluemoon/usr2/idllib/contrib/harris/timesec.pro)


TIMFMTCONV

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

 PURPOSE:
	this subroutine converts from the time format of DMYHMS to YDHMS  

 CATEGORY:		Utility

 CALLING SEQUENCE:	ydhms = timfmtconv(dmyhms)

 INPUTS:
	dmyhms  = array of ( day, month, year, hour, min, sec ) 
		year is in modulo 100

 OUTPUTS:
	ydhms  = array of ( yr, day_of_yr, hour, min, sec )
		 yr is year in modulo 100
		 day_of_yr may extend beyond 365
		 will return -1 if the input format is invalid

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: T.J.H. 17/11/88, Physics Dept., University of Adelaide,

(See /host/bluemoon/usr2/idllib/contrib/harris/timfmtconv.pro)


TIMSEC

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

 PURPOSE:
	this function returns the elapsed seconds since the start of 1965 
	given date and time in the format ydhms
	Reverse function of SECTIM 
	

 CATEGORY:	Utility

 CALLING SEQUENCE:	numsec = timsec(ydhms)

 INPUTS:
	ydhms  = array of ( yr, day_of_yr, hour, min, sec )
		 yr is year in modulo 100
		 day_of_yr may extend beyond 365

 OUTPUTS:
	numsec  = array of number of seconds since 01/01/1965  0000 hr
		 will return -1 if the number of seconds is invalid

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: T.J.H  17/11/88, Physics Dept., University of Adelaide,

	Mod: T.J.H. 4/8/94, HFRD, DSTO,
          allowed FOR year being > 99 (ie in full format,  eg 1994) 
					

(See /host/bluemoon/usr2/idllib/contrib/harris/timsec.pro)


TOTALREG

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

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

	Based on the USER routine SVDFIT and accepts/outputs all the 
	same parameters. As for SVDFIT, a user-supplied function or a built-in
	polynomial is fit to the data.
 
	NOTE: Does not use SVD to solve the set of linear equations, rather it
	uses matrix multiplication of the normal equations.

	Total regression minimises the distance from each x,y point to the 
	normal to the fitted curve, rather than the y distance. 
	Solution based on "Matrix Computations" by G.H. Golub and C.F. Van Loan

 CATEGORY:
	Curve fitting.

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

 INPUTS:
	X:	"Independent" variable vector.  

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

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

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

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

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

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

		The basis function for polynomials, is R(i,j) = x(i)^j.

	LAMBDA: the coupling factor that defines the relative distribution of 
		error between X and Y.

     MINIMISE:	if set then Lambda will be iterated to minimise the Chi-square,
		If Lambda passed then this will be its starting value,
		otherwise a value of 1 is used.

    DIRECTION: The initial direction for the change in lambda (only used if
		MINIMISE is set)
		
 OUTPUTS:
	TOTALREG returns a vector of M coefficients.

 OPTIONAL OUTPUT PARAMETERS:

	YFIT:	Vector of calculated Y's.

	CHISQ:	Sum of squared errors (normal to the curve) multiplied by 
		weights if weights are specified.

	COVAR:	Var-Covariance matrix of the coefficients.

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

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

     LAMBDA:	The coupling factor that defines the relative distribution of 
		error between A and b.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	

 MODIFICATION HISTORY:
	SVDFIT was adapted from SVDFIT, from the book Numerical Recipes, Press,
	et. al., Page 518.
	minor error corrected April, 1992 (J.Murthy) 
	Total Regression solution based on the relevent sections of the book
	"Matrix Computations" by G.H. Golub and C.F. Van Loan
	December, 1992 T.J.Harris

(See /host/bluemoon/usr2/idllib/contrib/harris/totalreg.pro)


UNIX2VMS

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

 PURPOSE:	This routine converts UNIX syntax filenames to VMS syntax
		under VMS we must place all references to directories inside 
		square brackets and separate with "." rather than simply 
		separating everything with /

 CATEGORY:	Utility

 CALLING SEQUENCE:	vmstxt = unix2vms(unixtxt)

 INPUTS:	unixtxt = string constant

 OUTPUTS:	vmstxt = string constant with any / replaced by [, ] or .

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		Sept, 1992.

(See /host/bluemoon/usr2/idllib/contrib/harris/unix2vms.pro)


WCLEAR

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

 PURPOSE:		This is a generic procedure to close the current 
			window (if it is not part of a widget) 
			or redraw a TEK screen

 CATEGORY:		Utility

 CALLING SEQUENCE:	wclear
			wclear, window_id

 INPUTS:		none

 OUTPUTS:		none

 COMMON BLOCKS:
			none.
 SIDE EFFECTS:
			Current Window (or nominated window) is deleted 
			(if it is not part of a widget)

 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
	Mods, 13-Oct-93 T.J.H. to take into account the window unit numbers 
		allocated to Draw Widgets
	Mods, 1-Nov-93 T.J.H. allowed entry of window_id

(See /host/bluemoon/usr2/idllib/contrib/harris/wclear.pro)


WHITEBG

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

 PURPOSE:		forces the display to have a white background and 
			black foreground lines by defining the the  
			!p.background index to white (255,255,255)  
			and the !p.color index to black (0,0,0). 
		Nb: both the !p.background and !p.color are set by this routine

 CATEGORY:		Display utility

 CALLING SEQUENCE:	whitebg

 INPUTS:	none

 OUTPUTS:	none

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/whitebg.pro)


WMEAN

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

 PURPOSE:	trivial function to produce the weighted mean of a set of data

 CATEGORY:	Mathematical utilities

 CALLING SEQUENCE: 
		result = wmean( data, weights, sd=sd)

 INPUTS:
	

 OUTPUTS:


 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/wmean.pro)


XCORR

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

 PURPOSE:		Perform cross-correlation without using FFT

 CATEGORY:		Time-Series/Spectral analysis

 CALLING SEQUENCE:	xcorr, tdata1, tdata2, normal_factor=nf, maxval=maxval

 INPUTS:		tdata1,tdata2 = (Complex) vectors containing the 
					time series
   KEYWORD PARAMETERS:	
			MAXVAL 	      = values larger than this are 
					considered as bad data and are ignored

 OUTPUTS:
   KEYWORD PARAMETERS:	
			NORMAL_FACTOR = the normalisation factor used. 
					This allows the user to recreate the  
					Covariance function

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/xcorr.pro)


XEXFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	XEXFIT
 PURPOSE:
 	Fit y=f(x) where:
 	F(x) = a0*z*exp(-z^2) + a3 
 		and z=(x-a1)/a2
	a0 = height of exp, a1 = center of exp, a2 = 1/e width,
	a3 = constant term
 	Estimate the parameters a0,a1,a2,a3 and then call curvefit.
 CATEGORY:
	?? - fitting
 CALLING SEQUENCE:
	yfit = xexfit(x,y,a)
 INPUTS:
	x = independent variable, must be a vector.
	y = dependent variable, must have the same number of points
		as x.
 OPTIONAL INPUT PARAMETERS:
	init = a four element vector containing initial estimates of the
		 parameters 'a'.
	weights = weightings for the data points
 OUTPUTS:
	yfit = fitted function.
 OPTIONAL OUTPUT PARAMETERS:
	a = coefficients. a four element vector as described above.
	sigma = the standard deviations of the parameters 'a'

 COMMON BLOCKS:
	None.
 SIDE EFFECTS:
	None.
 RESTRICTIONS:
	The peak or minimum of the gaussian must be the largest
	or respectively the smallest point in the Y vector.
 PROCEDURE:
	If the (max-avg) of Y is larger than (avg-min) then it is assumed
	the line is an emission line, otherwise it is assumed there
	is an absorbtion line.  The estimated center is the max or min
	element.  The height is (max-avg) or (avg-min) respectively.
	The width is foun by searching out from the extrem until
	a point is found < the 1/e value.
 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.

		Reduced the poly fit to be only a constant term, a3
		Added optional input and output parameters.
	T.J.Harris, Dept. of Physics, University of Adeliade,  August 1990.

	MOD,	Changed function to be  x.exp(-x^2)
	T.J.Harris, HFRD, DSTO,  September 1993.

(See /host/bluemoon/usr2/idllib/contrib/harris/xexfit.pro)


XY2PSYM10

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

 PURPOSE:		simulate the !p.psym=10 (histogram type plotting) 
			setting but return the actual data values used to do 
			this. Thus filled histograms can be made using 
			polyfill.
			eg. given x and y, 
				!p.psym = 0
				xy2psym10,x,y
				plot,x,y
				polyfill,x,y,color=150

 CATEGORY:		plot utility

 CALLING SEQUENCE:	xy2psym10,x,y

 INPUTS:	x,y	= the original data to be plotted

 OUTPUTS:	x,y	= output data is nearly 2 X size of the input x,y
			  contains the the vertices defining a histogram style
			  plot

 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.

(See /host/bluemoon/usr2/idllib/contrib/harris/xy2psym10.pro)


XYREBIN

[Previous Routine] [List of Routines]
 NAME:		XYREBIN

 PURPOSE:	To produce a consistent image format, removing extra pixels and
		optionally suppressing outliers for a better image

 CATEGORY:	Images

 CALLING SEQUENCE: 
		newarray = xyrebin( oldarray, sz1, sz2, badpts=badpts,$
				xtickv=xtickv, ytickv=ytickv, $
				ymax=ymax, nogroup=nogroup )

 INPUTS:
	oldarray	=	the array to be rebinned

   OPTIONAL INPUTS:
	sz1, sz2	=	the sizes for rebinned output. 
				Defaults to 250x150 which gives a decent image.
				All sizes are trimmed to be multiples/factors 
				of the array sizes

	badpts		=	indices of bad data points
	
	ymax		=	values above ymax must be bad data

	nogroup		=	DONT trim the extrema points

	xtickv,ytickv	=	input x and y tick values, which are scaled 
				according to the rebinning and output.

 OUTPUTS:
	newarray	=	the rebinned array


 COMMON BLOCKS:
	none.
 SIDE EFFECTS:
	none.
 MODIFICATION HISTORY:
	Written by: Trevor Harris, Physics Dept., University of Adelaide,
		July, 1990.
       23-May-1994 T Harris, IE Group, HFRD, DSTO. 
		Modified to use TH_NEAREST

(See /host/bluemoon/usr2/idllib/contrib/harris/xyrebin.pro)