Varosi code AstroContrib Library

This page is a listing of the entire contents of this library for IDL. This listing is the long version. Viewing the much more compact listing may be handier.

[Go Back to Main IDL Libraries Search Page]


Last modified: Thu Dec 21 21:17:57 2000.

List of Routines


Routine Descriptions

ADD_NEW_MOSAIC

[Next Routine] [List of Routines]
 NAME:
	add_new_mosaic
 PURPOSE:
	Add new averaged/spliced mosaic to the common block of mosaics,
	also creates a default entry in the mosaic_specs structure array.
 CALLING:
	add_new_mosaic, mosaic, mosaic_info, mtitle, MAGF=Magf
 INPUTS:
	mosaic, mosaic_info, mtitle
 KEYWORDS:
	MAGF =
 OUTPUTS:
	All thru common mosaic_array.
 EXTERNAL CALLS:
	function N_struct
	function mosaic_struct
	pro display_mosaic
	pro image_insert
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common display_option2, rotation		;default image rotation.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1992. (code used to be in mosaic.pro)

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/add_new_mosaic.pro)


ALIGN_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
select a group of images and align them at the points of selection.
Frank Varosi NASA/GSFC 1989
F.V. 1991, added wait,0.1 in SELECT Loop to avoid duplicate cursor reads.
F.V. 1991, added define_origin at alignment point.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/align_images.pro)


ALIGN_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	align_mosaics
 PURPOSE:
	select mosaic images and align them at the points of selection.
 CALLING:
	align_mosaics, mosaic_List, imscaled, ZOOM=zoomf
 INPUTS:
	mosaic_List = array of structures containing image locations
			and pointers into the pooled-array "imscaled".
	imscaled = pooled-array of scaled images, pointers to by mosaic_List.
 KEYWORDS:
	ZOOM=zoomf
 RESULTS:
 EXTERNAL CALLS:
	function check_struct
	function select_image
	function get_imscaled
	pro border_images
	pro define_origin
	pro screen_coordin
	pro display_images
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.
	F.V.1991, added wait,0.1 in SELECT Loop to avoid duplicate cursor reads.
	F.V. 1991, option to zoom mosaics during alignment point selections.
	F.V. 1991, added define_origin at alignment point.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/align_mosaics.pro)


ALLOWED_TRANS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Allowed_Trans
 PURPOSE:
	Determine which bound-bound transitions between Levels of different 
	energies are allowed (radiative), according to quantum LS rules.
 CALLING:
	wa = Allowed_Trans( ELevs, ix_from, ix_to )
 INPUTS:
	ELevs = array of structures with tags for level energies,
		quantum numbers, graphics Locations, etc.
	ix_from = integer array, indices of ELevs from which transitions occur.
	ix_to = single integer, index of ELevs to which transition may occur.
 OUTPUTS:
	Function returns indices of which elements in ELevs(ix_from)
	are allowed transitions to ELevs(ix_to). Specifically, if
	variable "wa" is result of function then transitions from
	ELevs(ix_from(wa)) to ELevs(ix_to) are allowed (others are forbidden).
 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
	Return result of big where function call.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/allowed_trans.pro)


ANALYSIS_ADDMOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	analysis_addmos
 PURPOSE:
	Add a mosaic image to the math-mosaic List structure,
	and apply any required rotation and/or geometric scaling.
 CALLING:
	analysis_addmos, imos, imath
 INPUTS:
	imos = integer, mosaic image number.
	imath = integer, image number in math_List.
 INPUT and OUTPUT:
	All other input/output is thru:
		common mosaic_array, mosaics, mosaic_specs, mosaic_infos
		common math_mosaics, math_List, math_images, math_imscaled
 KEYWORDS:
	/RESET causes imath image to be reset to original values of imos image.
 EXTERNAL CALLS:
 	function N_struct
 	function RotMag
 	function scale_mosaic
 	function image_extract
	pro copy_struct_inx
 	pro image_replace
 	pro image_remove
 	pro image_insert
 COMMON BLOCKS:
	common math_mosaics, math_List, math_images, math_imscaled
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990
	F.V. 1993, added rotation & geometric scaling of image data.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analysis_addmos.pro)


ANALYSIS_DUPMOS

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analysis_dupmos.pro)


ANALYSIS_SELECT

[Previous Routine] [Next Routine] [List of Routines]
 Select mosaic images for Math_mosaics & Analysis.
 Frank Varosi NASA/Goddard 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analysis_select.pro)


ANALYSIS_TASK

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

 PURPOSE:
	Process button events which are user requests to display,
	analyze, store/Load, etc..., the image data aquired.
	This is the next event handler routine,
	called by Analyze_Event for additional generic processing.

 CALLING:
	Analysis_Task, event, imspec, imaged, im_hdr, imscaled, imdisp, hfits

 INPUT:
	event = structure variable defining the widget event.
	imspec = structure variable specifying how the image is displayed.
	imaged = the image data array
	im_hdr = structure variable containing header info about image.
	imscaled = the image array scaled into bytes.
	imdisp = the byte image array magnified or reduced for display.
	hfits = the FITS header if an image file is read or written.

 KEYWORDS:
	UVALUE = user value of widget event,
		if not given it is retrieved from event.
	MAGF = desired magnification (or reduction) of image display.

 EXTERNAL CALLS:
	functions get_words, get_window, scale_image, probe_image
	pro box_erase
	pro gscat_box_draw	(to tell get_Scat_Data when it is new display)
	pro X_Var_Edit
	pro analysis_info
	functions get_text_input, check_dir, substwid
	function PickFile
	functions store_image, Load_image
 COMMON BLOCKS:
	common Analysis_Task, def_hdr	;default header for files.
	common adjct_map, color_map
 PROCEDURE:
	Big CASE statement.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.
	F.V. 1993: added default structure template for file headers.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analysis_task.pro)


ANALYZE_CURSOR

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

 PURPOSE:
	Check if cursor is in either the image or subimage window,
	and if so, display the cursor Location and pixel value.
	This routine is called in "timer" mode when the
	cursor-pixel label widget generates a timer event.

 CALLING:
	Analyze_Cursor, analyze_widget

 INPUT:
	analyze_widget = structure variable containing all info
			about the pro Analyze_Image widget.

 EXTERNAL CALLS:
	function get_cursor_win
 COMMON BLOCKS:
	common opticon0, imaged, imhead, imhist
	common opticon1, subimage, subhead, subhist
 PROCEDURE:
	Find out if cursor is in either image or sub-image window, and if so,
	get value of pixel at cursor location and display in label widget.
	In any case, reset the label widget timer (for longer time if
	cursor was not in either window).
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analyze_cursor.pro)


ANALYZE_FLUXSET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	analyze_fluxset
 PURPOSE:
	Set fluxes at 2 points in stack of mosaic images,
	for comparing (mosaic math) different wavelengths,
	or averaging mosaics of same wavelength.
 CALLING:
	analyze_fluxset
 INPUT & OUTPUT:
	all thru common math_mosaics.
 COMMON BLOCKS:
	common math_mosaics, math_List, math_images, math_imscaled
 EXTERNAL CALLS:
	pro match_mos_apply
	pro box_draw2
	pro box_erase2
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V. 1991, use match_mos_apply to factor and offset the mosaic images.
	F.V. 1999, option to use TOTAL or AVERAGE fluxes in SOURCE/SKY box.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analyze_fluxset.pro)


ANALYZE_IMAGE

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

 PURPOSE:
	Create a widget to interactively control/execute the display & analysis
	of images obtained from MAMA or CCD detector integrations.

 CALLING:
	Analyze_Image

 KEYWORD INPUTS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the top level base of the
		new widget created by this procedure. If specified,
		this Analyze_Image widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EFFECTS:
	Initiates the Xmanager if it is not already running.

 EXTERNAL CALLS:
	pro Xmanager
	pro widget_Location
	function CW_Bgroup
	function widget_Tree_Map
 COMMON BLOCKS:
	common Analyze_Image, analyze_widget
 PROCEDURE:
	Create the analyze_widget structure variable.
	Create and register the widgets with the Xmanager.
	Selection events are then processed by pro Analyze_Event.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analyze_image.pro)


ANALYZE_MARKSET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	analyze_markset
 PURPOSE:
	Define marks in overlap of mosaic images.
	For use by the compute equation option of analyze mosaics (mosaic math).
	The defined marks will appear in computed image.
	Marks can also be transferred to/from the separate mosaic images.
 CALLING:
	analyze_markset
 INPUTS:
	All INPUT and OUTPUT is thru common math_mosaics & contour_marks.
 EXTERNAL CALLS:
	pro contour_markset
	pro contour_marks
	pro display_images
	pro pop_mosaics
	function pop_image
	function N_struct
 COMMON BLOCKS:
	common math_mosaics, math_List, math_images, math_imscaled
	common contour_marks, sources, Labels
 PROCEDURE:
	Compute linear mappings from image pixels to normalize coordinates
 HISTORY:
	Written, Frank Varosi NASA/Goddard 1990
	F.V. 1991, added new options: pop, get source Locs, define origin.
	F.V. 1992, added transfer source Locs option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analyze_markset.pro)


ANALYZE_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	analyze_mosaics
 PURPOSE:
	Interactively create a mosaic of arbitrary size images
	(called "mosaic" images, which are created in pro mosaic) and:
	compute algebraic expression involving fluxes in overlayed pixels,
	(after appropriately scaling fluxes in the images),
	or compute average of the mosaic.
	Can also just arrange a collection of images for
	deconvolution of mosaic & PSF image pairs,
	or modeling the IR spectrum at each pixel with heated dust emission
	and line-of-sight absorption.
 CALLING:
	analyze_mosaics, math_result, math_spec, Return_Task
 INPUTS:
	All INPUT and most of OUTPUT is thru

	common math_mosaics:

		math_List = array of structures containing image locations and
			pointers into the arrays: math_images & math_imscaled.
		math_images = array of image data, pointed to by math_List.
		math_imscaled = image data scaled into bytes for display.

	common mosaic_array:

		mosaics = array of image data, pointed to by mosaic_specs.
		mosaic_specs = array of structures containing specs. and
					pointers into the array: mosaics.
		mosaic_infos = array of structures containing info about
				how each mosaic image was formed.

	Elements of math_images are extracted from array mosaics.
 OUTPUTS:
	math_result = 2D array (image) result of computations.
	math_spec = structure defining the math_result.
	Return_Task = string, next task requested by user.
 COMMON BLOCKS:
	common math_mosaics, math_List, math_images, math_imscaled
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common analyze_mosaics, math_window,result_window,contour_window,border
	common analyze_mosaic2, mathmos_colors
	common dir_names, dirinv, dirmos_raw, dirmos_aver
	common dir_name2, dirmos_math
 EXTERNAL CALLS:
	functions:	calc_im_stack	DeConv_images	average_mosaics
	pros:	restore_MathMos	restore_mosaic	display_images	centroid_images
		align_mosaics	contour_mosaic	scale_mosaics	pop_mosaics
		mosaic_correls	mosaic_coordin	mosaic_task	get_window...
 PROCEDURE:
	Menu with loop around big CASE statement,
	and pro mosaic_task gets leftovers.
 HISTORY:
	Written, Frank Varosi NASA/Goddard 1990  (started as: ratio_mosaics).
	F.V.1991, generalized into mosaic Math & Analysis.
	F.V.1991, added option: Match_Levels.
	F.V.1992, added options: align by centroids, De-Convolve mosaics.
	F.V.1994, call mosaic_correls for more cross-correlation options.
	F.V.1998, option to display images in wavelength/maximum order.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/analyze_mosaics.pro)


APPLY_FACTORS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	apply_factors
 PURPOSE:
	Match image names and apply factors & offsets
			of old_images to new_images.
 CALLING EXAMPLE:
	apply_factors, old_images, new_images, /REDISPLAY
 INPUTS:
 KEYWORDS:
 OUTPUTS:
 EXTERNAL CALLS:
 COMMON BLOCKS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/apply_factors.pro)


APPROX_XSECS

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

 PURPOSE:
	Create a widget to approximate a cross-section by interactively
	selecting points for piece-wise Linear interpolation.
	Events are handled by pro Approx_Xsecs_Ev.
	State of widget is stored in user value so multiple instances
	can be running simultaneously.
	Called by Build_BFree_Tr which is called by Modion_Event (pro modion).
 CALLING:
	Approx_Xsecs

 INPUT:
	ELevs = array of structures with tags for energy of level,
		quantum numbers, and handles pointing to
		full and approximate photo-ionization cross-sections.	
		This array is stored via handle of the widget base state.
 OUTPUT:
	ELevs = returned with updated x-secs if /MODAL when widget is DONE,
		otherwise, if not /MODAL then widget is never destroyed
		and the user must retrieve it from the state structure
		in the user-value of the base widget.
 KEYWORDS:
	/MODAL : causes Xmanager to wait until this widget is destroyed,
		so that events from all other widgets are suspended.

	GROUP = optional, the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	XPOS, YPOS = optional, desired position on screen of the widget.

	PLOT_SIZE = [xsize,ysize] of draw widget for plotting of X-secs.,
		default = [640,640].

 EXTERNAL CALLS:
	pros:	Xmanager, widget_Location
	funcs:	CW_Bgroup, CW_pdmenu, widget_Tree_Map
 PROCEDURE:
	Create the state structure variable.
	Create and register the widgets with the Xmanager.
	Events are then processed by pro Approx_Xsecs_Ev (above in same file).
 HISTORY:
	written: Frank Varosi HSTX @ NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/approx_xsecs.pro)


APPROX_XSEC_CUR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Approx_Xsec_Cur
 PURPOSE:
	Process cursor events of draw widget in Approx_Xsecs widget.
	Left button = insert a point into approximate cross-section,
	right button = delete nearest point.
	Called by pro Approx_Xsecs_Ev (in file approx_xsecs.pro).
 CALLING:
	Approx_Xsec_Cur, event, state
 INPUTS:
	event = structure variable defining the widget event.
	state = structure variable, state of the widget.
 OUTPUTS:
	state = new state of the widget.
 EXTERNAL CALLS:
	function Level_info
 PROCEDURE:
	Check the draw event.type in case statement:
		0 = insert/delete a point (when a button is pressed),
			Left button = insert,
			Middle button = delete nearest point.
		1 = freeze the List widget (when a button is released).
		2 = display cursor coordinates (motion events).
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/approx_xsec_cur.pro)


APXSEC_HARDCOPY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ApXsec_Hardcopy
 PURPOSE:
	Create hardcopy of the graph of currently selected cross-section
	with approximation points overplotted.
 CALLING:
	ApXsec_Hardcopy, HC_request
 INPUTS:
	HC_request = string array (optional).
 OUTPUTS:
	Writes graphics to a file.
 COMMON BLOCKS:
	common Modion_Widget, modion_widget
	also see: modion_common.pro
 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/apxsec_hardcopy.pro)


AVERAGE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	average_images
 PURPOSE:
	Average the images in raw_mosaic and return the averaged_mosaic image.
 CALLING:
	mosaic = average_images( raw_mosaic )
 INPUTS:
	raw_mosaic = structured array of images with relative Location info.
 KEYWORDS:
      /BACK_SET : for pixels with no data, set the value < minimum of data,
		This allows them to be distinguished from all other data pixels.
			Default is to leave them = 0.
      /FRAC_PIX : if relative offsets between images are in fractional pixels,
			use this info in creating final average mosaic.
			Default is to round off to nearest pixel offset.
	BORDER = width of border of each image to ignore (exclude from average),
			default = 0.
	GROUP = average only image in specified group number (default is all).
	WHICH_IMAGES = the indices of images in raw_mosaic to average (def=all).
	WEIGHT_IMAGES = weighting to use for each image when averaging,
			default = 1 for all image.
 OUTPUTS:
	total_weight = an image of the sum of weight in each pixel of
			the final averaged mosaic. Thus if weights = 1,
			each element of total_weight is the count of
			how many images overlapped at that pixel.
	imxmin, imymin = the location of bottom left corner of final image,
			in relative offset coordinate.
 RESULT:
	Function returns image with each pixel = average of overlapping pixels,
	and this image is converted to the same type as the raw images.
 EXTERNAL CALLS:
	function frac_pix_shift
	function round_off
	function conv_vartype
 PROCEDURE:
	Loop thru images in raw_mosaic and add into big mosaic array,
	also accumulating the total_weight array, then divide by it.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V.1989, added keywords for BORDER = pixel border to ignore,
				GROUP=group # to average,
				/BACK_SET to set background empty pixels.
	F.V.1991, optimized and added conv_vartype at end.
	F.V.1991, added keyword WHICH_IMS= subscripts of images.
	F.V.1992, option /FRAC_PIX to use fractional pixel offsets
				in averaging (func frac_pix_shift()).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/average_images.pro)


AVERAGE_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	average_mosaics
 PURPOSE:
	Average a raw-mosaic of mosaics into one big mosaic image.
 CALLING:
	average_mosaics, mosaic_List, mosaic_images
 INPUTS:
	mosaic_List = array of structures containing images and information.
	mosaic_images = pooled-array containing the image data,
			mosaic_List has pointers into this array.
 KEYWORDS:
	BORDER=
	/BACK_SET
	GROUP=
	WHICH_IMS=
	WEIGHTS=
 OUTPUTS:
	Function returns the averaged mosaic image.
 EXTERNAL CALLS:
	function round_off
	function image_extract
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.
	F.V. 1991, optimized and added conv_vartype at end.
	F.V. 1992, added keyword WHICH_IMS= subscripts of images.
	F.V. 1993, exclude pixels having no data using the "weight" array.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/average_mosaics.pro)


BORDER_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	border_images
 PURPOSE:
	Display border of selected images in respective window.
	Interactive mode:
		Left button to select images, middle/right button to quit.
	Automatic mode:
		image #'s specified by INUMS or /ALL are bordered.
 CALLING:
	border_images, image_List, color
 INPUTS:
	image_List = array of structures containing images and Locations.
	color = color table index for drawing borders, def = !D.table_size-1
 KEYWORDS:
	INUMS =
	COLOR =
	/ALL_IMAGES
	/SHOW_NUMBERS
	OFFSET_XY =
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	function select_image
	pro border_image
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1991, added keyword /SHOW_NUMBERS to print image #s within borders.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/border_images.pro)


BORDER_NOISE

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

 PURPOSE:
	Determine standard deviation and mean of border pixels in CCD image.

 CALLING:
	border_noise, image, bxu, byu, bsigma, bmean

 INPUTS:
	image = 2-D matrix.
	bxu = Left & Right column #'s for statistics: [[xL1,xR1],[xL2,xR2]].
	byu = Bottom & Top row #'s for statistics: [[yB1,yT1],[yB2,yT2]].

	Note: bxy & byu are defined by pro get_CCD_status.

 OUTPUTS:
	bsigma = standard devation of border pixel values.
	bmean = mean of border pixel values.

 EXTERNAL CALLS:
	function stdev
 HISTORY:
	Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/border_noise.pro)


BUILD_BB_TRANS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Build_BB_Trans
 PURPOSE:
	Build the array of bound-bound transitions between selected Levels,
	between selected single energy Levels and SuperLevels,
	and between all SuperLevel combinations.
 CALLING:
	Build_BB_Trans

 INPUTS:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc.

	Rad_Trans = array of structures, radiative transitions, with tags for
		levels, oscillator strength (gf), quantum numbers, etc.

	SupLevs = array of SuperLevel structures with tags for
		average energy, effective temperature, etc.

 OUTPUT (common block):

	BB_Trans = array of structures, the calculated bound-bound transitions,
		with tags for "gf" values, wavelengths, quantum numbers, etc.
		(see code below for complete structure).
 COMMON BLOCKS:
	common Build_BB_Trans, bbTran	(structure template)
	common Build_BB_Tran1, Line_Styles, Line_Thicks   (options)
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function Allowed_Trans
	function N_struct
	function Fsort
	function fosc_approx
	pro match
 PROCEDURE:
	Loop over the selected Levels and find out which combinations
	are allowed, then get the gf values for those allowed transitions.
	For the case of SuperLevels (energy Levels in groups) process all
	transitions between the energy Levels to get the needed "gf" values
	and then add up "gf" for each SuperLevel group, creating a new set
	of transitions involving SuperLevels, keeping only those single
	energy Levels transitions that are not any SuperLevel group.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.
	F.V. 1995, vectorized using function Allowed_Trans.
	F.V. 1995, added computation of SuperLevel transitions.
	F.V. 1995, further vectorized using pro match.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/build_bb_trans.pro)


BUILD_BFREE_TR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Build_BFree_Tr
 PURPOSE:
	Build bound-free transitions from selected energy Levels to the
	ionization continuum by creating an approximate/simplified
	photo-ionization cross-section for each selected Level.
	Accomplished interactively with the widget: Approx_Xsecs.
 CALLING:
	Build_BFree_Tr, ELevs, BFree_Trans

 INPUT & OUTPUT:	All thru common blocks:

	ELevs = array of structures with tags for energy of level,
		quantum numbers, and handles pointing to
		full and approximate photo-ionization cross-sections.
		Updated with new approximate photo-ionization cross-sections,
		(full cross-sections are unchanged).

 COMMON BLOCKS:
	see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function Approx_Xsecs	(~/modion/code/widgets/approx_xsecs.pro)
	pro Modion_Status
 PROCEDURE:
	Just call Approx_Xsecs widget and then check the "disp" tag for changes.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/build_bfree_tr.pro)


BUILD_BFSUP_TR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Build_BFsup_Tr
 PURPOSE:
	Build bound-free transitions for SuperLevels by first merging
	the photo-ionization cross-sections for Levels in each group
	(if not already done). Then an approximate/simplified
	photo-ionization cross-section is created/modified for each SuperLevel,
	interactively with the widget: Approx_Xsecs.
 CALLING:
	Build_BFsup_Tr

 INPUT & OUTPUT:	All thru common blocks:

	ELevs = array of structures with tags for energy of level,
		quantum numbers, and handles pointing to
		full and approximate photo-ionization cross-sections.

	SupLevs = array of structures with tags for average energy,
		quantum numbers, and handles pointing to
		full and approximate photo-ionization cross-sections.
		Updated with new approximate photo-ionization cross-sections,
		(full cross-sections are merged from ELevs).

 COMMON BLOCKS:
	see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	pro Merge_Xsecs
	pro Modion_Status
	pro Handles_Free
	function N_struct
	function Approx_Xsecs	(~/modion/code/widgets/approx_xsecs.pro)
 PROCEDURE:
	Just call Approx_Xsecs widget and then check the "disp" tag for changes.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/build_bfsup_tr.pro)


CALC_EFFICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Calc_Effics
 PURPOSE:
	Compute efficiency of a grating using List of flux measurements.
 CALLING:
	Calc_Effics, eff_meas, effics
 INPUTS:
	eff_meas = array of structures, efficiency measurements
		collected by pro get_Eff_Data.
 KEYWORDS:
	REF_MIRROR = array of structures with mirror reflectivity,
			from function Read_Reflect (default = unity).
	REF_GRATING = array of structures with grating reflectivity,
			from function Read_Reflect (default = unity).
 OUTPUTS:
	effics = array of structures containing absolute & groove efficiency
		of grating and all measurements/errors used in computation.
 EXTERNAL CALLS:
	function unique
	function def_imhd_struct
	pro copy_struct_inx
	function spline
	function stdev
 COMMON BLOCKS:
	common Calc_Effics, efft	;structure template.
 PROCEDURE:
	Match wavelengths, average, interpolate reflectances, compute effic.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/calc_effics.pro)


CALC_IM_STACK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	calc_im_stack
 PURPOSE:
	Compute an algebraic expression (entered by user)
	involving the intersection regions of a stack of mosaic images.
 CALLING:
	image_result = calc_im_stack( image_List, calc, names, imsel )
 INPUT:
	image_List = array of structures containing image location info,
		and either the image data or pointers to image data.
 KEYWORDS:
	DATA = pooled-array containing image data (e.g. image_data).
 OUTPUT:
	Function returns the result of algebraic expression of images.
 OPTIONAL OUTPUTS:
	calc = string, the algebraic expression that was computed.
	names = string array, the names of images used in computation.
	imsel = integer array, indices of images used in computation.
 EXTERNAL CALLS:
	pro overlap_images
	pro write_images
	pro printw
	pro box_erase
	function box_create
	function Trp3D
	function intersection
	function N_struct
	function round_off
	function conv_ascii_time
	function next_word
	function get_image
	function frac_pix_extrac
 PROCEDURE:
	Parse the text typed in by user, substitute arrays for capital letters,
	extract the images, then execute the statement in current environment.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V.1991, compute arbitrary algebraic expression, as entered by user.
	F.V.1992, use new function frac_pix_extrac( image ).
	F.V.1993, added MINIMAL, SPECIFIC, and VARIABLE intersection options.
	F.V.1994, modified to reject data less than thresholds specified by >.
	F.V.1994, added keyword options which bypass menus.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/calc_im_stack.pro)


CANCEL_XSEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Cancel_Xsec
 PURPOSE:
	Cancel the new approximate cross-section in the widget state structure.
	Stop events from the draw widget (x-sec plot) and
	start accepting events from the energy level list widget.
	Called by pro Approx_Xsecs_Ev (in file approx_xsecs.pro).
 CALLING:
	Cancel_Xsec, state
 INPUTS:
	state = structure variable, state of the widget.
 OUTPUTS:
	state = new state of the widget.
 EXTERNAL CALLS:
	function Level_info
 PROCEDURE:
	Free the handles, replot the original x-secs, enable List selection.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/cancel_xsec.pro)


CENTROID_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	centroid_images
 PURPOSE:
	Select images containing the same star (maximum bright source),
	and automatically find the centroids of the maxima in selected images
	Align the images at centroids, if requested.
	Returns structure array containing centroid information.
 CALLING:
	centroid_images, image_List, image_data, image_scaled
 INPUTS:
	image_List = array of structures containing image locations,
		and the image data and scaled byte arrays for display.
		Optionally, may instead have pointers into the arrays
		"images" and "imscaled".

	image_data = optional pool-array of image data,
				pointed to by image_List.
	image_scaled = optional pool-array of scaled images,
				pointed to by image_List.
 OUTPUTS:
	image_List = array of structures containing new image locations.
 EXTERNAL CALLS:
	pro centroid    (which first finds the maximum pixel).
	function FullWid_HalfMax
				and more...
 COMMON BLOCKS:
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.
	F.V.1992, round off centroid coordinates to nearest hundreth of a pixel.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/centroid_images.pro)


CHECK_IMSCALED

[Previous Routine] [Next Routine] [List of Routines]
check the scaled image if just central subset of image is to be displayed,
	(so unsmoothed borders are not displayed when image is smoothed).
Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/check_imscaled.pro)


CHECK_MAG_FACT

[Previous Routine] [Next Routine] [List of Routines]
code written by Frank Varosi NASA/GSFC 1989.
F.V.1990, mod to handle case when image data is not in structure, just sizes.
F.V.1991, mod to handle magnification < 1.
F.V.1991, keyword /ALL_MAGS for when image data is not in structure.
F.V.1992, keywords TAG_* to get flags about image data structure.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/check_mag_fact.pro)


CHECK_MENU_SIZE

[Previous Routine] [Next Routine] [List of Routines]
This is only needed for SunView on the Sun386i (when using Large wmenu font).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/check_menu_size.pro)


CHECK_STRUCT

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/check_struct.pro)


CHECK_SUBIMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Check_Subimage
 PURPOSE:
	Check for existence, save-status, or display of subimage.
	If needed, force appropriate event to occur.
	Called by Analyze_Event if EFFICIENCY/SCATTER measurement was selected.
 CALLING:
	status = Check_Subimage( uval )
 INPUT:
	uval = string, the task to be performed on subimage.
 OUTPUT:
	Function returns subimage status: 1 = OK to proceed, 0 = do not proceed.
 EXTERNAL CALLS:
	pro Force_Events
 HISTORY:
	written: Frank Varosi HSTX/NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/check_subimage.pro)


COMMIT_XSEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Commit_Xsec
 PURPOSE:
	Copy the new approximate cross-section into the energy levels array.
	Interpolate/extrapolate the cross-section at the edge frequency.
	Stop events from the draw widget (x-sec plot) and
	start accepting events from the energy level list widget.
	Called by pro Approx_Xsecs_Ev.
 CALLING:
	Commit_Xsec, state
 INPUTS:
	state = structure variable, state of the widget.
 OUTPUTS:
	state = new state of the widget.
 EXTERNAL CALLS:
	function Level_info
	function scalar
 PROCEDURE:
	If approx. x-secs were modified then just move the handles,
	otherwise just free the handles.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/commit_xsec.pro)


CONTOUR_AXES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_axes
 PURPOSE:
	Draw the axes for pro contour_mosaic
 CALLING:
	contour_axes, image_spec, xtit, xtickv, xtickLab, xticm, $
				  ytit, ytickv, ytickLab, yticm
 INPUTS:
	image_spec = structure containing coordinate specifications.
	xtit, ytit = title strings.
	xtickv, ytickv = float arrays.
	xtickLab, ytickLab = string arrays of tick Labels.
	xticm, yticm = # of minor tick marks.
 KEYWORDS:
	TICKLEN = optional, size of tick marks
		(default is the IDL default, negative means outward)
 PROCEDURE:
	Call axis and xyouts, depending on coord.-spec. case.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V. 1991, adjusted postion of absolute R.A. and DEC. labels.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_axes.pro)


CONTOUR_CALIB

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
	Set fluxes at 2 points in mosaic image,
	then setting factor and offset fields in mosaic_spec structure.
 CALLING:
	contour_calib, mosaic_spec
 INPUT & OUTPUT:
	mosaic_spec = structure with contour display specifications.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_calib.pro)


CONTOUR_COORDIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_coordin
 PURPOSE:
	Setup up coordinate axes for contour/display of mosaic image.
	Called by pro contour_mosaic.
 CALLING EXAMPLE:
	contour_coordin, mosaic_spec, xcoor, xtit, xtickv, xticm, xtickLab, $
				      ycoor, ytit, ytickv, yticm, ytickLab
 INPUT:
	mosaic_spec = structure containing all needed info.
 KEYWORDS:
	/PLATE_SCALE_SET : to change the arcsec/pixel stored in mosaic_spec.
	/CHANGE_ABSOLUTE : to change the absolute RA-DEC of origin.
 OUTPUTS:
	[x,y]coor = coordinates used in call to plot/contour.
	[x,y]tit = axis titles.
	[x,y]tickv = values for tick marks.
	[x,y]ticm = # of minor tick marks between major ticks.
	[x,y]tickLab = labels for ticks (for RA and DEC option only).
 COMMON BLOCKS:
	common contour_coordin, nticrel, nticabs
	nticrel = approx. # of tick marks to use for relative coordinates.
	nticabs = approx. # of tick marks to use for absol. RA & DEC coord.
 PROCEDURE:
 HISTORY:
	written, Frank Varosi STX @ NASA/GSFC 1990.
	mod, F.V. 1991, use mosaic_spec structure.
	mod, F.V. 1991, define origin and zoom info self consistently.
	mod, F.V. 1991, added common block contour_coordin with defaults.
	mod, F.V. 1996, added options for relative arcmins & degrees.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_coordin.pro)


CONTOUR_DRAW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_draw
 PURPOSE:
	Draw the contours of image as requested in structure image_spec.
	(this is called by pro contour_mosaic)
 CALLING:
	contour_draw, image, xcoor, ycoor, image_spec
 INPUTS:
	image = 2-D array of data
	xcoor, ycoor = x & y coordinate vectors from contour_mosaic.
	image_spec = structure with contour display specifications.
 KEYWORDS:
	HARDCOPY = optional structure variable giving hardcopy specifications.
 RESULTS:
	Contours of image are drawn.
 COMMON BLOCKS:
	common adjct_map, color_map
	common HC_color, grey_map, color_trans
 EXTERNAL CALLS:
	function Min_Curv_Surf		(to get smoother contours)
 PROCEDURE:
	Call "contour" with appropriate parameters, or if Spline is requested,
	first call Min_Curv_Surf to get higher resolution image,
	and then call contour draw recursively, to get smoother contours.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1990-92.
	F.V.1991, added contour Line thickness and spline options.
	F.V.1992, added contours on/off option.
	F.V.1994, generalized contour specs for Lin/Log.
	F.V.1997, use Min_Curv_Surf to get smoother contours when "Spline" set.
	F.V.1998, verify that levels are unique.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_draw.pro)


CONTOUR_INIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_init
 PURPOSE:
	Setup constants and menu for pro contour_mosaic.
 CALLING:
	menu = contour_init( callers, mosaic_spec )
 INPUTS:
	callers = strarr
	mosaic_spec = structure
 OUTPUTS:
	Function returns string array of menu options.
	All other output thru common blocks.
 COMMON BLOCKS:
	common contour_init, site_name
	common contour_mosaic, Nhc, ArcSec_inch, set_scale
	common contour_options, TickLen, bitspix
	common cursor_scale, cmin_y, cmax_y
	common adjct_map, color_map
	common HC_color, grey_map, color_trans
	common PS_Layout, xoff, yoff, xpap, ypap, Left, Right, Top, Bottom
 EXTERNAL CALLS:
	function the_date
	function reverse
	pro check_menu_size	(for Sun386i/SunView only)
 PROCEDURE:
	Straightforward.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V.1991, now uses mosaic_spec structure (remembers all settings).
	F.V.1996, incr. yoff & decr. Bottom by 0.2 to fit new Tek color printer.
	F.V.1999, added lager paper size options for a newer Tek color printer.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_init.pro)


CONTOUR_LEVELS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_Levels
 PURPOSE:
	Define contour Levels by
	calling function cursor_scale to get user input.
 CALLING:
	contour_Levels, mosaic_spec
 INPUT and OUTPUT:
	mosaic_spec =
 EXTERNAL CALLS:
	function cursor_scale
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1992.
	F.V.1994, generalized contour specs for Lin/Log.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_levels.pro)


CONTOUR_MARKS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_marks
 PURPOSE:
	Draw the Marks (of sources) and Labels on contour-display of mosaic,
	as set interactively by pro contour_markset.
 CALLING EXAMPLE:
	contour_marks, posxy, identify, id2, IMAGE_SPEC=mosaic_spec
 INPUTS:
	posxy
	identify
	id2 =
 KEYWORDS:
	IMAGE_SPEC =
	ROTATE=
	SHOW_SOURCES=
	SHOW_LABELS=
	HC_MODE=
 RESULTS:
	Source marks and Labels are draw on window display or hardcopy file.
 EXTERNAL CALLS:
	function draw_marks
	pro rotate_coordin
 COMMON BLOCKS:
	common contour_marks, sources, Labels
	common HC_color, grey_map, color_trans
 PROCEDURE:
	Setup coordinates, display image, draw axes, draw contours, ....
 MODIFICATION HISTORY:
	written, Frank Varosi NASA/GSFC 1990.
	F.V. 1991, merged code for PostScript & windows into function draw_mark.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_marks.pro)


CONTOUR_MARKSET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_markset
 PURPOSE:
	Interactively set Marks (of sources) and Labels,
	which will appear on contour-display of image by pro contour_marks.
 CALLING:
	contour_markset, what, posxy, ident1, ident2, IMAGE_SPEC=mosaic_spec
 INPUTS:
	what = string, "SOURCES" or "LABELS"
	posxy = normalized position of contour plot of image in window,
		(2 x 2 matrix).
	ident1 = string, identification of image ( default = image_spec.name ).
	ident2 = string, optional secondary I.D. (default=image_spec.directory).
 KEYWORDS:
	IMAGE_SPEC = structure with display specifications for:
			rotation, coordinate system, window number.
	ROTATE = rotation index (0-7).
	COORDSYS = string array, type of coordinate system.
	WINDOW = window number containing image.
	RELX, RELY = 2 element arrays contain [min,max] of (x,y) coordinates.
	RA_ORIGIN = R.A. of origin when coord.sys. is absolute.
	CALLER = string, name of calling routine.
	/INITIALIZE
	STATUS = integer, output, to indicate user selected return option.
 OUTPUTS:
	None, except for STATUS keyword output.
 RESULTS:
	Source marks and Labels are drawn/deleted/modified on window display,
	and the information is stored in common contour_marks.
 COMMON BLOCKS:
	common contour_marks, sources, Labels	;these are actually drawn.
	common contour_mark1, source_T, Label_T	;these are default templates.
	common contour_mark2, source_Ts		;template for each symbol.
 EXTERNAL CALLS:
	pros:	cursor_coordin	rotate_coordin	contour_mark_op
	funcs:	N_struct	get_words	draw_mark
 PROCEDURE:
	Setup coordinates, display image, draw axes, draw contours, ....
 HISTORY:
	written: Frank Varosi NASA/GSFC 1990.
	F.V. 1991, added display of coordinates as cursor is moved.
	F.V. 1991, created Templates in common block for storing current specs,
		added keyword INIT to just create structures and templates,
		added keyword STATUS to control return and redraw when =2,
		added keyword IMAGE_SPEC to pass image_spec and use it.
	F.V. 1992, code to display/get cursor coordinates -> pro cursor_coordin,
		added option to move/change marks/Labels (pro contour_mark_op).
	F.V. 1996, option to enter coordinates of marks in arcsecond offsets.
	F.V. 1998, use ident2 (.id2) for directory of mosaic file.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_markset.pro)


CONTOUR_MARK_OP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_mark_op
 PURPOSE:
	Perform sets and changes of source marks and Labels,
	for pro contour_markset.
 CALLING:
	contour_mark_op, mark_Lab, attributes
 INPUTS:
	mark_Lab = structure, the mark(s) or Label(s).
	attributes = string, specifying what to modify.
 INPUTS:
	mark_Lab = structure, the modified mark(s) or Label(s).
 EXTERNAL CALLS:
	function N_struct
	function next_word
 HISTORY:
	written: Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_mark_op.pro)


CONTOUR_MIN_MAX

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_min_max.pro)


CONTOUR_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_mosaic
 PURPOSE:
	Display a mosaic-image with selectable/optional contours,
	coordinate axes (relative or absolute), titles, Labels, and marks.
	Options include: filtering, scaling, zooming, choosing Levels...
	Hardcopy in grey scale or pseudo-color (using PostScript).
 CALLING:
	contour_mosaic, mosaic, mosaic_spec, mosaic_info, Return_Task
 INPUTS:
	mosaic = 2-D array (an image).
	mosaic_spec = structure with contour display specifications.
	mosaic_info = array of structures with info on raw mosaic.
 KEYWORDS:
	IMAGE_OVERLAY = second mosaic-image to superimpose as contours.
	SPECS_OVERLAY = display specifications of second mosaic-image.
	CALLERS = string array, names of calling routines for return options.
	/NO_MENU causes immeadiate return after graphics, skipping menu options.
	/HARDCOPY causes jump to hardcopy menu options, write to file, return.
 OUTPUTS:
	mosaic_spec = structure with new contour display specifications.
	Return_Task = string, indicating user selected type of return.
 EXTERNAL CALLS:
	funcs:	contour_init	get_words	zoom_mosaic
	pros:	color_st_Load	contour_setup	contour_coordin
		contour_axes	contour_titles	contour_draw	contour_calib
		Look_mosaic	get_window	save_mosaic	set_Hard_Copy
		contour_marks	contour_markset
						and many more...
 COMMON BLOCKS:
		many
 PROCEDURE:
	Setup coordinates, display image, draw axes, draw contours, ....
 HISTORY:
	written: Frank Varosi NASA/GSFC 1989.
	F.V.1990, added source marks and Labels option.
	F.V.1991, use mosaic_spec structure (remembers all specifications).
	F.V.1991, added Truncate (min/max scaling) option.
	F.V.1991, added interactive Zoom option (pro zoom_mosaic).
	F.V.1991, mod to plot axes first and call contour seperately.
	F.V.1992, option to overlay contours of a second image.
	F.V.1994, added /NO_MENU and /HARDCOPY keyword options.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_mosaic.pro)


CONTOUR_OPTIONS

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi NASA/GSFC 1990.
F.V.1992, separated contour specific options from pro display_options.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_options.pro)


CONTOUR_SCALING

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_scaling.pro)


CONTOUR_SETUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_setup
 PURPOSE:
	Setup mosaic image arrays for contour display.
 CALLING:
	contour_setup, mosaic_orig, mosaic_spec, mosaic, mos_ps
 INPUTS:
	mosaic_orig = original mosaic data image array (floating point).
	mosaic_spec = structure containing specs. such as coordinate origin,
		rotation angle, smoothing, zoom on subregion, truncation, etc.
 KEYWORDS:
	/COLOR_SCALE : causes display of color bar with scale in own window.
 OUTPUTS:
	mosaic = image array (floating) result of mosaic_spec operations.
	mos_ps = same image array scaled to bytes for display in window or PS.
 EXTERNAL CALLS:
	function N_struct
	function RotMag
	function zoom_mosaic
	function filter_mosaic
	pro color_scale
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1992.
	F.V. 1994, added rotation by any angle (RotMag).
	F.V. 1997, added calibration by factor and offset.
	F.V. 1998, made rotation pivot around selected origin of coordinates.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_setup.pro)


CONTOUR_TITLES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	contour_titles
 PURPOSE:
	Draw the Titles and subtitles for pro contour_mosaic
 CALLING:
	contour_titles, image_spec, posxy
 INPUTS:
	image_spec = structure containing all text for titles and subtitles.
	posxy = position of contour plot in normalized window (IDL protocol)
 KEYWORDS:
	HC_FILE = string, file name when doing hardcopy output.
	/ERASE
 PROCEDURE:
	Call xyouts.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V. 1991, added option /ERASE to redraw titles (without re-contouring)

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/contour_titles.pro)


CONV_ELEVS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Conv_ELevs
 PURPOSE:
	Convert energy levels from Rydberg units to wave-number/cm,
	and make them all positive relative to fundamental (minimum) level.
	Also returns structure with ionization energy and other info.
	Can be called just once after reading energy Levels from TOPBASE
	(routine will not apply converson twice).
 CALLING:
	Conv_ELevs, ELevs, ion_info
 INPUTS:
	ELevs = array of structures with tags for
		energy of level, quantum numbers, etc. (see Read_ELevs).
 OUTPUTS:
	ELevs = same structure with energy converted to wavenumber per cm.

	ion_info = scalar structure variable, basic info about atom/ion.

 EXTERNAL CALLS:
	function N_struct
	function get_words
	function get_text_input
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.
	F.V.1995, mod to allow user to change ionization energy.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/conv_elevs.pro)


CONV_LOC_SLPE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Conv_Loc_SLPE
 PURPOSE:
	Convert cursor Location to SLP and Energy.
 CALLING:
	Conv_Loc_SLPE, Lx, Ly, cinfo, zratio, ISLP, Energy, ASLP
 INPUTS:
	Lx, Ly = cursor Location
	cinfo = structure, coordinate system info.
	zratio = ratio of max zoom to current [x,y] zoom factors.
 OUTPUTS:
	ISLP = integer, quantum numbers.
	Energy = floating point.
	ASLP = string, SLP in standard characters (e.g. 2Pe).
 COMMON BLOCKS:
	common Conv_Loc_SLPE, Lchar, Pchar
 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/conv_loc_slpe.pro)


COORDIN_RANGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	coordin_range
 PURPOSE:
	Get the range of arc-sec coordinate system for raw mosaic structure.
 CALLING EXAMPLE:
	range = coordin_range( Raw_Mosaic, /IN_WINDOW )
 INPUTS:
	Raw_Mosaic = structured array of images (image_List type structure)
			or image pointers (mosaic_List type structure),
			containing fields for ARCSX and ARCSY.
 KEYWORDS:
	/IN_WINDOW : then computes coordinate range for whole of current window.
 RESULT:
	Function returns a 2 by 2 matrix: [ [xmin,ymin], [xmax,ymax] ] (arcsec).
 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/coordin_range.pro)


COPY_COORDIN

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1989.
F.V. 1991, mod to use copy_struct_inx.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/copy_coordin.pro)


CREATE_GROUP

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1989.
F.V. 1991 put selection code into pick_images,
    and made into function returning group #.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/create_group.pro)


CREATE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	create_mosaic
 PURPOSE:
	Ask user about what & how to average/splice, then
	setup the call to function average_images( raw_mosaic, ... ) or
		 	  function splice_images( raw_mosaic, ... ).
	 and return mosaic_info: a record of what was averaged.
 CALLING EXAMPLE:
	mosaic = create_mosaic( raw_mosaic, mosaic_info, mtitle )
 INPUTS:
	raw_mosaic = structured array of images with relative Location info.
 KEYWORDS:
      /SPLICE_IMAGES : splice instead of average overlaps, so that
			pixels showing on top stay on top in result.
 OUTPUTS:
	mosaic_info = array of structures with just the info of raw_mosaic.
	mtitle = string.
 RESULT:
	Function returns the mosaic image
 COMMON BLOCKS: 
	common mosaic_options1, border, back_set
 EXTERNAL CALLS:
	function N_struct
	function pick_images
	function average_images
	function splice_images
	function mosaic_struct
	pro copy_struct_inx
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990
	F.V. 1991 use copy_struct_inx (saves memory when copying subsets).
	F.V. 1991 added enhanced menu for image selection.
	F.V. 1992 added splice option (instead of averaging).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/create_mosaic.pro)


CURSOR_COORDIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	cursor_coordin
 PURPOSE:
	Display of coordinates as cursor is moved,
	and, when a mouse button is pressed,
	return cursor coordinates (curx,cury) (default is  normalized),
	and also coordinates (cxscal,cyscal) shifted by CMIN & scaled by CSIZE,
	and rotated/zoomed if specified by ROTATE and ZOOM.
 CALLING:
	cursor_coordin, curx, cury, cxscal, cyscal

 KEYWORD INPUTS:
	CMIN=
	CSIZE=
	/CLIP
	COORDSYS = 2 element string array:
				coordsys(0) = "Absolute", "Relative" or "Offset"
				coordsys(1) = "Arcseconds" or "Pixels"
			default = [ "Relative", "Arcseconds" ] .
	RA_ORIGIN=
	RELX, RELY=
	XYRANGE = 
	ROTATE=
	ZOOM_FAC=
	ZOOM_OFF=
	/DEVICE_COORDIN : curx, cury are then scaled into device coordinates.
	/RELATIVE_COORD : cxscal, cyscal are scaled into relative coordinates.
 OUTPUTS:
	curx, cury = coordinates of cursor location (default is  normalized),
	cxscal, cyscal = normalized coordinates shifted by CMIN
			and scaled by CSIZE:  ([ curx, cury ] - cmin)/csize
			and then rotated and zoomed, if requested.
 EXTERNAL CALLS:
	pro rotate_coordin
 PROCEDURE:
	Monitor the cursor in a Loop while displaying coordinates of
	current Location (update only when cursor move).
	Return the Location when mouse button is pressed.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/cursor_coordin.pro)


CURSOR_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Cursor_Info
 PURPOSE:
	Display cursor Location in terms of SLP and Energy in status widget.
 CALLING:
	Cursor_Info
 INPUTS:
	All from common block.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
	 and see file: ~/modion/code/modion_common.pro
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/cursor_info.pro)


DATE_TIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	date_time
 PURPOSE:
	Convert integer day, month, year, hour, minutes, seconds, into strings.
 CALLING:
	date_time, info, date, time
 INPUTS:
	info = structure with tags containing header information.
 OUTPUTS:
	date = string array of month/day/year.
	time = string array of hour:minute:second.
	ymd = string array of year/month/day.
	ymd_hms = string array of year/month/day-hour:minute:second.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/date_time.pro)


DECONV_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DeConv_images
 PURPOSE:
	Interactively select image and PSF from a collection and
	then select and apply various deconvolution methods.
 CALLING:
	image_deconv = deconv_images( image_List, deconv_info )
 INPUTS:
	image_List = array of structures containing images and information.
 KEYWORDS:
	DATA = optional, pooled-array containing the image data, if not with
		the structure, then image_List has pointers into this array.
 OUTPUTS:
	deconv_info = array of structures containing deconv. statistics.

	Function returns an image, the deconvolution result.

 EXTERNAL CALLS:
	function select_image
	pro border_images
	pro DeConv_Tool
 COMMON BLOCKS:
	common DeConv_images, Lag_min
 PROCEDURE:
	Get image & PSF and call pro DeConv_Tool.
 HISTORY:
	Written: Frank Varosi, NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/deconv_images.pro)


DEFINE_ORIGIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	define_origin
 PURPOSE:
	Define origin of arc-second coordinate system for raw mosaic structure.
	Fields in structure giving relative arc-seconds are updated.
 CALLING:
	define_origin, Raw_Mosaic, xorg, yorg

 INPUTS and OUTPUTS:

	Raw_Mosaic = structured array of images (image_List type structure)
			or image pointers (mosaic_List type structure),
			containing fields for ARCSX and ARCSY, and
			these fields are updated with new coordinates.

	xorg, yorg = window (device) coordinates (optional) to be the origin,
		If (xorg,yorg) are not given,
			then users selects origin with mouse-cursor.
 KEYWORDS:
	/CHECK_SCALE : causes the current relative coordinates to be
			checked for consistency with current plate scale,
		and if inconsistent the origin is set to center of mosaic.
 EXTERNAL CALLS:
	function check_struct
	function draw_mark
 COMMON BLOCKS:
	common array_scale, ArcSec_Pix_x, ArcSec_Pix_y
	Plate scale of pixel array, used if not containing within structure.
 PROCEDURE:
	Straightforward.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V.1993, check for and use arc-seconds/pixel scale from structure.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/define_origin.pro)


DEFINE_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 define all structures used in prep.pro and mosaic.pro ,
 image_List1,2,3,4 , image_inven1,2  are same except for magnification factor
  of images to get scaled images for display.
 Frank Varosi NASA/GSFC 1989
 F.V. 1991, added image_List0 for magnification 1/2.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/define_struct.pro)


DEF_IMHD_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	def_imhd_struct
 PURPOSE:
	Define and return header structure containing info about MAMA image.
 CALLING:
	To create empty structure:

		header = def_imhd_struct( hx, hy )

	or if structure variable is obtained by calling get_macq_status:

		header = def_imhd_struct( STATUS_STRUCT = status_info )
 KEYWORDS:
	STATUS_STRUCT = structure variable obtained from
		function get_macq_status containing info about MAMA status,
		or function get_ccd_status containing info about CCD status,
		this info is copied to image header.
 INPUTS:
	hx, hy = size of hot spot array (but usually keyword STATUS is used).
 OUTPUT:
	Function returns the image header structure variable.
 EXTERNAL CALLS:
	pro copy_struct
 HISTORY:
	Frank Varosi NASA/GSFC 1993.
	F.V. 1994, generalize to hold CCD info also.
	F.V. 1994, added sub-structure for device axes.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/def_imhd_struct.pro)


DEF_STAT_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
	Define status block (structure) for receiving info. from -macq-

  To define short structure without the hot-spot array:

	mstat = def_stat_struct( )

  To get FULL structure with hot-spot array, pass previously obtained status:

	mstat = def_stat_struct( mstat )

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/def_stat_struct.pro)


DEVICE_AXES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	device_axes
 PURPOSE:
	Return the device-axis structures for axes that are being used.
 CALLING:
	dev_axes = device_axes( Maxis )
 INPUTS:
	Maxis = max and min # of axes to return (always returns Maxis elements),
		default = 1.
 KEYWORDS:
	/INITIALIZE : just return empty axis structures, for initialization.
 OUTPUTS:
	Function returns an array of structures with positions of device-axes.
 EXTERNAL CALLS:
	function N_struct
	function gpib_dev_struct
 COMMON BLOCKS:
	common gpib, devices				;the device positions.
	common gpib_dev_struct, gpib_dev, dev_axis	;structure templates
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/device_axes.pro)


DEV_POS_HEADER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	dev_pos_header
 PURPOSE:
	Copy device-axis information from structured array to FITS header.
 CALLING:
	fh_devpos = dev_pos_header( dev_axes )
 INPUTS:
	dev_axes = array of axis structures (from function dev_axes).
 OUTPUTS:
	Function returns FITS header, a string array.
 EXTERNAL CALLS:
	pro sxaddpar
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/dev_pos_header.pro)


DEV_POS_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	dev_pos_struct
 PURPOSE:
	Recreate the device-axis structure array from FITS header info.
	Called by pro header_from_fits.
 CALLING:
	dev_axes = dev_pos_struct( fh_devpos, dev_axes )
 INPUTS:
	fh_devpos =
	dev_axes = empty array of device-axis structures.
 OUTPUTS:
	Function returns an array of structures with positions of device-axes.
 EXTERNAL CALLS:
	pro sxpar
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/dev_pos_struct.pro)


DEV_SETUP_LOAD

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

 PURPOSE:
	Restore from a file the saved structure variable(s)
	for particular GPIB device(s), and then command the
	device axes to move to the positions contained in structure.

	Default is to assume widgets (e.g. Klinger_Control) are being used
	and the move commands are generated by setting automatic timers
	on the move buttons. Therefore, if a move button does not exist
	(hidden axis controls) then that axis is not moved.

	Filename is always of form: "dev_setup." + dev_name.* , so that
	the last field identifies different setups for each device.
	The PickFile widget will allow user to select from such a list.

 CALLING:
	dev_setup_Load, dev_name
 INPUT:
	dev_name = string, name of device, thus specifying a filename
		filter to search for saved setups of desired device.
 KEYWORDS:
	FILENAME = optional string specifying the exact filename containing
		the device structure variable to restore, 

	/WAIT : wait until each move command is completed.
		Default is to command each device/axis to move asynchronously,
		and in the case of multiple axes on one controller,
		automatically wait until other axis is finished, then move.
 EXTERNAL CALLS:
	pro move_device
	function N_struct
	function VarType
	function get_dev_num
	function PickFile
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1993.
	F.V. 1994, new method: set timers on move button of widgets.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/dev_setup_load.pro)


DEV_SETUP_SAVE

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

 PURPOSE:
	Save the positions and all info contained in structure variable
	for a particular GPIB device, or devices, to a file.
	Filename always of form: "dev_setup." + dev_name.* , so that
	the last field identifies different setups for each device.

 CALLING:
	dev_setup_save, dev_nums

 INPUT:
	dev_nums = integer, or array, the indices of device(s) in
			common gpib, devices array of structures.
 KEYWORDS:
	NAME = optional string or string array of device names,
		used if dev_nums is not given.
 EFFECTS:
	The device structure variables are saved to a file.

 EXTERNAL CALLS
	function N_struct
	function get_dev_num
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/dev_setup_save.pro)


DE_GULCH[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	de_gulch
 PURPOSE:
	Gulch effect caused by intense source in images
	will be removed by LLsq fitting of row thru source
	to rows away from source and subtracting fit
	to return flat fielded image.
 CALLING EXAMPLE:
	image_degulched = de_gulch( image, fit_coef, /INTER )
 INPUTS:
	image = 2D array of data
 KEYWORDS:
	DEGREE = polynomial degree of fit, default = 1 for Linear fit.
	/INTERACTIVE : allows specification of gulch fit percentage.
	/PLOT : plots fit result against data.
 OUTPUTS:
	fit_coef = coefficients of LLsq fit.
 RESULT:
	Function returns the flat fielded image (gulch supressed).
 EXTERNAL CALLS:
	function filter_image
	function conv_vartype
	function poly_fit
	function poly
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_gulch.pro)


DE_GULCH[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	de_gulch
 PURPOSE:
	Removal of stripes caused by channel gain differences, and interactive
	removal of gulch caused by intense point source in a mosaic image.
	Note: de-stripe should be performed first before de-gulch.
	BUG:  must return & keep result of de-stripe before doing de-gulch.
 CALLING :
 INPUTS:
 KEYWORDS:
 OUTPUTS:
 EXTERNAL CALLS:
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe_gulch.pro)


DE_GULCH_OLD

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1991
F.V. 1991, added interactive option (keyword /INT).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_gulch_old.pro)


DE_GULCH_SORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	de_gulch_sort
 PURPOSE:
	Estimate column pattern background in an image by
	sorting columns and then subtract the background
	to return flat fielded image.
 CALLING EXAMPLE:
	image_flat = de_gulch_sort( image, sky, MIN_SORT=9 )
 INPUTS:
	image = 2D array of data
 KEYWORDS:
	MIN_SORT = index of which element of sort to use at background,
		MIN=0 causes minimum to be the assumed background,
		MIN = #pixels_per_row/2 causes median to be used (default).
 OUTPUTS:
	imback = the estimated sky or row/column pattern background.
 RESULT:
	Function returns the flat fielded image (background subtracted).
 EXTERNAL CALLS:
	function flat_by_sort
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_gulch_sort.pro)


DE_STRIPE

[Previous Routine] [Next Routine] [List of Routines]
Reduce the even/odd channel amplifier variation (vertical stripes) by using
Least squares fit to determine the 2nd order polynomial relation
  between adjacent channels.
Frank Varosi STX @ NASA/GSFC 1991

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe.pro)


DE_STRIPE_1

[Previous Routine] [Next Routine] [List of Routines]
Reduce the even/odd channel amplifier variation (vertical stripes) by using
Least squares fit to determine the 2nd order polynomial relation
  between adjacent channels.
Frank Varosi STX @ NASA/GSFC 1991

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe_1.pro)


DE_STRIPE_2

[Previous Routine] [Next Routine] [List of Routines]
Eliminate the even/odd channel amplifier variation (vertical stripes) by
 averaging adjacent pixels (2x2 box-car smoothing),
 and then shifting image by -1/2 pixel to maintain original positions.
Note that resolution is then degraded from 1x1 to 2x2 pixels.
Frank Varosi STX @ NASA/GSFC 1992

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe_2.pro)


DE_STRIPE_3

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1995

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe_3.pro)


DE_STRIPE_BIB

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1995

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe_bib.pro)


DE_STRIPE_SPIRAC

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1995

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/de_stripe_spirac.pro)


DISPLAY_ALL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_ALL
 PURPOSE:
	For the MODION widget:
	Display all energy levels, transitions and axes in draw widget windows.
	Usually called by pro Draw_Axes_Set_V of CW_Draw_Axes widget,
	when value is set by the Modion widget.
	Assumes that the draw widget windows are already erased.
 CALLING:
	Display_ALL, widgst
 INPUTS:
	widgst = structure, state and info of CW_Draw_Axes widget.

		and variables in common blocks.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	pro Display_ELevs
	pro Display_Trans
	pro Display_SupLevs
	function N_struct
 PROCEDURE:
	Straightforward.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.
	Mod: F.V. 1995, added call to Display_SupLevs.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_all.pro)


DISPLAY_ELEVS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_ELevs
 PURPOSE:
	Display the Energy Levels obtained from TOPBASE (atomic database)
	as horizontal lines with color indicating status.
	Default is to display just Levels that have non-zero color.
 CALLING:
	Display_ELevs, ELevs
 INPUTS:
	ELevs = array of structures with tags for graphic Location of Levels.
 KEYWORDS:
	/NEW : display only Levels for which ELevs.disp EQ 1 and color GT 0.

	WHICH = array of subscripts indicating which Levels to display,
		default is to display ones with non-zero color.

	ZOOM_FACTOR = magnification to be applied to:
		both x & y axes if one number is specified, or
		x & y axes respectively if two numbers are specified.

	PANXY = two numbers specifying x & y translation in device coordinates.
 OUTPUTS:
	ELevs = the "disp" tag of each Level displayed is set to zero.
 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
	Display energy levels using TV, in backwards order to avoid
	obscuring display with the ionization line (which is last in array).
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_elevs.pro)


DISPLAY_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	display_images
 PURPOSE:
	Display images from the List into specified window,
	with respective Locations as specified in structure,
	and stacked in the order given by their visibility Levels.
 CALLING EXAMPLE:
	display_images, image_List [ , image_pool, /RESIZE ]
 INPUTS:
	image_List = structured array containing images and specifications
	image_pool = optional array containing the images,
		in such case image_List has pointers into array image_pool.
 KEYWORDS:
	INUMS = specify indices of images in the List (default is all).
	GROUP = specify group # of images (default is all groups).
	/ERASE : erase window before display of images.
	/RESIZE : resize window to accomodate all images.
	WINDOW = window # in which to display (default is image_List(0).windo)
	XPOS, YPOS = position of window on monitor (only if /RESIZE),
			default = upper right corner of monitor.
 EXTERNAL CALLS:
	pro display_image	(to handle display of each individual image)
	pro get_window
	pro resize_window
	function N_struct
	function check_Mag_Fact
 SYSTEM VARIABLES:
	!DEVX , !DEVY = size of monitor screen in pixels.
 COMMON BLOCKS:
	common display_images, min_xsiz      ;the mininum X-size of window
	common display_images2, always_all	;flag to force display of all
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989
	F.V.1991, added /RESIZE keyword option to resize window around images.
	F.V.1992, generalized for collection of arbitray images {mosaic_List}.
	F.V.1997, mod to display only top image in a trivial stack of many.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_images.pro)


DISPLAY_INBAND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_InBand
 PURPOSE:
	Display the inband filter transmission & uniformity analysis results.
 CALLING:
	Display_InBand, fs_inband
 INPUT:
	fs_inband = structure containing inband transmission analysis results.
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
	function get_text_input
	pro psport
	pro psclose
	pro plot_Peak_Tr
	pro plot_TranSpec
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_inband.pro)


DISPLAY_INBAND1

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_InBand1
 PURPOSE:
	Display the inband filter transmission & uniformity analysis results.
 CALLING:
	Display_InBand1, inbsp
 INPUT:
	inbsp = structure containing inband transmission analysis results.
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
	function get_words
	function strconcat
	pro get_window
	pro tvs
	pro printw
	pro tvcircle
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_inband1.pro)


DISPLAY_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
 CALLING:
	display_mosaic, mosaic, mosaic_spec
 INPUT:
	mosaic = 2D image array.
	mosaic_spec = structure with contour display specifications.
 HISTORY:
	Frank Varosi STX @ NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_mosaic.pro)


DISPLAY_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	display_mosaics
 PURPOSE:
	Restore, Select, and Display mosaic images (or could be any images).
 CALLING:
	display_mosaics, mosaic, mos1_spec, mos1_info
 INPUTS:
	No input arguments required,
	all input is thru common mosaic_array:

	mosaics = pooled-array of images, pointed to by mosaic_specs.
	mosaic_specs = array of structures containing specs. and
			pointers into the array (pool): mosaics.
	mosaic_infos = array of structures containing info about
			how each mosaic image was formed.

	Each single mosaic image is extracted from array mosaics.

 OUTPUTS:
	mosaic = the current mosaic image being displayed.
	mos1_spec = structure containing display specifications for mosaic.
	mos1_info = structure with info about how mosaic image was formed.
	Return_Task = string, next task requested by user.

	These above are optional arguments,
	all important output is thru common mosaic_array.

 EXTERNAL CALLS:
	pro restore_mosaic
	pro save_mosaic
	pro contour_mosaic
		and many more...
 COMMON BLOCKS:
	common display_mosaics, imos
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common dir_names, dirinv, dirmos_raw, dirmos_aver
	common dir_name1, dir_FITS
 PROCEDURE:
	Loop on menu and case, calling requested procedures and functions.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1990, added Profile and Show fluxes options.
	F.V. 1991, converted to use Mosaic_Specs structure.
	F.V. 1991, option save mosaic now also saves corresponding Mosaic_Spec.
	F.V. 1991, added de-gulch & de-stripe option.
	F.V. 1992, added option to contour 2 mosaics by overlaying.
	F.V. 1994, added option to update (replace) old mosaic with current.
	F.V. 1994, added HARDCOPY option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_mosaics.pro)


DISPLAY_NEW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_NEW
 PURPOSE:
	For the MODION widget:
	Find the energy levels that are flagged as newly selected or modified
	and display them in the central draw widget window.
	Usually called by pro Draw_Axes_Set_V of CW_Draw_Axes widget,
	when value is set by the Modion widget.
 CALLING:
	Display_NEW, widgst
 INPUTS:
	widgst = structure, state of CW_Draw_Axes widget.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_ELevs, ELevs
	common modion_Widget, modion_widget
 EXTERNAL CALLS:
	pro Display_ELevs
 PROCEDURE:
	Straightforward.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_new.pro)


DISPLAY_OPTIONS

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_options.pro)


DISPLAY_REFRESH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_Refresh
 PURPOSE:
	For the MODION widget:
	Refresh the display of energy levels and transitions in
	the main draw widget window. Usually called by pro Draw_Axes_Set_V
	of CW_Draw_Axes widget, when value is set by the Modion widget.
 CALLING:
	Display_Refresh, widgst
 INPUTS:
	widgst = structure, state and info of CW_Draw_Axes widget.

		and variables in common blocks.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	pro Display_ELevs
	pro Display_Trans
	pro Display_SupLevs
 PROCEDURE:
	Straightforward.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_refresh.pro)


DISPLAY_SUPLEVS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_SupLevs
 PURPOSE:
	Display the super-Levels created by user, as boxes around the
	merged energy Levels, and display group number at upper-right corner.
 CALLING:
	Display_SupLevs, SupLevs
 INPUTS:
	SupLevs = array of structures with tags giving Location of superlevels.
 KEYWORDS:
	ZOOM_FACTOR = magnification (default=1) to be applied to:
		both x & y axes if one number is specified, or
		x & y axes respectively if two numbers are specified.
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
	Create coordinates of boxes from corner Locations and call IDL plots.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_suplevs.pro)


DISPLAY_TRANS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Display_Trans
 PURPOSE:
	Display the allowed transitions between energy levels as selected.
 CALLING:
	Display_Trans, Trans
 INPUTS:
	Trans = array of structures with fields for graphics device Location of
		transitions between energy levels.
 KEYWORDS:
	ZOOM_FACTOR = magnification (default=1) to be applied to:
		both x & y axes if one number is specified, or
		x & y axes respectively if two numbers are specified.
	PANXY = two numbers specifying x & y translation in device coordinates,
		default = [0,0].
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/display_trans.pro)


EDGE_IMSCALED

[Previous Routine] [Next Routine] [List of Routines]
check the scaled image if just central subset of image is to be displayed,
	(so unsmoothed edges are not displayed when image is smoothed),
 return the width of unsmoothed edge divided by Magnification, unless /MAGNIF.
Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/edge_imscaled.pro)


EFFICIENCY

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

 PURPOSE:
	Create a widget to control the analysis of grating efficiency data
	and then display/hardcopy the computed efficiency curves.

 CALLING:
	Efficiency

 KEYWORD INPUTS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the top level base of the
		new widget created by this procedure. If specified,
		this Efficiency widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EFFECTS:
	Initiates the Xmanager if it is not already running.

 EXTERNAL CALLS:
	pro Xmanager
	function widget_Tree_Map
 COMMON BLOCKS:
	common Efficiency, effic_widget
 PROCEDURE:
	Create and register the widgets with the Xmanager.
	Selection events are then processed by pro Effic_Event.
 HISTORY:
	Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/efficiency.pro)


ERROR_ANALYSIS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	error_analysis
 PURPOSE:
	Compute the expected relative error in tranmission images based
	on the estimated the error properties of original IN & OUT data.
 CALLING:
	error_analysis, image_List
 INPUT and OUTPUT:
	image_List = structured array with substructures .info and .info_ref.
		The tag image_List.Rel_Error is updated.
 HISTORY:
	written, Frank Varosi 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/error_analysis.pro)


ERROR_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	error_info
 PURPOSE:
	Define structure for storing error (noise) information and
	if image array is passed then estimate the error properties of image.
	Called by function headinfo to define the structures, and
	then used by function sig_ref.
 CALLING:
	einfo = error_info( image )
 INPUTS:
	image = 2D array
 KEYWORDS:
	/NO_TITLE : suppress printing of title line when results are printed
		via call to pro print_struct.
 OUTPUTS:
	Function returns information about errors (expected values and variance)
	in image as a structure variable.
 COMMON BLOCKS:
	common TUT_setup, center_xy, cradius
	common error_info, boxsize, reject
 EXTERNAL CALLS:
	function Local_Variance
	function Disk_Region
	function Trapez
	function stdev
	pro MinMax_Histo
	pro Bin_Scat
 PROCEDURE:
	Compute local variances and histograms in central disk region,
	then integrate sqrt(variance) with respect to histogram distribution.
 HISTORY:
	written, Frank Varosi 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/error_info.pro)


EXPORT_IMPORT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	export_import
 PURPOSE:
	Transfer (add/replace) images from PREProcess inventory structures
	to TOFU image_List (TUT_images) structures.
 CALLING:
	export_import, image_List, image_inven

 INPUTS & OUTPUTS:
	image_List =
	image_inven =
 EXTERNAL CALLS:
	function check_struct
	function N_struct
	function merge_images
	pro organize_images
	pro Tofu_Task
 COMMON BLOCKS:
	common control, cur_pro, win_mos, win_prep
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	Mod for TOFU: F.V.1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/export_import.pro)


FILTER_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	filter_images
 PURPOSE:
	Select and apply one of 4 filters to all or a subset of images
	in the collection (image_List, usually a raw mosaic).
	User has the option to replace images, or make new versions
	thereby keeping original images in the List.
 CALLING:
	filter_images, image_List [ , INUMS=inums, /REDISPLAY ]
 INPUT and OUTPUT:
	image_List = structured array containing images and other info.
 KEYWORDS:
	INUMS = indices of filtered images in the structured array image_List.
	/REDISPLAY causes the filtered images to be rescaled and redisplayed.
 EXTERNAL CALLS:
	function filter_image
	function sig_ref
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.
	F.V.1997, added outlier sigma filter option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/filter_images.pro)


FILTER_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1989.
F.V.1991, modif to use mosaic_spec structure.
F.V.1991, use filter_image to process ALL_PIXELS.
F.V.1991, added "iterate" filter (applies smooth(3) iteratively).
F.V.1992, use fields .maxF & .minF for min-max of filtered mosaic.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/filter_mosaic.pro)


FILTER_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	filter_mosaics
 PURPOSE:
	Select and apply one of 6 filters to all or a subset of images
	in the collection mosaic_List.
 CALLING:
	filter_mosaics, mosaic_List, mosaic_images [ , INUMS=inums, /REDISPLAY ]
 INPUT and OUTPUT:
	mosaic_List = structured array containing pointers into mosaic_images.
	mosaic_images = array containing the image data.
 KEYWORDS:
	INUMS = indices of filtered images in the structured array mosaic_List.
	/REDISPLAY causes the filtered images to be rescaled and redisplayed.
 EXTERNAL CALLS:
	funcs:	filter_image	sigma_filter	de_stripe	de_gulch
		pick_images	select_number	next_word	N_struct
	pros:	outlier_filter
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991 (adapted from pro filter_images).
	F.V.1993, added iterate, sigma_filter, De_Stripe, and De_Gulch options,
		and return indices of filtered images via keyword INUMS.
	F.V.1994, added Nsigma and iterate options when using sigma_filter.
	F.V.1997, added outlier_filter option, usually better than sigma_filter.
	FV, 1999, ask for FWHM=#pixels with "iterate smooth(3) -> Gaussian".

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/filter_mosaics.pro)


FILT_RED

[Previous Routine] [Next Routine] [List of Routines]
 reduce transmission data in IDL in loop above transreduc.pro
 revised:  14-june-96 TAN


(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/filt_red.pro)


FILT_RED_ORIG

[Previous Routine] [Next Routine] [List of Routines]
 reduce transmission data in IDL in loop above transreduc.pro
 revised:  14-june-96 TAN
 revised:   27 july 96 DAC -- bin to 129 by 129 hardwired

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/filt_red_orig.pro)


FIND_DEVICES

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

 PURPOSE:
	Clear and allocate the GPIB interface,
	get handles (for I/O) of the requested GPIB devices,
	and store handles and device names in a structured array
	(in common gpib, devices).
	If find_devices has been called previously, only the new
	devices are concatenated with the existing ones in common.

 CALLING:
	find_devices, dev_names

 INPUT:
	dev_names = string array, names of the devices on GPIB interface.

 KEYWORDS:
	/ASK_USER : cause a yes/no menu to appear asking user if they
		really want to allocate the GPIB and its devices.
 OUTPUT:
	No explicit output, results are stored in common gpib, devices.

 EXTERNAL CALLS:
	function gpib_dev_struct
	function N_struct
	function IBFIND

 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 PROCEDURE:
	Create the device info structure,
	call IBFIND to get all the device handles,
	concatenate with any existing devices.
	Note that device names & handles are also stored in the axis structure,
	for convenience and cross-referencing.
	The first time find_devices is called, the input array dev_names
	is checked to make sure a GPIB interface is specified (default = gpib0)
	and this interface is first cleared before proceeding (with IBSIC).
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/find_devices.pro)


FIND_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
return image number(s) containing (x,y) in current window.
 Frank Varosi NASA/GSFC 1989
 F.V. added option to require (x,y) to be interior of images, 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/find_images.pro)


FIND_IMAGES_V

[Previous Routine] [Next Routine] [List of Routines]
return image number(s) containing (xv,yv) in current window,
			where (xv,yv) is an array of coordinates.
 Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/find_images_v.pro)


FIND_LEVELS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Find_Levels
 PURPOSE:
	Find Levels within SLP and Energy values/range and return subscripts,
	if the Level colors are non-zero (if zero they are hidden).
 CALLING:
	isel = Find_Levels( islp, Energy )
 INPUTS:
	islp = integer scalar or 2 element vector.
	Energy = floating point scalar or 2 element vector.
 OUTPUTS:
	Function returns subscripts of selected energy levels.
 COMMON BLOCKS:
	common modion_ELevs, ELevs
 EXTERNAL CALLS:
	function Where_Tag
 PROCEDURE:
	If one coordinate, find closest energy,
	if two coordinates (box-area) get subscripts of Levels in area.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1995, mod to return failure if Level colors are zero.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/find_levels.pro)


FIND_SUPLEV

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Find_SupLev
 PURPOSE:
	Find the nearest SuperLevel and if it is within distance
	specified by RESOLUTION keyword, return subscript.
 CALLING:
	isel = Find_SupLev( event, Energy )
 INPUTS:
	event = structure containing tags for X & Y coordinates
		of cursor in draw window: [event.x,event.y].
	Energy = scalar, the Location of cursor converted to energy.
 KEYWORD:
	RESOLUTION = distance in pixels to be considered as a hit, def=7.
 OUTPUTS:
	Function returns subscript of nearest SuperLevel, if with resolution.
 COMMON BLOCKS:
	common modion_SupLevs, SupLevs
	common modion_Widget, modion_widget
 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/find_suplev.pro)


FIT_EFF

[Previous Routine] [Next Routine] [List of Routines]
The non-linear fitting procedure for the groove efficiency

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/fit_eff.pro)


FLAT_FIELD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Flat_Field
 PURPOSE:
	Divide current extracted subimage by a flat-field image
	(normalized so that average = 1).
	Flat-field image is then kept in common for reuse.
 CALLING:
	Flat_Field, event, /REDISPLAY
 INPUT:
	event = structure of widget event info, passed from pro Analyze_Image.

	All other INPUT and OUTPUT thru common blocks.

 EXTERNAL CALLS:
	function PickFile
	function yes_no_menu
	pro copy_struct
	pro Force_Events
 COMMON BLOCKS:
	common Analyze_Image, analyze_widget
	common opticon0, imaged, imhead, imhist
	common opticon1, subimage, subhead, subhist
	common opticon2, flatimage, flathead
	common opticon4, subimscaled, subimdisp
	common opticon5, im_fh, sub_fh, flat_fh
	common Flat_Field, FlatF, flat_file, menu_base, menu_Label, but2
 HISTORY:
	Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/flat_field.pro)


FOSC_APPROX

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	fosc_approx
 PURPOSE:
	Use Kramers semiclassical formula for hydrogenic atom to
	compute approximate oscillator strengths of atomic transitions.
	Note that the Gaunt factor is NOT included, but it is near unity
	for large quantum numbers and is 0.717 for the n = 2 -> 1 transition.
 CALLING:
	fosc = fosc_approx( nLow, nUp )
 INPUTS:
	nLow, nUp = main quantum numbers of lower and upper energy levels resp.,
			floating point values are rounded to nearest integer.
 KEYWORDS:
	TRANS = matrix where each row is [ lower, upper ] quantuum numbers
		for a list of level transitions (optional method of input).
 OUTPUTS:
	Function returns oscillator strength(s) of specified transitions.
 PROCEDURE:
	If either quantum number is zero or negative then return 10^(-6).
	Force upper quantum number to be at least one larger than lower n.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/fosc_approx.pro)


GET_AXIS_NUM

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

 PURPOSE:
	Get the number of an axis of GPIB device by specifying its name,
	i.e. the index in the array: devices(dev_num).axis

 CALLING:
	axnum = get_axis_num( axis_name, dev_num )

 INPUTS:
	axis_name = string, name of an axis of GPIB device.
	dev_num = integer, index of GPIB device in common gpib,devices array.

 OUTPUT:
	The function returns the index of requested axis,
	so that: axis_name = devices(dev_num).axis(axnum).name,
	or if not found, returns -1.

 EXTERNAL CALLS:
	function N_struct
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_axis_num.pro)


GET_BY_ALIAS

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

 PURPOSE:
	Get the device number and axis number of GPIB device,
	(i.e. the index in the array: devices(dev_num).axis(axis_num) )
	by specifying the equivalent alias, which was defined by user.

 CALLING:
	get_by_alias, alias, dev_num, axis_num

 INPUTS:
	alias = string, the alias of device axis as previously defined by user.

 OUTPUTS:
	dev_num = integer, index of GPIB device in common gpib,devices array.
		(if alias is not matched, dev_num = -1).
	axis_num = integer, index such that:
		alias = device(dev_num).axis(axis_num).alias
		(if alias is not matched, axis_num = -1).

 EXTERNAL CALLS:
	function N_struct
	function VarType
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_by_alias.pro)


GET_CCD_IMAGE

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

 PURPOSE:
	Copy the previously read CCD image from shared memory into IDL.
	All accomplished by calling shareable object C-code in ccdmem.so.
	Also check noise and offset in image borders, and place in header.
	Other relevant info, such as device positions, are returned in header.

 CALLING:
	get_CCD_image, image, header, histog_im

 INPUTS:	none

 OUTPUTS:
	image = 2-D array, read from CCD.
	header = structure containing info about image.
	histog_im = histogram of image

 EXTERNAL CALLS:
	pro get_CCD_status
	pro def_imhd_struct
	pro border_noise
	function get_text_input
	function device_axes
	function dev_pos_header
	and Call_External entry points in ccdmem.so.
 COMMON:
	common Analyze_Image, analyze_widget
	common Integrate_CCD, CCD_widget
 HISTORY:
	Frank Varosi NASA/GSFC 1994.
	F.V. 7/94 : convert image to Long, use only part of borders for noise.
	F.V.12/94 : new method defining image size, and handle binning factors.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_ccd_image.pro)


GET_CCD_STATUS

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
	Get the status info. from data acquisition program (ccdacq).
 CALLING:
	get_CCD_status, ccd_status
 OUTPUT:
	ccd_status = the status structure variable.

	Some fields in structure:

		x0 = initial column
		nx = # of columns
		dx = column binning factor
		bxx = 2 integers, # of border pixels for columns on both sides.
		y0 = initial row
		ny = # of rows
		dy = row binning factor
		byy = 2 integers, # of border pixels for rows on both sides.
 COMMON:
	common get_CCD_status, cstat, cstatus

		cstat = the exact status block corresponding to C-code.
		cstatus = the status block as used in IDL.
 PROCEDURE:
	Get the status info from shared memory via Call_External.
	Copy the info to new status structure
	which has more detailed border pixel info.
 HISTORY:
	F. Varosi, 1994, NASA/GSFC.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_ccd_status.pro)


GET_DEV_NUM

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

 PURPOSE:
	Get the number of a GPIB device, the index in the array: devices.

 CALLING:
	devnum = get_dev_num( name )

 INPUTS:
	name = string or array of strings, name(s) of GPIB device(s).

 OUTPUT:
	The function returns the indices of matching devices
	in common gpib, devices.  If not found, returns -1.

 EXTERNAL CALLS:
	function N_struct
	function VarType
	pro match

 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_dev_num.pro)


GET_EFFIC_DATA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	get_Effic_Data
 PURPOSE:
	Compute the net flux (signal - background) per second in an image.
	Add the measurement and related info into array of structures
	which will be analyzed to determine efficiencies of gratings.
	Signal/Background region are first determined automatically,
	then user can accept the result or select new region & measurement.
 CALLING:
	get_Effic_Data, imaged, imhead, imspec
 INPUTS:
	imaged = the image data array
	imhead = structure variable containing header info about image.
	imspec = structure variable specifying how the image is displayed.
 OUTPUT:
	all thru common Effic_Data, eff_meas
 EXTERNAL CALLS:
	function def_imhd_struct
	function FullWid_HalfMax
	function box_create
	pro box_draw
	pro box_erase
	pro copy_struct
 COMMON BLOCKS:
	common Effic_Data, eff_meas	;the List of measurements.
	common get_Effic_Data, effd	;empty structure template.
 PROCEDURE:
	Determine centroid and FWHM, use to automatically define large box 
	containingd signal, compute average background/pixel outside of box,
	then subtract from signal. Print results and ask user if ok, or
	select new box interactively.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_effic_data.pro)


GET_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	get_image
 PURPOSE:
	Get the image data from structures array
	or from  array, when image_List points to it.
 CALLING:
	image = get_image( im_num, image_List, images )
 INPUTS:
	im_num =
	image_List =
	images = the array actually containing images,
		if image_List points to it.
 RESULTS:
 EXTERNAL CALLS:
	function image_extract
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_image.pro)


GET_IMSCALED

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	get_imscaled
 PURPOSE:
	Get the scaled image for display from structures array
	or from  array, when image_List points to it.
 CALLING:
	imscaled = get_imscaled( image_List, image_num, IMAGES=images )
 INPUTS:
	image_List =
	image_num =
 KEYWORDS:
	IMAGES = the array actually containing scaled images,
		if image_List points to it.
 RESULTS:
 EXTERNAL CALLS:
	function image_extract
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_imscaled.pro)


GET_MACQ_STATUS

[Previous Routine] [Next Routine] [List of Routines]
	Get the status info. from data-taking program (xmacq).

	get_macq_status, mstat

	mstat:	the status structure variable.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_macq_status.pro)


GET_MAMA_IMAGE

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

 PURPOSE:
	Get the result of integration of data from the MAMA detector.
	This calls C-code to copy the image from shared memory,
	where the MAMA (x,y,t) data stream has been asynchronously
	collected and binned into pixels (by other C-code: xmacq).
	If image is only 16-bits, the "hot spot" (bad pixels of MAMA detector)
	is stored separately as 32-bits in status block by the xmacq process.
	If image is 32-bits, the "hot spot" is taken from the image and
	placed in the header. In either case, the hotspot in the image is
	set to zero first to get counts and maximum without hotspot,
	then is replaced with values limited to the thus obtained maximum.
	Other relevant info, such as device positions are returned in header.

 CALLING:
	get_MAMA_image, image, header, histog_im

 INPUTS:	none

 OUTPUTS:
	image = 2-D array, the integration of (x,y) counts from MAMA detector.
	header = structure containing info about image.
	histog_im = histogram of image

 EXTERNAL CALLS:
	pro get_macq_status
	pro def_imhd_struct
	function device_axes
	function dev_pos_header
	and Call_External entry point  _read_image  in macqmem.so.
 COMMON:
	common Analyze_Image, analyze_widget
 HISTORY:
	Frank Varosi NASA/GSFC 1993.
	F.V. 1994, get all device axes as structure array in header.
	F.V. 1994, wavelength calculated from monochrom position + offset.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_mama_image.pro)


GET_SCAT_DATA

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

 PURPOSE:
	Interactively extract scatter data from subimage.
	This routine creates the widgets, get_Scat_Event does the processing.
 CALLING:
	get_Scat_Data, imspec
 INPUTS:
	imspec = structure, image display specifications.

 KEYWORD INPUTS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the top level base of the
		new widget created by this procedure. If specified,
		this Integrate_CCD widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 OUTPUTS:	all thru common Scatt_Data, scatt_meas

 EXTERNAL CALLS:
	pro copy_struct
	pro Xmanager
	pro widget_Location
	function CW_Bgroup
	function Widget_Lab_Text
 COMMON BLOCKS:
	common get_Scat_Data, scad	;empty structure template.
	common get_Scat_Event, scattm
	common get_Scat_Widget, gs_widget
	common opticon1, subimage, subhead, subhist
 HISTORY:
	written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/get_scat_data.pro)


GPIB_DEV_STRUCT

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

 PURPOSE:
	Define and return the IDL structure array for GPIB devices.

 CALLING:
	gpib_devs = gpib_dev_struct( Ndev )

 INPUTS:
	Ndev = number of devices to be controlled
		(= number of elements in returned structure array).

 KEYWORD:
	NAXIS = # of axes for each Klinger/motion controller, default = 4.

 OUTPUTS:
	Returned array has the requested # of elements, and each element
	is structured to hold info about a GPIB device.
	Each element has 4 axes which can be configured via pro setup_axes.

 EXTERNAL CALLS:
	function N_struct

 COMMON BLOCKS:
	common gpib_dev_struct, gpib_dev, dev_axis	;the structure templates

 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.
	F.V.1996, added sub-structure feedback to each axis, for Unidex applic.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/gpib_dev_struct.pro)


GROOV_EFF

[Previous Routine] [Next Routine] [List of Routines]
	The theoretical function for fitting groove efficiency
 Input:
	wave = wavelength in mm, it can be an array fltarr(n)
	rt(0) = maximum groove efficiency,  fltarr(2)
	rt(1) = blazing angle in radius
	alpha0 = incident angle in radius   
	wave0 = incident wavelength in mm
	(wave0 and alpha0 define a range for interpolation of alpha, given wave)
	m = diffraction order
 Output:
	eff = groove efficiency, fltarr(n)
	pder = partial derivative with respect to rt, fltarr(n,2)

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/groov_eff.pro)


HEADER_TO_FITS

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
 	Copy info from structure header to FITS header
 CALLING:
	header_to_fits, hdr, image, fh, fhspot
 INPUTS:
	hdr: header structure variable
	image:  the image data
 OUTPUTS:
	fh:  FITS header created
	fhspot:  FITS header for hot-spot image extension,
		(only if image is the full size).
 HISTORY:
	Frank Varosi 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/header_to_fits.pro)


HEADINFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	headinfo
 PURPOSE:
	Unpack additional items that were placed by CC200 pc control program
	from the numeric header left unused by Photometrics
	{see QuickBasic routine "Fillheader" in TUT}.
 CALLING:
	hinfo = headinfo( numhdr, ahdr, hdrdev2, hdrdev4, FILE=filename )
 INPUTS:
	numhdr =
	ahdr =
	hdrdev2 =
	hdrdev4 =
 KEYWORDS:
	FILE = string, filename including directory path.
	IMAGE = optional image data (2D array) to get error info.
 OUTPUTS:
	Function returns information from CCD file header in structure var.
 EXTERNAL CALLS:
	function scalar
	function get_words
	function error_info
 HISTORY:
	written, Frank Varosi 1996-97.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/headinfo.pro)


HEAD_FROM_FITS

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
 	Copy info from FITS header to structure header
 CALLING:
	hdr = head_from_fits( fh, hx, hy )
 INPUTS:
	fh = string array, FITS header.
	hx, hy = optional integer input, size of hotspot array (for MAMA det.).
 OUTPUT:
	returns header structure variable with new info.
 HISTORY:
	Frank Varosi 1993.
	F.V. 1994, converted to a function, added call dev_pos_struct.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/head_from_fits.pro)


HEAD_PCNET

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	head_pcnet
 PURPOSE:

	Convert header records from DRO files (output of IROBSNET program)
	into IDL structure variable.

 CALLING:
	header = head_pcnet( head_record, header )

 INPUTS:
	head_record = Longword array, the image header record (128 longwords).
	header = structure variable to store header info, returned by func.

 KEYWORDS:

	/FULL : return the structure containing full header info.
	/PC_FILE : indicates DRO file was written on a PC instead of old LSI-11
	/NET_OBS : indicates DRO file was written by IROBSNET on SPIRAC PC,
		and in this case processing is by function head_pcnet.

 OUTPUT:
	Function structure variable containing header info.
	Default is just part of the header, unless /FULL is set for full header.

 EXTERNAL CALLS:
	function conv_vax_unix
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/head_pcnet.pro)


HEAD_SIG_REF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	head_sig_ref
 PURPOSE:

	Convert header records from DRO files (output of IROBS program)
	into IDL structure variable.

 CALLING:
	header = head_sig_ref( head_record )

 INPUTS:
	head_record = Longword array, the image header record (128 longwords).

 KEYWORDS:

	/FULL : return the structure containing full header info.
	/PC_FILE : indicates DRO file was written on a PC instead of old LSI-11
	/NET_OBS : indicates DRO file was written by IROBSNET on SPIRAC PC,
		and in this case processing is by function head_pcnet.

 OUTPUT:
	Function structure variable containing header info.
	Default is just part of the header, unless /FULL is set for full header.

 EXTERNAL CALLS:
	function headinfo	(to define short version of header structure)
	function head_pcnet   (to process headers of SPIRAC IROBSNET DRO files)
	function conv_vax_unix
 COMMON BLOCKS:
	common head_sig_ref
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V.1994, options to handle new types of DRO header formats.
	F.V.1996, expanded structure for SPIRAC DRO header, call head_pcnet.
	F.V.1997, expanded structure for DSP status codes from SPIRAC.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/head_sig_ref.pro)


HISTOG_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	histog_images
 PURPOSE:
	Compute histograms of selected images and plot histograms on same scale.
	(results optionally returned in keywords: DENSITY= , VALUES= , INUMS= )
 CALLING:
	histog_images, image_List, image_data
 INPUTS:
	image_List = array of structures containing images and information.
	image_data = optional, pooled array of image data, if not with
		the structure, then image_List has pointers into this array.
 KEYWORDS:
	NBINS =
	MAXIM =
 KEYWORD OUTPUTS (optional):
	DENSITY =
	VALUES =
	INUMS =
 EFFECTS:
	Histograms are plotted with line types 1,2,3...
 EXTERNAL CALLS:
	pro plot_histograms
	function Histo
	function calc_im_stack
	function select_image
	function select_images
	function overlap_images
	pro show_info
	pro border_images
 COMMON BLOCKS:
	common histog_images	(for saving option settings)
	common histog_imagex
	common histog_plot
	common menus, menu_window	(for info messages)
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V.1990, added options for plot scaling and # of bins.
	F.V.1990, added option to histogram image overlaps.
	F.V.1991, generalized to work with mosaic image structure & data array.
	F.V.1992, added menu option to plot the accumulative histograms.
	F.V.1997, added menu option to Limit the pixel values used histograms.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/histog_images.pro)


IBCLEAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBCLEAR
 PURPOSE:
	Calls the NI-488M program IBCLR to send selected device clear command.
 CALLING SEQUENCE:
	status = IBCLEAR( DEVICE )
 INPUT:
	DEVICE = Device number of device to clear (from IBFIND).
 RESTRICTIONS:
	The device number must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 MODIFICATION HISTORY:
	William Thompson, January, 1992.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibclear.pro)


IBCMD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBCMD
 PURPOSE:
	Calls the NI-488M program IBCMD to send a command to a GPIB board.
 CALLING SEQUENCE:
	status = IBCMD( BOARD, OUTPUT )
 INPUTS:
	BOARD	= Board number to send command to (from IBFIND).
	OUTPUT  = Command to send to GPIB board.  Can be either a character
		  string or a binary array.
 RESTRICTIONS:
	The board number must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 MODIFICATION HISTORY:
	William Thompson, January, 1992.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibcmd.pro)


IBFIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBFIND
 PURPOSE:
	Calls the NI-488M program IBFIND to get the device number of a
	particular GPIB device.
 CALLING SEQUENCE:
	Result = IBFIND( DEVICE_NAME )
 INPUT:
	DEVICE_NAME = Name of the GPIB device (e.g. "gpib0", "dev1").
 OUTPUT:
	The result of the function is the device number as used by IBWRT, etc.
 RESTRICTIONS:
	This procedure should only be called once for each device.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 MODIFICATION HISTORY:
	William Thompson, October, 1991.
	F.V.1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibfind.pro)


IBPCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBPCT
 PURPOSE:
	Calls the NI-488M program IBPCT to send the pass control signal.
 CALLING SEQUENCE:
	status = IBPCT( CONTROLLER )
 INPUT:
	CONTROLLER = Device number of controller to pass control to.
 RESTRICTIONS:
	The device number of the controller must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 MODIFICATION HISTORY:
	William Thompson, October, 1991.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibpct.pro)


IBREAD

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

 PURPOSE:
	Calls the NI-488M program IBRD to read data from a GPIB device.

 CALLING:
	data = IBREAD( dev_handle, ib_status, NBYTES=N_bytes )

 INPUT:
	dev_handle = Device I/O number to read from (from IBFIND).

 KEYWORD:
	NBYTES = number of bytes of data to read from GPIB device, default=80.

 OUTPUTS:
	Function returns the data read from the device:
	a byte array of length N_bytes.

	ib_status = integer returned by Call_External indicating status of read.

 RESTRICTIONS:
	The device number must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 HISTORY:
	William Thompson, October, 1991.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993: output of function is result of read.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibread.pro)


IBRSP

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

 PURPOSE:
	Return the serial poll response byte from a GPIB device.

 CALLING:
	spr_byte = IBRSP( dev_handle, ib_status, ib_error )

 INPUTS:
	dev_handle = Device I/O number to read from (from IBFIND).

 OUTPUTS:
	ib_status = 16 bit word = IBSTA of NI-488M software.
	ib_error = 16 bit word = IBERR of NI-488M software.

	Function returns the serial poll response byte of the device.

 PROCEDURE:
	Calls NI-488M routine IBRSP using CALL_EXTERNAL.
 HISTORY:
	Frank Varosi, 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibrsp.pro)


IBSIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBSIC
 PURPOSE:
	Calls the NI-488M program IBSIC to send the GPIB interface clear signal.
 CALLING SEQUENCE:
	status = IBSIC( GPIB_BOARD )
 INPUT:
	GPIB_BOARD = GPIB Board number to write to (from IBFIND).
 RESTRICTIONS:
	The GPIB board number must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 MODIFICATION HISTORY:
	William Thompson, October, 1991.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibsic.pro)


IBWAIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBWAIT
 PURPOSE:
	Calls the NI-488M program IBWAIT.
 CALLING SEQUENCE:
	status = IBWAIT( BOARD, MASK )
 INPUTS:
	BOARD	= Board number to write to (from IBFIND).
 RESTRICTIONS:
	The board number must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 MODIFICATION HISTORY:
	William Thompson, October, 1991.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibwait.pro)


IBWRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	IBWRITE
 PURPOSE:
	Calls the NI-488M program IBWRT to write data to a GPIB device.
 CALLING:
	ib_status = IBWRITE( DEVICE, OUTPUT, /CR,/LF )
 INPUTS:
	DEVICE	= Device number to write to (from IBFIND).
	OUTPUT  = Data to send to GPIB device.  Can be either a character
		  string or a binary array.
 KEYWORDS:
	/CR causes a Carriage Return to be appended to OUTPUT (first).
	/LF causes a Line Feed to be appended to OUTPUT (second if /CR).
 RESTRICTIONS:
	The device number must be set with the routine IBFIND.
 PROCEDURE:
	Calls NI-488M routine using CALL_EXTERNAL.
 HISTORY:
	William Thompson, October, 1991.
	Peter Kenny, March 1993:  Changed from PROC to FUNCTION
	F.V.1993: added keywords /CR and /LF.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ibwrite.pro)


IB_ERROR_MESS

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

 PURPOSE:
	Return the GPIB error message string.

 CALLING:
	error_message = IB_error_mess( ib_error )

 INPUTS:
	ib_error = 16 bit word = IBERR of NI-488M software.

 HISTORY:
	Frank Varosi, 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ib_error_mess.pro)


IMAGE_MATH_1

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	image_math_1
 PURPOSE:
	Subtract, add, multiply, or divide
	image_oper1.image into image_List(inums).image
		and return in new structured array.
	Called by prep/Sky_Sub_Gain.pro  and  lib/image_math_menu.pro.
 CALLING:
	image_results = image_math_1( image_List, image_oper1 )

 INPUT and OUTPUT:

 KEYWORDS:

 OUTPUT:
 EXTERNAL CALLS:
	function check_struct
	function image_struct
	pro copy_struct_inx
 HISTORY:
	Frank Varosi NASA/GSFC 1989
	F.V. 1991, added keyword INUMS=(image #s) and use copy_struct_inx.
	F.V. 1992, changed from just subtraction to all arithmetic ops,
		and added /REPLACE option to overwrite images with results.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/image_math_1.pro)


IMAGE_MATH_2

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	image_math_2
 PURPOSE:
	Subtract, add, multiply, or divide interpolated images
	into image_List(inums).image and return in new structured array.
	Interpolated images are computed between image_opers(0:1).image,
	using coordinates supplied by keywords TXIM= and TXOP=
	(it is assumed that TXIM coordinates are bracketed by TXOP).
	Called by prep/Sky_Sub_Gain.pro.
 CALLING:
	image_results = image_math_2( image_List, image_opers )

 INPUT and OUTPUT:

 KEYWORDS:

 OUTPUT:
 EXTERNAL CALLS:
	function check_struct
	function conv_ascii_time
	function image_struct
	pro copy_struct_inx
 HISTORY:
	Frank Varosi NASA/GSFC 1994

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/image_math_2.pro)


IMAGE_MATH_MENU

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	image_math_menu
 PURPOSE:
	Menu and selection interface to function image_math_1.
 CALLING EXAMPLE:
	image_math_menu, image_List
 INPUT and OUTPUT:
	image_List = structured array containing images and specifications
 EXTERNAL CALLS:
	function image_math_1
	function pick_images
	function select_image
	pro scale_images
	pro display_images
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1990, merge result with existing images instead of replacing.
	F.V. 1991, use new version of sky_subtract with INUMS=.
	F.V. 1992, use image_math_1 with all arithmetic operations: -/+* .

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/image_math_menu.pro)


IMAGE_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	image_struct
 PURPOSE:
	Define and return an array of image structures,
	defined by size of image and function headinfo
 CALLING:
	ims = image_struct( image, Magf, Nim )
 INPUTS:
	image = 2D array of type to be used in structure.
	Magf = magnification for image display.
	Nim = number of image structures to replicate and return.
 OUTPUTS:
	Function returns an array of image structures.
 EXTERNAL CALLS:
	function headinfo
 HISTORY:
	written, Frank Varosi 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/image_struct.pro)


INBAND_AVSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	InBand_AvSpec
 PURPOSE:
	Analyze a spectrum transmission vs. wavelength to produce
	specs Blue_50, Red_50, InBand_Transmission, Central_Wavelength, etc...
	Ringing is now calc. as max. abs. deviation from parabolic fit.
 CALLING:
	specs = InBand_AvSpec( Tavs )
 INPUT:
	Tavs = structure containing inband transmission averages within radius.
 KEYWORDS:
	WAVELENGTHS = wavelengths at which transmission is given.
	THRING =
 OUTPUTS:
	Function returns a structure containing specs (all scalars).
 EXTERNAL CALLS:
	funcs:	N_struct	Ringing		Trapez
 HISTORY:
	Written, Frank Varosi HSTX @ NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/inband_avspec.pro)


INBAND_FSPECS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	InBand_Fspecs
 PURPOSE:
	Analyze a stack of transmission vs. wavelength images to produce
	specs Blue_50, Red_50, InBand_Transmission, Central_Wavelength, etc...
 CALLING:
	specs = InBand_Fspecs( image_List )
 INPUT:
	image_List = structured array with tags containing transmission data.
 KEYWORDS:
	TPEAK_RADII = optional, to specify previous array of Tpeak vs. radii.
 OUTPUTS:
	Function returns a structure containing specs and images of variation.
 COMMON:
	common InBand_Fspecs, win_pavt	;window # for Tpeak vs. radius plot.
 EXTERNAL CALLS:
	funcs:	get_text_input	unique	scalar	deriv	N_struct   get_words
		wave_Tcenter	strconcat	Ringing_Map	InBand_AvSpec
	pros:	wave_Tmap	Peak_Avg_Trans	plot_Peak_Tr	plot_TranSpec
		get_window	Stats_in_Circle
 HISTORY:
	Written, Frank Varosi HSTX @ NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/inband_fspecs.pro)


INIT_DEVICES

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

 PURPOSE:
	Clear GPIB and devices, initializes devices that require it,
	replicates the gpib handle to all other device structures.

 CALLING:
	init_devices

 INPUT/OUTPUT:
	No explicit input/output, all info passed via common gpib, devices.

 KEYWORDS:
	/CLEAR_ALL : send the IBCLEAR to all devices, default is do not clear.

 EXTERNAL CALLS
	function N_struct
	function get_dev_num
	function IBSIC
	function IBCLEAR
	function IBWRITE
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 PROCEDURE:
	Check device types for Klingers and send FS01 initialization code.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/init_devices.pro)


INTEGRATE_CCD

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

 PURPOSE:
	Create widgets to interactively acquire
	the integration of data from the CCD detector.
	The integration time actually used can be set/changed.
	Assumes that the C-routines which read the CCD into shared memory
	are available.	Pro Integ_CCD_Event processes the widget events,
	including reading the image from shared memory.

 CALLING:
	Integrate_CCD

 KEYWORD INPUTS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the top level base of the
		new widget created by this procedure. If specified,
		this Integrate_CCD widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EXTERNAL CALLS:
	pro Xmanager
	pro widget_Location
	function map_CCD_mem
	function Widget_Lab_Text
 COMMON BLOCKS:
	common Integrate_CCD, CCD_widget
 PROCEDURE:
	Create and register the widgets with the Xmanager.
	Selection events are then processed by pro Integ_CCD_Event.
 HISTORY:
	Frank Varosi NASA/GSFC 1994.
	F.V. 10/94 : made read_CCD asynchronous with status widget timer.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/integrate_ccd.pro)


INTEGRATE_MAMA

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

 PURPOSE:
	Create widgets to interactively control (start/stop)
	the integration of data from the MAMA detector.
	The integration time can be selected by means of sliders, or entered.
	Assumes that the C-routines (xmacq) which asynchronously collect and
	bin the MAMA (x,y,t) data stream into shared memory image, are running.
	A status widget is set to generate events at regular intervals, then
	calling entries in external macmem.so to check the integration status. 
	Pro IntegMama_event processes the widget events,
	including reading the image (binned data) from shared memory.

 CALLING:
	Integrate_Mama

 KEYWORD INPUTS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the top level base of the
		new widget created by this procedure. If specified,
		this Integrate_Mama widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EXTERNAL CALLS:
	pro Xmanager
	pro widget_Location
	function map_macq_mem
 COMMON BLOCKS:
	common Integrate_Mama, mama_widget
 PROCEDURE:
	Create and register the widgets with the Xmanager.
	Selection events are then processed by pro IntegMama_Event.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/integrate_mama.pro)


INTEG_STATUS

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

 PURPOSE:
	Check the progress of MAMA detector integration. If not finished,
	then reset the timer of the status (label) widget of the
	integrate MAMA widget to trigger another status check event for later.

 CALLING:
	Integ_Status, mama_widget

 INPUT:
	mama_widget = structure variable containing all info
			about the pro Integrate_Mama widget.

 EXTERNAL CALLS:
	pro get_macq_status

 PROCEDURE:
	Get status of MAMA integration (Call_External in pro get_macq_status),
	check the elapsed time and compute current count rate,
	then update the status info of integration widget and
	set widget timer to trigger status check for later again,
	until the integration is completed.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/integ_status.pro)


KAXIS_DISABLE

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

 PURPOSE:
	Command a Klinger axis to disable/enable the holding torque.

 CALLING:
	state = kaxis_disable( axist )

 INPUT:
	axist = axis structure with fields: for status, state, 
		and the GPIB I/O handle of the Klinger device, etc.,
		(see gpib_dev_struct for structure definition).

 KEYWORDS:
	/ENABLE : Command the Klinger axis to enable the holding torque.
		(default is to send the disable command).

 OUTPUT:
	axist :	axist.disable = 1 if axis is disabled,
		axist.disable = 0 if axis is enabled.

	Function returns the value of axist.disable.

 EXTERNAL CALLS:
	function Klinger_Status
	function IBWRITE
 PROCEDURE:
	First check status of Klinger controller, if it's idle,
	then send command to disable/enable the holding torque of the axis.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/kaxis_disable.pro)


KLINGER_CONTROL

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

 PURPOSE:
	Create widget interface (GUI) to control the Klinger device axes
	by means of sliders, text entry, and buttons.

 CALLING:
	Klinger_Control, dev_name

 INPUT:
	dev_name = string, GPIB device name of Klinger controller,
		(default = "motion1").

 KEYWORDS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the base of the
		new widget created by this procedure. If specified,
		this Klinger_Control widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EXTERNAL CALLS:

	pro Klinger_Widget
	function get_dev_num
	pro Xmanager
	pro Klinger_Event

 COMMON BLOCKS:
	common gpib, devices
 PROCEDURE:
	Create a base, call pro Klinger_Widget to create widgets for each axis,
	and register the widgets with the Xmanager.
 HISTORY:
	Written, Frank Varosi HSTX @ NASA/GSFC 1993.
	Mod, F.V. 1994, added asynchronous CHECK of axis positions using /TIMER.
	Mod, F.V. 1994, inner part of code moved to pro Klinger_Widget.
	Mod, F.V. 1994, added buttons to HIDE/SHOW the widget.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/klinger_control.pro)


KLINGER_STATUS

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

 PURPOSE:
	Get the status of a Klinger device & axis.

 CALLING:
	Klinger_Status, axist

 INPUTS:
	axist = axis structure with fields: axis name, position, status,
		the GPIB I/O handle of the Klinger device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 OUTPUTS:
	axist = the status field of axis structure is updated with
		the current status of the Klinger device & axis.

	Function returns the value of axist.status:
			-1 : error,
			 0 : busy or unknown,
			 1 : idle and success.
			 2 : moving.
 EXTERNAL CALLS:
	function IBWRITE
	function IBREAD
	function IBCMD
 RESTRICTIONS:
	The Klinger controllers must have been initialized
	at a time when the axes were not moving with "FS01" to define the
	status format as the moving/stationary status message.
 PROCEDURE:
	A read is issued to Klinger controller and the response is checked.
	The status message should consist of the character "0" (48 decimal) 
	followed by a status byte between 65 and 72 if an axis is moving,
	or 64 (the character "@") if nothing is moving (idle).
	If it's anything else, then assume it is idle an issue a
	status request command "?" to the Klinger controller.
	If it's moving then return with busy or moving status.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/klinger_status.pro)


KLINGER_WIDGET

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

 PURPOSE:
	Create widget interface to control a particular Klinger device axis
	by means of sliders, text entry, and buttons.

 CALLING:
	Klinger_Widget, dn, axn

 INPUTS:
	dn = device number (refering to structure in common gpib, devices).
	axn = axis number (refering to structure devices.axis).

 KEYWORDS:
	BASE = id of the device base widget, otherwise assume this routine
		has been called and axis base already exists.
	SLIDER_INCREM = optional increment for slider, default=1.

	/HIDE : hide all controls, just create a button to show if desired.
	/SHOW : show all controls.
	/INCREMENTAL : create widgets for incremental moving mode (no slider).
	/DISABLE : send the axis disable command to Klinger and hide controls.
		Another call with DISABLE=0 will automatically enable the axis.

 EXTERNAL CALLS:
	function read_device
	function CW_pdmenu
	function kaxis_disable
 COMMON BLOCKS:
	common gpib, devices
 HISTORY:
	Written: Frank Varosi HSTX @ NASA/GSFC 1993.
	Mod, F.V. 1993, added OPTIONS: Find, Reset, and Return.
	Mod, F.V. 1994, added OPTIONS: Incremental, Hide, and Disable.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/klinger_widget.pro)


LASSO_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Lasso_images
 PURPOSE:
	Allow user to pick images with rubber box to Lasso corners of images.
 CALLING:
	inums = Lasso_images( image_List )
 INPUTS:
	image_List = structured array with fields giving Location of images.
 KEYWORDS:
	/MARK to identify selections by highlighting image borders.
	WINDOW = (optional) window # in which images are displayed,
		default = image_List(0).windo
 RESULTS:
	Returns indices (unique subscripts) of selections from image_List,
	or returns (-4) if aborted by RIGHT button.
 EXTERNAL CALLS:
	function N_struct
	function box_create
	function unique		(to eliminate duplicates)
	pro printw
	pro border_image
 HISTORY:
	Written, Frank Varosi HSTX @ NASA/GSFC 1989.
	F.V. 1991, added check to make chosen images all in same window.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/lasso_images.pro)


LEVEL_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Level_info
 PURPOSE:
	Called by pro Approx_Xsecs.
 CALLING:
	Levinfo = Level_info( ELevs [, title ] )
 INPUTS:
	ELevs = structured array of energy Levels.
 OUTPUTS:
	title = string, to be used as title for the results.

	Function returns string array of info about Levels.

 EXTERNAL CALLS:
	function get_words
	function strconcat
 PROCEDURE:
	Slightly different info for SuperLevels.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/level_info.pro)


LOAD_FITS_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Load_FITS_image
 PURPOSE:
	Read an image from a FITS file by
	inquiring user via menu for which file to read,
	and then add it to the pool of mosaic images.

 CALLING:
	Load_FITS_image, imos, mosaic, change, DIR=direct, NAME=name

 KEYWORD INPUTS:

	DIRECTORY_PATH = string array of directory names forming a path
			to the FITS files. Sub-directories with names
			ending in "-folder" are then also searched.

	NAME = optional string specifying exactly the name of FITS file
		to be restored ( extension  *.fits is assumed).
		In this case there is no menu selection required.

 OUTPUTS:
	imos = integer, the insertion index of image in pooled memory.
	mosaic = 2-D image array read from file.
	change = integer flag = 1 if image successfully inserted.

 EXTERNAL CALLS:
	function VarType
	function N_struct
	pro contour_markset
	pro sxopen
	function sxread
	function readfits
	function sxpar
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common FITS_SDAS, fheaders
 PROCEDURE:
	Uses the old IDL intrinsic "wmenu" function to present file choices,
	then call function readfits or pro imgread to read the file,
	then call pro restore_mosaicf,/INSERT to put the data into pool memory.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.
	F.V.1999, use pro IMGread for STSDAS files instead of sxread.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/load_fits_image.pro)


LOAD_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Load_image
 PURPOSE:
	Read header & image of MAMA data from a FITS file.
	The FITS type of header info is placed into structure header.

 CALLING:
	Load_image, filename, header, image, head_fits

 INPUT:
	filename = name of file to read  (string).

 OUTPUTS:
	header = the image header info placed in structure variable.
	image = the image data  (2-D array).
	head_fits = the header from FITS file.

 EXTERNAL CALLS:
	pro fxread
	function head_from_fits
	function get_words
	function dir_path
	function substwid

 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/load_image.pro)


LOOK_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Look_images
 PURPOSE:
	Look at the average/total flux in a box/circular aperature
	interactively chosen by mouse, intersecting a stack/mosaic of images.
	Mean and st.dev. of fluxes in aperature are printed
	or plotted as a spectrum with optional error bars.
	Type and size of aperature is chosen from menus,
	press Left button to select box/circle, right button to quit,
	middle button can be pressed anytime to get menu again.
 CALLING:
	Look_images, image_List, images
 INPUTS:
	image_List = array of structures containing images and information.
	images = optional, pooled-array containing the image data, if not with
		the structure, then image_List has pointers into this array.
 KEYWORDS:
	/PLOT_FLUXES causes fluxes to be plotted as a spectrum
		(instead of printing), assumes wavelength units are nanometers.
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	funcs:	 check_struct	check_Bin_Fact
		select_image	get_words	scalar
	pros:	box_draw	box_erase	border_images
		Look_image	plot_spectrum
 COMMON BLOCKS:
	common Look_images, wavelens, fluxes, stdevs, fmin, fmax, groups
	common Look_images0, x0, y0, box_size, npixels, sigmas
	common Look_images1, spline_tension, xLog, yLog, errbars, spectitle
	common plot_spectrum, plot_window
 PROCEDURE:
	Call pro Look_image to get/print fluxes for each image intersected,
	and call pro plot_specturm if plot is requested.
	If circular aper. use the XOR graphics mode to plot circle.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1990, modif to also work on {mosaic_List} type of structure.
	F.V. 1991, modif to use Locx & Locy (exact coordinates of image corner).
	F.V. 1992, added option to plot fluxes as a spectrum or time series.
	F.V. 1993, use GROUPS keyword of plot_spectrum to get multi-Line-graphs.
	F.V. 1994, added menu_option to toggle between PLOT/PRINT modes.
	F.V. 1996, new version for use with TOFU for TUT image analysis.
	F.V. 1997, mod to read Perkin-Elmer filter data on overplot or subtract.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/look_images.pro)


LOOK_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
	Select box interactively and print average flux of mosaic image in box.
 CALLING:
	Look_mosaic, mosaic_spec, mosaic_image, ORIGINAL=mosaic_orig
 INPUT & OUTPUT:
	mosaic_spec = structure with contour display specifications.
 EXTERNAL CALLS:
	pro box_draw2
	pro box_erase2
	pro Look_image
 HISTORY:
	Frank Varosi NASA/GSFC 1990.
	F.V. 1997, use mosaic image as processed by contour_setup,
		and print correct (x,y) pixel coordinates of box/circle center.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/look_mosaic.pro)


MAGNIFY_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	magnify_images
 PURPOSE:
	Copy image_List to a new structure and magnify the byte-scaled images.
	Since IMSCALED is different size, must handle it separately:
	going from magnification 1 we can use IDL rebin,
	going from other magnification it is faster to rescale and rebin.
	Because of bug previous to IDL v.2.0.11 concerning sub-structure with 
	strings, must handle INFO tag separately in such case on Sun386i.
 CALLING:
	New_image_List = magnify_images( image_List )
 INPUTS:
	image_List = array of structures containing image locations & info,
		and the images scaled into byte arrays for display.
 KEYWORDS:
	MAGF = desired new magnification (0.5 to 4), default is ask with menu.
	/DISPLAY : display the new images in resized window.
 OUTPUTS:
	Function returns new image_List structure containing magnified
	byte-scaled images for display.
 EXTERNAL CALLS:
	pro copy_struct
	pro scale_images
	function check_struct
	function set_zoom
	function image_struct
 PROCEDURE:
	Call pro copy_struct and then pro scale_images
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1991 mod to use pro screen_coordin to get (xmin,xmax,ymin,ymax),
	and check for unsmoothed edges, both also done in pro scale_images.
	F.V. 1991 mod to handle Magnification < 1.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/magnify_images.pro)


MAGNIFY_INVEN

[Previous Routine] [Next Routine] [List of Routines]
 copy image_inven to new structure and magnify the scaled for display images.
  since IMSCALED is different size, must handle it separately:
	going from magnification 1 can use IDL rebin,
	going from other magnification it is faster to rescale and rebin.
  since INFO is a sub-structure with strings, must handle it separately
				(because of bug previous to IDL v.2.0.11)
 Frank Varosi NASA/GSFC 1989.
 F.V. 1991 mod to handle Magnification < 1.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/magnify_inven.pro)


MAGNIFY_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 mosaic_List = structure array to keep track of it all (input/output).
 mosaic_images = original mosaic image data (input).
 mosaic_imscaled = mosaics scaled for displaying (output).
 Frank Varosi NASA/Goddard 1990-91.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/magnify_mosaics.pro)


MAKE_RAW_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	make_raw_mosaic
 PURPOSE:
	To package a collection of images (all the same size) into
	a Raw_Mosaic structure, suitable for use in the MOSAIC system.
	This should be called at the main IDL level and must use
	the variable name "raw_mosaic" as in the calling example.
	Then the MOSAIC software will operate on this raw_mosaic variable.
	Note that once the raw_mosaic structure is created with given
	image size, you cannot change the image size of the structure
	without exiting and reentering IDL, and you cannot save/restore
	a mixture of structure sizes simultaneously (a limitation which
	may be eliminated soon).

 CALLING:
	raw_mosaic = make_raw_mosaic( images, NAMES=names )

 INPUTS:
	images = 3-D array of 2-D images, i.e. an array( nx, ny, Nimage ).

 KEYWORDS:

	MAGF = desired image display magnification (can be changed later),
		allowed values = 0.5, 1, 2, 3, 4,  default = 1.

   Other keywords are optional string arrays with same # elements as # images:

	NAMES = name identifying each image.
	TIMES = acquisition time of day for each image.

   Following keywords can be just one string, which will set them all the same,
   or the same # elements as # images:

	DATES = date of each image.
	OBJECTS = object observed in each image.
	HISTORY = history of processing or comment about each image.
	WAVELENGTHS = wavelengths or filters used in each observation.

 RESULT:
	An array of structures containing images, byte-scaled images,
	and the names if supplied. Other info can be added to fields,
	to see fields (tags) of structure:  help, /st, raw_mosaic   .
 EXTERNAL CALLS:
	function image_struct
	pro min_max_set
	pro scale_images
 PROCEDURE:
	Loop thru images in raw_mosaic and add into big mosaic array,
	also accumulating the total_weight array, then divide by it.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/make_raw_mosaic.pro)


MAP_CCD_MEM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	map_ccd_mem
 PURPOSE:
	Map to shared memory of ccdacq (CCD data-acquisition program)
 CALLING:
	status = map_ccd_mem()

 INPUT:	None

 OUTPUT:
	Function returns status:  0 = failure,  1 = success.

 RESTRICTIONS:
	ccdacq must be started as BACKGROUND process (ccdacq &) outside of IDL.
 PROCEDURE:
	Call_External is used to execute entry point _cacq_map in ccdmem.so
	(.so = shareable object library) to gain access to shared memory.
 HISTORY:
	Software in ccdacq and ccdmem.so written by Peter Kenny NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/map_ccd_mem.pro)


MAP_MACQ_MEM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	map_macq_mem
 PURPOSE:
	Map to shared memory of xmacq (MAMA data-acquisition program)

 CALLING:
	status = map_macq_mem()

 INPUT:	None

 OUTPUT:
	Function returns status:  0 = failure,  1 = success.

 RESTRICTIONS:
	xmacq must be started as BACKGROUND process (xmacq &) outside of IDL.
	Then xmacq runs in the background to read raw MAMA data,
	continually updating an image in its memory,
	which can be shared with other processes.
 PROCEDURE:
	Call_External is used to execute entry point _mac_map in macqmem.so
	(.so = shareable object library) to gain access to shared memory.
 HISTORY:
	Software in xmacq and macqmem.so written by Peter Kenny NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/map_macq_mem.pro)


MAP_SOURCE_MARKS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	map_source_marks
 PURPOSE:
	Map the source marks to a particular mosaic image_spec using the
	relative arcsecond offsets in the source marks structure.
 CALLING:
	new_sources = map_source_marks( sources, IMAGE_SPEC=image_spec )
 INPUTS:
	sources = structured array of source marks info,
		must have arcsecond offsets defined.
 KEYWORDS:
	IMAGE_SPEC = structure with display specifications for:
			rotation, coordinate system, window number.
	IN_IDENT = string, identifier to select which source marks are mapped,
		default is the first id in array of source marks.
 OUTPUT:
	Function returns new structured array of sources with
	new normalized positions for marks corresponding to image_spec.
 EXTERNAL CALLS:
	pro rotate_coordin
	function N_struct
	function VarType
 COMMON BLOCKS:
	None.
 PROCEDURE:
 HISTORY:
	written: Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/map_source_marks.pro)


MATCH_APPLY

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1989.
F.V. 1991, mod to keep scaling type at current setting.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_apply.pro)


MATCH_GROUPS

[Previous Routine] [Next Routine] [List of Routines]
 match intensities of images in a group with those of another group.
 Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_groups.pro)


MATCH_GRP_LLSQ

[Previous Routine] [Next Routine] [List of Routines]
 match intensities of images in groups using Linear Least-squares of 
  overlapping pixels from the mosaic group averages.
 Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_grp_llsq.pro)


MATCH_HISTOGRAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	match_histogram
 PURPOSE:
	Match intensities of images using Linear transformations obtained
	interactively by comparing Histograms of corresponding regions/overlap.
 CALLING:
	LT_coefs = match_histogram( image_List, imod, icomp, /OVERLAP )
 INPUTS:
	image_List
 KEYWORDS:
	/OVERLAP
 OUTPUTS:
	image_List
	imod
	icomp
 EXTERNAL CALLS:
	function select_image
	function check_struct
	function select_region
	pro overlap_images
	function histo
	function accumulate
	pro plot_histograms
	function scale_image
 COMMON BLOCKS:
	common image_scale, minval, maxval, topval, scale_type, minLog
	common image_scale2, smooth_flag
	common histog_plot, plot_window, minhv, maxhv, maxhd
	common match_histogram, accumulative, LT_mean
 PROCEDURE:
 HISTORY:
	written: Frank Varosi NASA/GSFC 1989
	F.V.1990, added options to match overlap or select comparision region.
	F.V.1991, added option to Pop images during selection.
	F.V.1991, added options on input:
			"RAN" to set X-axis range on histogram plot,
			"LOG" or "LIN" to set Y-axis type,
			"BIN" to change # of histogram bins.
	F.V.1992, added option "ACC" to work with the accumulative histograms,
			"NORM" : to use the normal histograms (default).
			"MEAN" : factor * (image - mean) + mean + offset,
			"ZERO" : factor * image + offset (the default).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_histogram.pro)


MATCH_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	match_images
 PURPOSE:
	Match intensities of overlapping images using Linear transformations.
 CALLING:
	match_images, raw_mosaic
 INPUTS:
	raw_mosaic = structured array of images (image_List type structure).
 OUTPUTS:
	None explicit. After estimating and applying Linear transform, 
	the images in raw_mosaic are rescaled and redisplayed.
 EXTERNAL CALLS:
	pro match_LinearLsq
	pro match_mean_vari
	pro match_twopoint
	function match_histogram
	pro match_apply
	pro mosaic_task		...and others...
 COMMON BLOCKS:
	common match_images, ifix, imagef, groupi
	common match_images2, exclude_region
 PROCEDURE:
	Linear transformations are computed by:
		comparing the means and variances of image overlaps, or,
		interactively comparing Histograms of image overlaps, or,
		Linear Least-squares  of image overlaps, or,
		comparing Flux at two points (total flux in boxes).
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1991 added match means and variances option.
	F.V. 1994 added Exclude Region option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_images.pro)


MATCH_INTERP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	match_interp
 PURPOSE:
 CALLING:
	match_interp, raw_mosaic, inums, Factors, Offsets
 INPUTS:
	raw_mosaic = 
 KEYWORDS:
	/FACTOR_MATCH
	/OFFSET_MATCH
 OUTPUTS:
	inums =
	Factors =
	Offsets = 
 EXTERNAL CALLS:
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_interp.pro)


MATCH_LEVELS

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_levels.pro)


MATCH_LINEARLSQ

[Previous Routine] [Next Routine] [List of Routines]
 match Levels of images using Linear Least-squares of overlapping pixels.
Frank Varosi NASA/GSFC 1989
F.V.1991, mod to using smoothing before LLsq fit.
F.V.1991, added option to Pop images while selecting image to fix.
F.V.1991, changed smoothing to ALL_PIXELS using filter_image.
F.V.1992, use /ITERATE (approx.gaussian) when smoothing using filter_image.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_linearlsq.pro)


MATCH_MEAN_VARI

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	match_mean_vari
 PURPOSE:
	Match Levels of images by matching the means & variances
	of pixels in the overlapping part of images.
	User selects an image to keep fixed, the reference for matching others.
 CALLING:
	match_mean_vari, raw_mosaic, image_nums, Factor, offset
 INPUTS:
	raw_mosaic = structured array of images (image_List type structure)
			or image pointers (mosaic_List type structure).
	ifix =
	imagef =
	groupi =
 KEYWORDS:
	DATA_IMAGES = pooled-array containing the actual image data,
		in such case raw_mosaic has structure {mosaic_List}
		containing pointers to the image data.
		(allows this routine to match a mosaic of mosaic images)
	IMSCALED = pooled-array containing images scaled for displaying.
	/MEANS_OFFSET : match means with offsets only.
	/MEANS_FACTOR : match means with factors only (overrides).
 OUTPUTS:
	image_nums = indices of the images matched.
	Factor = array of factors to apply to make images match.
	offset = array of offsets to add to images (after factors).
	ifix =
	imagef =
	groupi =
 EXTERNAL CALLS:
	function select_image
	function pop_image
	function get_image
	function filter_image
	function stdev
	pro border_images
	pro overlap_images
 COMMON BLOCKS:
	common image_scale2, smooth_width
 PROCEDURE:
	Select point in an image, get all overlaps and compute
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991 (adapted from match_LinearLsq).
	F.V.1992, use /ITERATE (approximating Gaussian PSF convolution)
			when smoothing by function filter_image.
	F.V.1993, ingore_minval (no-data-flag) when matching mosaic images.
	F.V.1994, /EXCLUDE_REGION keyword option to exclude some pixels.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_mean_vari.pro)


MATCH_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	match_mosaics
 PURPOSE:
	Match intensities of overlapping mosaics using Linear transformations.
 CALLING:
	match_mosaics, mosaic_List, mosaic_data, mosaic_scaled
 INPUTS:
	mosaic_List = array of structures containing image locations
		and pointers into the arrays: mosaic_data, mosaic_scaled.
	mosaic_data = array of images, stored contiguously as data.
	mosaic_scaled = array of image data scaled into bytes for display.
 OUTPUTS:
	Same as inputs (modified by user choices).
 EXTERNAL CALLS:
	pro match_mean_vari
	pro mosaic_task
			and many more.
 COMMON BLOCKS:
	common match_mosaics, mfix, mosaicf, groupm
 PROCEDURE:
	Big CASE statement, and pro mosaic_task gets leftovers.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991 (adapted from match_images).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_mosaics.pro)


MATCH_MOS_APPLY

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi NASA/GSFC 1991 (adapted from match_undo images).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_mos_apply.pro)


MATCH_MOS_UNDO

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1991 (adapted from match_undo images).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_mos_undo.pro)


MATCH_SKY_IMAGE

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_sky_image.pro)


MATCH_TWOPOINT

[Previous Routine] [Next Routine] [List of Routines]
 Match intensities of images based on
 mean-values of pixels in boxes at 2 selected points.
 The 2 values are then used to define Linear/Affine transformations.
Frank Varosi NASA/GSFC 1989
F.V. 1991, mod to using smoothing before LLsq fit.
F.V. 1991, added option to Pop images while selecting image to fix.
F.V. 1991, added choice of box size for each point.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_twopoint.pro)


MATCH_UNDO

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1989.
F.V. 1991, mod to keep scaling type at current setting.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/match_undo.pro)


MERGE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	merge_images
 PURPOSE:
	Merge two image List structure arrays, making them same magnification.
 CALLING:
	merged_List = merge_images( image_List, more_List )
 INPUT:
	image_List = structure array of images and info.
	more_List = second structure array of images and info.
 KEYWORDS:
	/NEW places second List to avoid overlap with first List when displayed.
 OUTPUTS:
	Function returns the merged List structure array,
	display magnification of images is that of first List.
 EXTERNAL CALLS:
	function check_struct
	function magnify_images
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/merge_images.pro)


MERGE_INVEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	merge_inven
 PURPOSE:
	Merge two image inventory structure arrays,
	making them same magnification and organized in matrix display format.
 CALLING:
	inventory = merge_inven( image_inven, more_inven )
 INPUT:

	image_inven = structured array of images, existing.
	more_inven = structured array of images, to be merged with existing.
 KEYWORDS:
	SPACING = (default is 12).
 OUTPUT:
	Function returns merged structured array of images.
 EXTERNAL CALLS:
	function check_struct
	function organize_images
	function magnify_images
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1996, modified for TOFU.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/merge_inven.pro)


MERGE_XSECS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Merge_Xsecs
 PURPOSE:
	Merge the photo-ionization cross-sections for Levels in given
	SuperLevel group. First x-secs are interpolated (in Log-Log space)
	onto common frequency grid and then summed using statistical weighting.

 CALLING:
	Merge_Xsecs, ELevs, freq, xsec, GROUP=group

 INPUT:
	ELevs = array of structures with tags for energy of level,
		quantum numbers, and handles pointing to
		full photo-ionization cross-sections.

 KEYWORDS:
	GROUP = group number (corresponding to a SuperLevel) to merge.

 OUTPUTS:
	freq = frequencies (Log base 10) at which merged xsec is defined.
		Note that frequencies are absolute, not relative to edge-freq.

	xsec = statistically merged photo-ionization cross-section.
		Note that values are no longer Log10 so that
		summation is done using actual values, and divison by
		the SuperLevel stat-weight is still needed to get averages.

 EXTERNAL CALLS:
	function N_struct
	function unique
	pro Modion_Status
 PROCEDURE:
	Straightforward, see code.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1997, fixed bug that was limiting nfreq to 16-bits.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/merge_xsecs.pro)


MINMAX_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
Compute mins & maxes using median and/or smooth filtered versions of images.
Keyword INUMS=subscripts to select images.
Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/minmax_images.pro)


MIN_MAX_SET

[Previous Routine] [Next Routine] [List of Routines]
Recompute mins & maxes using median and/or smooth filtered versions of images.
Frank Varosi NASA/GSFC 1991.
F.V. 1991, added arg. image_data so it works for {Mosaic_List} structures,
					as well as {Image_List} structures.
F.V. 1991, added keyword INUMS=subscripts to select images.
F.V. 1992, added /SIGMA_FILTER option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/min_max_set.pro)


MODEL_EFFICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Model_Effics
 PURPOSE:
	Fit measured grating groove efficiency as a function of 
	wavelength to determine the blazing angle and maxmum groove efficiency.
	It uses a non-linear least-squares fitting procedure CURVEFIT.
	A reference for the fitting function can be found in
	"Echelle Efficiency and Blaze Characteristics" by M. Bottema,
	in SPIE Vol 240 page 171.

 CALLING:
		Model_Effics, eff_calc
	or:	Model_Effics, EFFICS=effics_file
	or:	Model_Effics
	which will allow selection of save file via PickFile.
 INPUTS:
	eff_calc = array of structures, results from pro Calc_Effics.
			Otherwise use keyword EFFICS = "idl_save_file".

 KEYWORDS:
	EFFICS = filename of IDL/XDR save-file containing
			the efficiency structure array.

		If no input args. given, inquires for filename with PickFile.

	/NOWEIGHT : if set, no weight in the fitting

 OUTPUTS:
	blaze = blazing angle of theoretical fit.
	bwave = wavelength of maximum efficiency.

	Two graphical plots:
		the groove efficiency, theory fit, and STIS spec.
		the absolute efficiency, theory fit, and STIS spec.
 EXTERNAL CALLS:
	pro Fit_Eff	(which calls curvefit)
	pro groove_eff	(theoretical model eq.)
	pro Set_Grat_Parms
	pros psport, psclose, print_graphics
	functions PickFile, yes_no_menu, get_text_input, check_dir, substwid
 HISTORY:
	Written: L.K. Huang NASA/GSFC 1993.
	Mod: Frank Varosi 1994, to use effic. structure from OPTICON results.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/model_effics.pro)


MODION

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

 PURPOSE:
	Create a widget to interactively model an ion/atom.
	Creates compound draw widgets for displaying
	the energy level diagram and its axes of SLP and Energy.
	Data can be read from TOPBASE files, energy levels are displayed,
	a subset of levels can be selected, transitions and info can be
	written to files for use in stellar radiative transfer models.
	Events are handled by pro Modion_Event.
 CALLING:
	Modion

 KEYWORDS:
	XZOOM, YZOOM = maximum zoom factors for x & y axes, default: 4 & 8.

	XSIZE, YSIZE = size of the viewable scrolled region of draw widget,
			default: 512 by 512 pixels.

	XPOS, YPOS = optional, desired position on screen of the widget.

 COMMON BLOCKS:
	common modion_Widget, modion_widget
	common modion_Info, ion_info
 EXTERNAL CALLS:
	pros:	widget_Location	Xmanager	Modion_SetFile	Display_ALL
	funcs:	CW_Bgroup	CW_pdmenu	CW_Draw_Axes	widget_Tree_Map
 PROCEDURE:
	Create the modion_widget structure variable.
	Use function CW_Draw_Axes to create compound draw widgets
	for the energy level diagram and its axes of SLP and Energy.
	Realize and register the widgets with the Xmanager.
	Events are then processed by pro Modion_Event (above in this same file).
 HISTORY:
	written: Frank Varosi HSTX @ NASA/GSFC 1995.
	F.V.1995, generalized the x-y zoom features, added SuperLevels.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion.pro)


MODION_CURSOR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_Cursor
 PURPOSE:
	Process cursor motion/button events of draw widget in modion widget.
	Called by pro Modion_Event. If selection mode is off,
	just display the SLP and Energy of cursor position.
	Otherwise, select/unselect the nearest energy level in diagram
	if mouse button is clicked, or if button is held down,
	draw a box in order to select an area of energy level diagram.
 CALLING:
	Modion_Cursor, event
 INPUTS:
	event = structure variable defining the widget event.
 OUTPUTS:
	No explicit outputs, common blocks are modified.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
	common modion_Coord, Coord_info
 EXTERNAL CALLS:
	pros:	Select_Levels	Conv_Loc_SLPE	Box_erase	Box_draw
		Display_ALL	Cursor_Info
	funcs:	Find_Levels	Find_SupLev
 PROCEDURE:
	Check the draw event.type in case statement:
		0 = start selection mode
		1 = end selection mode
		2 = draw rubber-band Lasso-box if in selection mode,
			else
		display cursor SLP and Energy coordinates, or nearest Level.
	Check modion_widget.mode (selection mode):
		0 = "OFF (zoom & pan mode)"
		1 = "Select / Unselect Levels"
		2 = "Merge / De-merge Levels"
	If selection mode is OFF and cursor is dragged then a rubber-band
	box is drawn, which is zoomed in upon release of mouse button.
	If selection mode is ON (>0) and cursor is dragged,
	then draw a box and select energy levels within,
	else if button is just clicked then select/unselect the
	nearest energy level (both cases use pro Select_Levels).
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1995, find nearest SuperLevel first (if in cursor mode).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_cursor.pro)


MODION_HARDCOPY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_Hardcopy
 PURPOSE:
	Create hardcopy of current ion/atom model Grotrian diagram.
 CALLING:
	Modion_Hardcopy, HC_request
 INPUTS:
	HC_request = string array (optional).
 OUTPUTS:
	Writes graphics to a file.
 COMMON BLOCKS:
	common Modion_Widget, modion_widget
	also see: modion_common.pro
 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_hardcopy.pro)


MODION_HOMEVIEW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_HomeView
 PURPOSE:
	Erase the draw widgets, set view to (0,0), set zoom factor to unity
	and redisplay everything.
 CALLING:
	Modion_HomeView
 INPUTS:
	None.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
 EXTERNAL CALLS:
	function N_struct
	pro Display_All
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_homeview.pro)


MODION_RESTORE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_Restore
 PURPOSE:
	Restore work from an IDL-XDR file. User can pick file from a List.
	Called by pro Modion_Event.
 CALLING:
	Modion_Restore
 INPUTS:
	None.
 OUTPUTS:
	All to common blocks.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
	 and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	pros:	Modion_SetFile	Set_Coord	Set_Colors	Modion_HomeView
	funcs:	N_struct	yes_no_menu	PickFile
		Handles_Unpool	Handles_Free
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1995, mod to use new function Handles_Unpool.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_restore.pro)


MODION_SAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_Save
 PURPOSE:
	Save current work to an IDL-XDR file. User is prompted for filename.
 CALLING:
	Modion_Save
 INPUTS:
	All from common block.
 KEYWORDS:
	/DEFAULT_FILE : then user is not queried for filename, use default name.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function dir_path
	function Handles_Pool.
	pro Modion_SetFile
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1995, mod to use new function Handles_Pool.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_save.pro)


MODION_SETFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_SetFile
 PURPOSE:
	Set the filename of the IDL-XDR file in which current modion structure
	variables are stored, and display the widget info label with filename.
 CALLING:
	Modion_SetFile, filename
 INPUTS:
	filename = string, name of IDL-XDR save file in which current
		modion structure variables are stored.
 OUTPUTS:
	All to common blocks.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
	common modion_Info, ion_info
 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_setfile.pro)


MODION_STATUS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Modion_Status
 PURPOSE:
	Display status informational message for the MODION widget,
	and also print the info in the IDL "message" style to standard output.
 CALLING:
	Modion_Status, status_info
 INPUTS:
	status_info = string, status informational message.
 KEYWORDS:
	/CLEAR : just clear the status widget area and return.
	/BELL : send the ASCII bell control character to terminal.
	/ONLY : only set the status widget area, do not print to terminal.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	common modion_Widget, modion_widget
 EXTERNAL CALLS:
	function VarType
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/modion_status.pro)


MONOCHROM_CNTRL

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

 PURPOSE:
	Create widget interface to control the MonoChromator & Filter-wheel
	by means of sliders and buttons.

 CALLING:
	MonoChrom_Cntrl, dev_names

 INPUT:
	dev_names = string, GPIB device name of MonoChromator interface
		and Filter-wheel interface (default = ["monochrom","filter"]).

 KEYWORDS:

	GROUP = The widget ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the base of the
		new widget created by this procedure. If specified,
		this MonoChrom_Cntrl widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EXTERNAL CALLS:
	function get_dev_num
	function read_device
	function strconcat
	function Widget_Lab_Text
	function CW_Bgroup
	pro Xmanager
	pro MonoChrom_Event

 COMMON BLOCKS:
	common gpib, devices
 PROCEDURE:
	Create and register the widgets with the Xmanager.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.
	Mod, F.V. 1994, added asynchronous CHECK of axis positions using /TIMER.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/monochrom_cntrl.pro)


MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic
 PURPOSE:
	Create a Raw Mosaic out of collection of images (all same size).

 CALLING:
	mosaic, Raw_Mosaic, inventory, Sky_Subs, mosaic, Return_Task

 INPUTS and OUTPUTS:

	Raw_Mosaic = structured array of images, to be averaged/spliced.
	inventory = structured array of images, from pro Prep (optional).
	Sky_Subs = structured array of images, from pro Prep (optional).

 OUTPUTS:
	mosaic = image result of averaging/splicing the raw mosaic (optional).
	Return_Task = string indicating next desired major function (optional).

 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common dir_names, dirinv, dirmos_raw, dirmos_aver
	common mosaic_colors, mosaic_colors
						and many more...
 EXTERNAL CALLS:
	pro restore_images
	pro display_images
	pro centroid_images
	pro align_images
	pro save_images
	pro export_import
	pro mosaic_correls
	pro mosaic_coordin
	pro mosaic_offsets
	pro mosaic_task		(handles most generic operations)
	function create_mosaic
	function calc_im_stack
	function DeConv_images
				and many more...

 PROCEDURE:	Loop around menu and big CASE statement.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1990, converted main program into this procedure.
	F.V. 1991, added options: mosaic by correlations, align by centroids.
	F.V. 1992, added options: show statistics, plot profiles.
	F.V. 1994, call mosaic_correls for more cross-correlation options.
	F.V. 1994, added options: compute on stack of images, and DeConvolution.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic.pro)


MOSAIC_COORDIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_coordin
 PURPOSE:
	Select an image (LEFT button) and re-Locate it (LEFT or MIDDLE button)
	while displaying relative coordinates as cursor is moved:
		( x-horizontal, y-vertical ) arcseconds offsets.
 CALLING:
	mosaic_coordin, Raw_Mosaic, images
 INPUTS:
	Raw_Mosaic = structured array containing image locations, and
		either the scaled images, or pointers into the array: images.
	images = optional array of scaled images, pointed to by Raw_Mosaic.
 OUTPUT:
	Raw_Mosaic = structured array containing new image locations.
 EXTERNAL CALLS:
	function check_struct
	function select_image
	function pop_image
	function get_imscaled
	pro display_image
	pro push_image
	function stack_image
 COMMON BLOCKS:
	common array_scale, ArcSec_Pix_x, ArcSec_Pix_y
	common mosaic_options, border_imflag, border_grflag
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1991, added option to Pop images with middle button.
	F.V. 1993, check for and use new structure with arcs_pixel field.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_coordin.pro)


MOSAIC_CORRELS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_correls
 PURPOSE:
	Choose and call specific methods to automatically create
	raw mosaics of images by using maximal cross-correlation 
	to determine optimal image offsets.
 CALLING:
	mosaic_correls, image_List, cross_correl
 INPUTS:
	image_List = array of structures containing image locations,
		and the image data and scaled byte arrays for display.
		Optionally, pointers into the arrays "images" and "imscaled".
 KEYWORDS:
	IMAGES = optional pool-array of image data, pointed to by image_List.
	IMSCALED = optional pool-array of scaled images for displaying.
 OUTPUT:
	image_List = array of structures containing new image locations.
	cross_correl = array of structures containing the
		maximum cross-correlation values found, optimal offsets,
		and names of images. (optional output, FYI).
 SIDE_EFFECTS:
	The images displayed in window are moved around according to new Locs,
	and structure array cross_correl is saved to file cross_correl.idl_save
 EXTERNAL CALLS:
	pro mosaic_correl_1
	pro mosaic_corrtime
	function next_word
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_correls.pro)


MOSAIC_CORREL_1

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_correl_1
 PURPOSE:
	Automatically create mosaic of images by computing cross-correlation 
	functions and finding optimal position from maximum cross-correlation.
	User selects one image to be the start of mosaic (the anchor)
	to which other user selected images are cross-correlated and moved.
 CALLING:
	mosaic_correl_1, image_List, cross_corr
 INPUTS:
	image_List = array of structures containing image locations,
			and the image data and scaled byte arrays for display.
			Optionally, pointers into the pool-arrays given
			by keywords IMAGES and IMSCALED.
 KEYWORDS:
	IMAGES = optional pool-array of image data, pointed to by image_List.
	IMSCALED = optional pool-array of scaled images for displaying.
	THRESHOLD = image pixel values less than threshold are set to zero,
			so are not used in correlation (default = 0.1).
	BACKGROUND = scalar value of constant background to subtract from
			all images (default=0).
	/PRINT_FLAG causes cross-correlation computation results to be printed.
 OUTPUTS:
	image_List = array of structures containing new image locations.
	cross_corr = array of structures containing the
		maximum cross-correlation values found, optimal offsets,
		and names of images. (optional output, FYI).
 SIDE_EFFECTS:
	The images displayed in window are moved around according to new Locs.
 EXTERNAL CALLS:
	funcs:	select_image, pick_images,
		get_image, modify_image, pop_image
		select_number, yes_no_menu, next_word,
	pros:	push_image, screen_coordin, correl_optimize
 COMMON BLOCKS:
	common mosaic_options, bimflag, bgrflag
	common array_scale, ArcSec_Pix_x, ArcSec_Pix_y	;plate scale of array.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.
	F.V.1992, added normalization (max=1) option.
	F.V.1994, added constant Background subtraction option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_correl_1.pro)


MOSAIC_CORREL_2

[Previous Routine] [Next Routine] [List of Routines]
 Refine the mosaic of images by computing correlation functions.
 (not yet completly finished)
 Frank Varosi STX @ NASA/GSFC 1991

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_correl_2.pro)


MOSAIC_CORRTIME

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_corrtime
 PURPOSE:
	Automatically create mosaic of images by computing cross-correlation 
	functions and finding optimal position from maximum cross-correlation
	for images which are adjacent in time ordering. If time info is not
	available in structure then ordered by sorting the name of images.
	User can select which images (or all) are to be correlated and moved.
 CALLING:
	mosaic_corrtime, image_List, cross_corr
 INPUTS:
	image_List = array of structures containing image locations,
			and the image data and scaled byte arrays for display.
			Optionally, pointers into the pool-arrays given
			by keywords IMAGES and IMSCALED.
 KEYWORDS:
	IMAGES = optional pool-array of image data, pointed to by image_List.
	IMSCALED = optional pool-array of scaled images for displaying.
	THRESHOLD = image pixel values less than threshold are set to zero,
			so are not used in correlation (default = 0.1).
	BACKGROUND = scalar value of constant background to subtract from
			all images (default = 0).
	/PRINT_FLAG causes cross-correlation computation results to be printed.
 OUTPUTS:
	image_List = array of structures containing new image locations.
	cross_corr = array of structures containing the
		maximum cross-correlation values found, optimal offsets,
		and names of images. (optional output, FYI).
 SIDE_EFFECTS:
	The images displayed in window are moved around according to new Locs.
 EXTERNAL CALLS:
	funcs:	pick_images, conv_ascii_time, fsort
		get_image, modify_image, pop_image
		select_number, yes_no_menu, next_word,
	pros:	push_image, screen_coordin, correl_optimize
 COMMON BLOCKS:
	common mosaic_options, bimflag, bgrflag
	common array_scale, ArcSec_Pix_x, ArcSec_Pix_y	;plate scale of array.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994 (based on pro mosaic_correl_1).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_corrtime.pro)


MOSAIC_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 Select and drag an image to new location, then push behind all others.
 Frank Varosi NASA/GSFC 1989
 F.V. Jan-91, added option to Pop images with middle button.
 F.V. Apr-91, mod to exclude unsmoothed border when displaying images.
 F.V. Apr-91, mod to keep cursor at point selected while moving image.
 F.V. Jul-91, mod to update arcsec coordinates of image after move.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_images.pro)


MOSAIC_MAIN

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

 PURPOSE:
	Main program for calling:	Prep
					Mosaic
					Display_Mosaics
					Analyze_Mosaics
 EXECUTION:
	IDL> .run  mosaic_main

	Further execution is all menu-driven.
	Information, status, and directions are printed in the terminal window
	and the info/menu_window, and the windows displaying images.

 MAIN VARIABLES:

	task = string, next task requested by user.

	menu_window = window # in which informational messages are displayed,
		holdover from SunView development, since in SunView
		all menus had to be associated with a window.

	inventory = array of structures containing images, locations, info, etc.
		created in pro Prep by reading data files.

	SS_FF = array of structures resulting from preprocessing (in Prep),
		either sky-subtractions (SS) or flat-fielding (FF),
		can be exported to Mosaic, or saved to a file.

	Raw_Mosaic = array of structures containing images, locations, info, ...
		imported from Prep to Mosaic, or created in Mosaic.

	mosaic = single image, result of averaging or splicing a Raw_Mosaic.
	mosaic_spec = structure containing display specifications for mosaic.
	mosaic_info = the Raw_Mosaic structure minus the images.

	math_result = 2D array (image) result of computations.
	math_spec = structure defining the math_result.

   common mosaic_array:

	mosaics = array of pooled image data, pointed to by mosaic_specs.
	mosaic_specs = array of structures containing specs. and
			pointers into the pool-array: mosaics.
	mosaic_infos = array of structures containing info about
			how each mosaic image was formed.

   common math_mosaics:

	mathmos_List = array of structures containing image locations and
		pointers into the pool-arrays: math_images & math_imscaled.
	math_images = pool-array of image data, pointed to by mathmos_List.
	math_imscaled = pool-array image data scaled into bytes for display.

	Elements of math_images are extracted from array mosaics.

   common contour_marks:

	sources = array of structures containing user defined marks to be drawn
		on images displayed in the "contour mosaic" function,
		found in the "DISPLAY mosaics" module, or in "ANALYZE mosaics".
		
	Labels = array of structures containing user defined Labels
		to be drawn on images in the "contour mosaic" function.

 HISTORY:
	Written: Frank Varosi, NASA/GSFC, 1990.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_main.pro)


MOSAIC_OFFSETS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_offsets
 PURPOSE:
	Specify new locations of images by entering (x,y) arcsec offsets.
 CALLING EXAMPLE:
	mosaic_offsets, image_List, FILE_OFFSETS="file_offs"
 INPUTS:
 KEYWORDS:
 OUTPUTS:
 EXTERNAL CALLS:
 COMMON BLOCKS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/Goddard 1989.
	F.V. 1992, option to read offset from file or define scanning pattern.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_offsets.pro)


MOSAIC_OPTIONS

[Previous Routine] [Next Routine] [List of Routines]
	"ignore": BEGIN

		menu = ["Width of border to neglect ?",string(indgen(10))]
		sel = wmenu( menu, INIT=2, TITLE=0 ) > 1
		border_ignore = sel-1
		print," width of ignored border = ", strtrim( border_ignore,2 )
	     END

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_options.pro)


MOSAIC_SETUP

[Previous Routine] [Next Routine] [List of Routines]
 FILE:
	mosaic_setup.pro
 PURPOSE:
	Do NOT modify this file!
	This file should be linked to: ~/mosaic/setup.pro
	so that it is automatically executed by ~/idl/idl_startup.pro
	(need:  setenv  IDL_STARTUP  ~/idl/idl_startup.pro).
	Copy and put any desired modifications and variable settings in: 
	~/mosaic/setup_user.pro,  which is invoked at end of this IDL script.
 HISTORY:
	Written by Frank Varosi, NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_setup.pro)


MOSAIC_STRUCT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_struct
 PURPOSE:
	Define structures used in MOSAIC routines
	(display_mosaics, contour_mosaic, analyze_mosaics, etc...)
	and return array have requested type of structure.
 CALLING:
	mosaic_specs = mosaic_struct( Nstruct, TYPE="spec" )
 INPUTS:
	Nstruct = number of elements desired
 KEYWORDS:
	TYPE = type of structure: "spec" , "List" or "info".
 RESULTS:
	Function returns an array of requested structure and # of elements.
 COMMON BLOCKS:
	common mosaic_struct, defined		;indicates defined structs.
	common array_scale, ArcSec_Pix_x, ArcSec_Pix_y	;plate scale.
 EXTERNAL CALLS:
	function color_struct	;structure for storing color tables.
	function headinfo	;defines structure for image data info.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990
	F.V.1991, added fields for more contour level info.
	F.V.1991, separate fields for relative origin and absolute origin.
	F.V.1992, separate fields for min-max of filtered mosaic image.
	F.V.1992, separate fields for Linear and Logarithmic contour levels,
			and substructure fields for contours options.
	F.V.1993, new version of Mosaic_List structure, with scale and rotation.
	F.V.1994, new version of Mosaic_Spec structure, with rotation angle.
	F.V.1994, made display magnification factor float: Magf can be < 1.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_struct.pro)


MOSAIC_TASK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	mosaic_task
 PURPOSE:
	Perform tasks commonly requested by MOSAIC & PREP & ANALYZE,
	by routing request to other procedures and function.
 CALLING:
	mosaic_task, task, request, image_List
 INPUTS:
	task = string, the task to be performed (a single word, see code cases).
	request = string, more information about the task to be performed,
			(usually the first word of request is checked).
	image_List = array of structures containing image locations & info,
		and the images scaled into byte arrays for display,
		or pointers into the arrays DATA_IMAGES & SCALED_IMAGES.
 KEYWORDS:
	DATA_IMAGES = optional array of image data, pointed to by image_List.
	SCALED_IMAGES = optional array of images scaled into bytes for display.
 OUTPUTS:
	image_List = this array of structures could be modified by user choices,
			and the KeyWord arrays may also be modified.
 EXTERNAL CALLS:
	Very many, see code...
 COMMON BLOCKS:
	common dir_names, dirinv, dirmos_raw, dirmos_aver
 PROCEDURE:
	Big CASE statement calls other routines to do the work.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989
	F.V. 1991, use new /RESIZE keyword of display_images.
		and set /SHOW_NUMBER keyword option of border_images.
	F.V. 1992, added options: show statistics, plot profiles/spectrum.
	F.V. 1993, added keywords DATA_IMAGES and SCALED_IMAGES for when
		structure image_List has pointer to data and/or scaled data.
	F.V. 1997, added probe_image option.
	F.V. 1998, added call to pop_push_images.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/mosaic_task.pro)


MOVE_DEVICE

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

 PURPOSE:
	Command a GPIB device-axis to move to new position.

 CALLING:

	move_device, name, AXIS=, POSITION=
   or
	move_device, ALIAS=, POSITION=
   or
	move_device, NUM_DEV=, NUM_AXIS=

 INPUTS:
	name = string, name of GPIB device (or use keywords instead).

 KEYWORD INPUTS:

	AXIS = string containing the name of the axis to be moved,
		e.g. for Klinger device controllers: either W, X, Y, or Z.

	ALIAS = string to select device name and axis via one aliased name.

	NUM_DEV = integer, index of device in < common gpib, devices > array,
		an alternative way to select device (instead of using name).

	NUM_AXIS = integer, index of the axis in < devices(devnum).axis > array,
		an alternative way to select axis (instead of using name).

	POSITION = the desired position of device-axis, but if not specified
		then use the value: devices(devnum).axis(axnum).pos_move
		or if /SCALED then: devices(devnum).axis(axnum).position.

	/SCALED : then POSITION is first scaled into raw device-axis units,
		 default is to assume it is already in raw device-axis units.

 KEYWORDS for Klinger & Unidex motion controllers:

	/FIND_ORIGIN causes the Klinger to search for the origin of axis
			(does not move anything) and then position is read.

	/RESET_ORIGIN : the present position is used as reference point,
			thus resetting the origin of axis,
			(does not move anything) and then position is read.
 OUTPUT:
	No explicit output, but the devices.axis (stored in common gpib)
	is modified to keep track of previous position.

 EXTERNAL CALLS:
	function get_dev_num
	function get_axis_num
	pro get_by_alias
	pro move_klinger
	pro move_monochrom
	pro move_filter
	pro move_unidex
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 PROCEDURE:
	Check device type and call corresponding device routine.
 HISTORY:
	written, Frank Varosi NASA/GSFC 1993.
	F.V. 1993, added Klinger options to find origin, reset origin,
			and previous position is always saved before moving.
	F.V. 1994, added keyword ALIAS= to use equivalent alias for [dev,axis].
	F.V. 1995, added UNIDEX device type.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_device.pro)


MOVE_FILTER

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

 PURPOSE:
	Command the Filter Wheel (part of Acton MonoChromator)
	to move to a new position.

 CALLING:
	move_filter, axist

 INPUT:
	axist = axis structure with fields for new position, scaling, etc.
		and the GPIB I/O handle of the device,
		(see gpib_dev_struct for structure definition).

 KEYWORD:
	/WAIT : causes position to be checked in Loop until move is complete or
		query timeout. Length of Loop time can set with WAIT=seconds.

 OUTPUT (if /WAIT):

	axist = the fields of axis structure are updated to contain
		the new position of the filter wheel.

 EXTERNAL CALLS:
	function Poll_Device
	function IBWRITE
	function read_filter
 PROCEDURE:
	Check if device is idle, then send command to move the filter wheel.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1993.
	F.V. 1994, abort if busy and return after move command, unless /WAIT.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_filter.pro)


MOVE_GROUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	move_group
 PURPOSE:
	Interactively Move a group of images by
	specifying From & To cursor locations.
	(group is predefined in structure array image_List).
 CALLING:
	move_group, image_List
 INPUT and OUTPUT:
	image_List
 EXTERNAL CALLS:
	funcs:	check_groups	select_image
		pop_group	draw_mark
	pros:	border_image	shift_images	display_images
 COMMON BLOCKS:
	common mosaic_options, border_imflag, border_grflag
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.
	FV. 97, mod for TOFU (deleted coordinate related calls).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_group.pro)


MOVE_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	move_image
 PURPOSE:
	Select and Drag an image (blinking) with mouse to a new Location.
	Select image by clicking LEFT button, drag by moving mouse,
	drop image at new location with LEFT or MIDDLE button,
	put back image to original location with RIGHT button.
	Otherwise, use MIDDLE button to pop images, or RIGHT button to quit.
 CALLING:
	move_image, image_List, images
 INPUTS:
	image_List = structured array containing image locations and
		the scaled images as displayed (when all the same size),
		or optionally, pointers into the pooled-array: images.
	images = optional, pooled-array of images scaled into bytes for display,
		this allows moving images of arbitrary sizes.
 EXTERNAL CALLS:
	function check_struct
	function select_image
	function pop_image
	function get_imscaled
	pro push_image
	pro display_image
	function blinkdrag_image
 COMMON BLOCKS:
	common array_scale, ArcSec_Pix_x, ArcSec_Pix_y
	common mosaic_options, border_imflag, border_grflag
 PROCEDURE:
	After image is selected, push and erase it,
	then call function blinkdrag_image to do the work.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. Jan-91, added option to Pop images with middle button.
	F.V. Apr-91, mod to exclude unsmoothed border when displaying images.
	F.V. Apr-91, mod to keep cursor at point selected while moving image.
	F.V. Jul-91, mod to update arcsec coordinates of image after move.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_image.pro)


MOVE_KLINGER

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

 PURPOSE:
	Command a Klinger axis to move to new position,
	or reset the origin to current position, or find the origin.

 CALLING:
	move_klinger, axist

 INPUT:
	axist = axis structure with fields: desired new position, scaling, etc.,
		and the GPIB I/O handle of the Klinger device,
		(see gpib_dev_struct for structure definition).

 KEYWORDS:
	/FIND_ORIGIN : causes the Klinger to search for the origin of axis
			(does not move anything) and then position is read.

	/RESET_ORIGIN : the present position is used as reference point,
			thus resetting the origin of axis,
			(does not move anything) and then position is read.

	/WAIT : causes position to be checked in Loop until move is complete or
		query timeout. Length of Loop time can set with WAIT=seconds.

 OUTPUT (if /WAIT):

	axist = the fields of axis structure are updated to contain
		the new position of the Klinger axis.

 EXTERNAL CALLS:
	function Klinger_Status
	function IBWRITE
	function read_klinger
 PROCEDURE:
	First check status of Klinger controller, if it's idle,
	then send command to move the Klinger table, or to find/reset origin.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1993.
	F.V. 1994, abort if busy, return after move command, unless /WAIT.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_klinger.pro)


MOVE_MONOCHROM

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

 PURPOSE:
	Command a monochromator axis (part of Acton Vacuum MonoChromator)
	to move to new position.

 CALLING:
	move_monochrom, axist

 INPUT:
	axist = axis structure with fields for new position, scaling, etc.
		and the GPIB I/O handle of the device,
		(see gpib_dev_struct for structure definition).

 KEYWORD:
	/HOME : for the SLIT axis only, command it to home position.
	/WAIT : causes position to be checked in Loop until move is complete or
		query timeout. Length of Loop time can set with WAIT=seconds.

 OUTPUT (if /WAIT):

	axist = the fields of axis structure are updated to contain
		the new position of the monochromator axis.

 EXTERNAL CALLS:
	function Poll_Device
	function IBWRITE
	function read_monochrom
 PROCEDURE:
	Check if device is idle, then send command to move a monochromator axis.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1993.
	F.V. 1994, abort if busy and return after move command, unless /WAIT.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_monochrom.pro)


MOVE_UNIDEX

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

 PURPOSE:
	Command a Unidex axis to move to new position,
	or reset the origin to current position, or find the origin.

 CALLING:
	move_unidex, axist

 INPUT:
	axist = axis structure with fields for the desired new position,
		and the GPIB I/O handle of the Unidex device,
		(see gpib_dev_struct for structure definition).

 KEYWORDS:
	/FIND_ORIGIN : causes the Unidex to move to the home position.

 OUTPUT:
	axist = the status field of axis structure are updated (before move).

 EXTERNAL CALLS:
	function Unidex_Status
	function IBWRITE
 PROCEDURE:
	First check status of Unidex controller, if it's idle,
	then send command to move the Unidex axis, or to find origin.
	When finding home must first ensure position is on positive side.
	Must wait a short time after sending host mode immeadiate command.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/move_unidex.pro)


NEAREST_MARK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	nearest_mark
 PURPOSE:
	Find the nearest mark (of sources or Labels) to the position input.
 CALLING:
	subscript = nearest_mark( marks, xp, yp, ident1, ident2 )
 INPUTS:
	marks = structured array of sources or Labels (from contour_markset).
	xp, yp = normalized (x,y) position defining neighborhood to look search.
	ident1 = string, identification of image.
	ident2 = string, optional secondary I.D.
 KEYWORDS:
	RADIUS = radius in normalized coordinates to search (default = 0.04).
 OUTPUTS:
	Function returns the subscript of nearest mark in structure array,
	else returns negative one if failed to find.
 PROCEDURE:
	Use the where and min functions.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1990.
	F.V. 1991, added check of ident2.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/nearest_mark.pro)


OPTICON

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

 PURPOSE:
	Main program to call the other widgets,
	such as Klinger and MonoChromator control, MAMA/CCD integration...

 CALLING:
	This is a main program:  IDL> .run opticon

 EFFECTS:
	Creates a menu of buttons by which user can select the other widgets.
	
 EXTERNAL CALLS:
	pro Xmanager
	pro Opticon_Event

 COMMON BLOCKS:
	common gpib, devices
	common opticon0, mimage, mheader, mimhist
	common opticon1, subimage, subhead, subhist
	common opticon5, mim_fh, sub_fh, flat_fh
 PROCEDURE:
	Create and register the Xmenu widget with the Xmanager.
	Selection events are then processed by pro Opticon_Event.
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/opticon.pro)


OPTICON_SETUP

[Previous Routine] [Next Routine] [List of Routines]
; Do NOT modify this file!
; Note: modifications will be erased upon installing new version of opticon.
;
; Copy and put user specific modifications in:  ~/opticon/setup_user.pro
; which is invoked at the end of this IDL command file.
;
;
; FILE: ~/opticon/code/opticon_setup.pro
;
; Do NOT modify this file!
; Do NOT modify this file!
; Do NOT modify this file!
;
; This file should be symbolic linked to setup.pro in ~/opticon :
;
;	ln  -s  ~/opticon/code/opticon_setup.pro  ~/opticon/setup.pro
;
;  so that it is automatically executed by ~/idl/idl_startup.pro
;  (assuming:  setenv  IDL_STARTUP  ~/idl/idl_startup.pro).
;
; Copy and put any desired modifications and variable settings in:
;
;      ~/opticon/setup_user.pro
;
; which is invoked at the end of this IDL command file.
;
; Written by Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/opticon_setup.pro)


ORDER_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	order_images
 PURPOSE:
	Set the Levels of images to be ordered with wavelength or max value,
	so stack of images will be displayed in wavelength/max order.
 CALLING:
	order_images, image_List
 INPUTS:
	image_List = structured array with fields giving Location of images.
 KEYWORDS:
 OUTPUTS:
	None explicit.
	Values of Level tags in image_List structure are modified.
 EXTERNAL CALLS:
	function N_struct
	function fsort
 HISTORY:
	Frank Varosi RSTX @ NASA/GSFC 1998

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/order_images.pro)


ORGANIZE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	organize_images
 PURPOSE:
	Arrange image Locations to be in nice lined up rows and columns.
 HISTORY:
	Frank Varosi NASA/GSFC 1989
	FV 1997 fixed for case of one image.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/organize_images.pro)


OVERLAP_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
Get coordinates of common overlap region within each image.
 Default is return exact (floating point) (xBot, xTop, yBot, yTop) coordinates,
/ROUND causes round off to nearest integers.
 INTERIOR = # pixels width to ignore at edges of overlap.
/BOX shows the overlap region on window (screen), /MARKS marks all images.
Frank Varosi STX @ NASA/GSFC 1989.
F.V.1991, modif to use Locx & Locy (exact coordinates of image corner).
F.V.1992, added /ROUND keyword, and now the default is exact Locations.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/overlap_images.pro)


PATCH_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	patch_images
 PURPOSE:
	Create a new image by patching a region in an image
	using Vertical and/or Horizontal interpolation,
	with optional averaging and/or Gaussion noise added.
	Purpose, for example, is to create a synthetic sky image
	by cutting out the source region in a star image.
	The patched region and method is controlled interactively.
 CALLING:
	patch_images, image_List
 INPUTS:
	image_List
 OUTPUTS:
	image_List
 EXTERNAL CALLS:
	function patch_image
	function window_set_show
 COMMON BLOCKS:
	common image_scale, minval, maxval, topval, scale_type, minLog
 PROCEDURE:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/patch_images.pro)


PATCH_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	patch_mosaic
 PURPOSE:
	Create a new mosaic image by patching a region in the image
	using Vertical and/or Horizontal interpolation,
	with optional averaging and/or Gaussion noise added.
	The patched region and method is controlled interactively.
 CALLING:
	patch_mosaic, image_List
 INPUTS:
	image_List
 OUTPUTS:
	image_List
 EXTERNAL CALLS:
	function patch_image
	function window_set_show
 COMMON BLOCKS:
	common image_scale, minval, maxval, topval, scale_type, minLog
 PROCEDURE:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/patch_mosaic.pro)


PEAK_AVG_TRANS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Peak_Avg_Trans
 PURPOSE:
	Compute peak Transmission (peak wavelength of avg. in circle)
	for increasing radii, plotting results while computing.
 CALLING:
	maxT_struct = Peak_Avg_Trans( image_List, XC=, YC=, RADII= )
 INPUT:
	image_List = structured array of images of transmission,
		one for each wavelength.
 KEYWORDS:
	XCEN, YCEN = center of circles (default is center of image).
	RADII = array of circle radii, default is from max fitting in image
		to Rmax/6.
 OUTPUT:
	Peak_Tavs = array of peak avg. T structures, one for each radius.
	Tavs = array of avg. T vs. wavelength structures, one for each radius.
 EXTERNAL CALLS:
	pro Look_Image
 PROCEDURE:
	Call function Peak_AvTrans for each radius.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/peak_avg_trans.pro)


PICK_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pick_images
 PURPOSE:
	Pick images from collection by various methods of user selection.
 CALLING:
	im_nums = pick_images( image_List )
 INPUTS:
	image_List =
 KEYWORDS:
	MENU=
	INIT=
	GROUP=
	VERIFY=
	WINDOW=
	/NAMES
 OUTPUTS:
	Function returns indices of selected images.
 EXTERNAL CALLS:
	function select_image
	function select_images
	function Lasso_images
	pro border_images
 PROCEDURE:
 HISTORY:
	Frank Varosi NASA/GSFC 1991.
	F.V. 1991 added select group option, group # is returned thru keyword.
	F.V. 1991 added keyword /NAMES to print the names of selections.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pick_images.pro)


PLOT_CENTROIDS

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_centroids.pro)


PLOT_DIAGRAM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Plot_Diagram
 PURPOSE:
	Plot the Grotrain diagram of energy levels and allowed transitions.
	The graphics can go to either a window or to a file.
 CALLING:
	Plot_Diagram, XRANGE= , ERANGE=

 INPUTS:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for color index of level,
		energy of level, quantum numbers, etc. (see code below).
	BB_Trans = array of structures with tags for color index of
		selected bound-bound transitions.
	SupLevs = array of super-Level structures with tags for
		average energy, effective temperature, etc.

 KEYWORD INPUTS:
	XRANGE = [min,max] > 0 < 2048, default is full range.
	ERANGE = [min,max] default is [0,EMAX].
	COMMENT = string, for comment at bottom of page/window.
	/COLOR	: plot with the predefined colors, default is black & white.
 OUTPUTS:
	None.
 COMMON BLOCKS:
	 see file: ~/modion/code/modion_common.pro
 PROCEDURE:
	Plot allowed transitions first to avoid obscuring energy levels,
	and plot energy levels in backwards order to avoid obscuring things
	with the ionization limit line (which is last in array).
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_diagram.pro)


PLOT_EFFICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Plot_Effics
 PURPOSE:
	Plot the results of efficiency calculation.
 CALLING:
	Plot_Effics, effics
 INPUTS:
	effics = array of structures, created by pro Calc_Effics.
 KEYWORDS:
	WINDOW =
	/HARDCOPY
	DIRECTORY =
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
	function get_text_input
	pro get_window
	pro print_graphics
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_effics.pro)


PLOT_EFF_MEAS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Plot_Eff_Meas
 PURPOSE:
	Plot the mirror and grating flux measurements, which are
	used to computed efficiencies of grating.
	Assumes there is one grating measurement at each wavelength,
	and up to two (2) mirror measurements  at each wavelength.
 CALLING:
	Plot_Eff_Meas, eff_meas
 INPUTS:
	eff_meas = array of structures, created by pro get_Effic_Data.
 KEYWORDS:
	WINDOW =
	/HARDCOPY
	DIRECTORY =
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
	function RemIx
	function get_text_input
	pro get_window
	pro print_graphics
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_eff_meas.pro)


PLOT_HISTOGRAMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	plot_histograms
 PURPOSE:
	Plot up to 6 curves (histograms) on same graph,
	with different line types.
 CALLING:
	plot_histograms, vals, dens, names, Htitle
 INPUTS:
	vals, dens, names, Htitle
 KEYWORDS:
	SCALE_Y=
	PSYMBOL=
	XRANGE=
	/RIGHT_SIDE =
	/ACCUMULATIVE
 OUTPUTS:
	None.
	Window is created/reused and graph is plotted in it.
 EXTERNAL CALLS:
	function accumulate
 COMMON BLOCKS:
	common histog_plot
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1990, added keywords SCALE=, /RIGHT.
	F.V. 1991, added keyword XRANGE=[xmin,xmax].
	F.V. 1997, added keyword /ACCUMULATIVE.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_histograms.pro)


PLOT_PEAK_TR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Plot_Peak_Tr
 PURPOSE:
	Plot peak transmission versus radii of circles.
 CALLING:
	Plot_Peak_Tr, pavt
 INPUT:
	pavt = structured array of peak transmissions vs. radii.
 KEYWORDS:
	MAX_RADIUS = optional, indicate max useful radius on graph.
 OUTPUT:
	None. Plot is created in current window.
 EXTERNAL CALLS:
	pro oploterr
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_peak_tr.pro)


PLOT_PROFILES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	plot_profiles
 PURPOSE:
	Plot up to 6 profiles (cuts through images) on same graph,
	with different line types.
 CALLING:
	plot_profiles, fluxes, xcoor, ycoor, names
 INPUTS:
	fluxes = array of fluxes (pixel values).
	xcoor, ycoor = pixel coordinate arrays.
	names = string array, names of images from which profiles are cut.
 KEYWORDS:
	XUNITS =
	NORMALIZE =
	/PROJECT
	/LOG10
	/YNOZERO
	/HARDCOPY
 EXTERNAL CALLS:
	function rot2d
	function trapez
	pro print_graphics
 COMMON BLOCKS:
	common profile_plot
	common profile_plots
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_profiles.pro)


PLOT_SPECTRUM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	plot_spectrum
 PURPOSE:
	Plot flux vs. wavelength (or time), with optional error bars (st.devs.).
	Called by Look_images.
 CALLING:
	plot_spectrum, wavelens, fluxes, stdevs, fmins, fmaxs
 INPUTS:
	wavelens = array wavelengths (assumed in nm) (or times, #'s, etc.)
	fluxes = array, mean fluxes in aperture, corresponding to wavelens.
	stdevs = standard devation of mean fluxes, used for error bars.
	fmins, fmaxs = minimum & maximum values in aperture vs. wavelens.
 KEYWORDS:
	APERTURE = string, Label for y-axis stating aperture size.
	TITLE = string
	SUBTITLE = string
	SPLINE_TENSION =
	PSYMBOL =
	LINETYPE =
	GROUPS = integer array used to group fluxes causing overplotting
		of different groups with sequential varying Linetypes.
	/XLOG : Log scale for x-axis (wavelength, default is Linear).
	/YLOG : Log scale for y-axis (default is Linear) and if any fluxes
		are zero they are plotted as non-zero-minimum/100.
	ERROR_BARS = 1 for st.dev. error bars, 2 for min-max error bars.
	/HARDCOPY
	/NOCLOSE : do not close hardcopy file.
	/OVERPLOT : overplot option used for recursive call of groups.
	/YNOZERO : do not include zero in y-axis of plot, let it float.
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	pro get_window
	pro print_graphics
	function spline
	function unique
	pro errplot
	pro plot_spectrum (recursively)
 COMMON BLOCKS:
	common plot_spectrum, plot_window, Nhc
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.
	F.V. 1993, added keyword GROUPS=, accomplished by recursive calls.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_spectrum.pro)


PLOT_TRANSPEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Plot_TranSpec
 PURPOSE:
	Plot Transmission vs. wavelength with optional error bars (st.devs.).
 CALLING:
	Plot_TranSpec, fs_inband
 INPUTS:
	fs_inband = structure containing inband transmission analysis results.
 KEYWORDS:
	ERROR_BARS = 1 for st.dev. error bars, 2 for min-max error bars.
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	pro get_window
	pro errplot
	function Ringing
 COMMON BLOCKS:
	common Plot_TranSpec, plot_window
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1996.
	FV.1997: use psym instead of !P.psym to workaround bug in V5 errplot.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_transpec.pro)


PLOT_XSEC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Plot_Xsec
 PURPOSE:
	Plot the full and approximate photo-ionization cross-sections.
	Called by pro Approx_Xsecs_Ev and pro Approx_Xsec_Cur.
 CALLING:
	Plot_Xsec, ELev
 INPUTS:
	ELevs = array of structures with tags for energy of level,
		quantum numbers, and handles pointing to
		full and approximate photo-ionization cross-sections.
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function it_get_color
 PROCEDURE:
	Too avoid a kind of bug in IDL previous to 4.0.1 must check !X.range
	before doing the plot, freq, xsec, /NODATA.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_xsec.pro)


PNOISE

[Previous Routine] [Next Routine] [List of Routines]
imc = imcm

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pnoise.pro)


POLL_DEVICE

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

 PURPOSE:
	Serial poll a GPIB device to decide its status.

 CALLING:
	status = Poll_Device( axist )

 INPUTS:
	axist = device axis structure with fields
		the GPIB I/O handle of the device,
		and the I/O handle of the GPIB bus,
		device & axis name, position, scaling, etc.,
		(see gpib_dev_struct for structure definition).

 KEYWORDS:

	BIT_MASK = byte, bit-mask to compare (AND) with status-byte, default=1.
	WAIT_SEC = seconds to wait in loop of IBRSP calls (default=0.1).
	MAX_TRY = max # of calls to IBRSP (default=3).
	/VERBOSE : print all information about what is happening.

 OUTPUTS:
	axist = the status field of axis structure is updated.

	Function returns the status of device:
			-1 : error,
			 0 : busy or unknown,
			 1 : idle and OK.
 EXTERNAL CALLS:
	function IBRSP
	function IB_error_mess
 PROCEDURE:
	Request serial-poll status-byte (IBRSP) to check if device is ready.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/poll_device.pro)


POP_GROUP

[Previous Routine] [Next Routine] [List of Routines]
Redislpay a group of images on top of others, adjust Levels in structure,
 Returns the indices of images in List belonging to the group.
Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pop_group.pro)


POP_GROUPS

[Previous Routine] [Next Routine] [List of Routines]
Select a group of images and Redislpay on top of others, ,
 if top group is selected twice, start popping from bottom Level.
Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pop_groups.pro)


POP_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pop_image
 PURPOSE:
	Redislpay an image on top of all others and set Level accordingly.
	If im_num = previous_num then Pop from bottom Level.
 CALLING:
	Loc = pop_image( image_List, im_num, IMAGES=images )
 INPUTS:
	image_List = structured array containing image Locations, Level,
		and either the byte-scaled images for display,
		or pointers into the pool-array supplied thru keyword IMAGES.
	im_num = the number of the image in array to be popped to the top.
 KEYWORDS:
	IMAGES = optional pool-array of scaled images, pointed to by image_List.
 OUTPUT:
	Function returns location of image in window as: [xmin,xmax,ymin,ymax].
 EXTERNAL CALLS:
	pro display_image
	function find_images
	function image_extract
	function border_image
	function stack_image
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V.1993, generalized to arbitrary sized images (keyword IMAGES=).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pop_image.pro)


POP_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pop_images
 PURPOSE:
	Interactively select an image and redislpay on top of all others.
	If top image is selected twice (image_num = inumsave)
	then start popping from bottom Level.
	Selection/pop process continues in a loop until users aborts.
 CALLING:
	pop_images, image_List, imscaled
 INPUTS:
	image_List = array of structures containing image locations
			and the images scaled into byte arrays for display.
	imscaled = optional pool-array of scaled images, pointers in image_List.
 EXTERNAL CALLS:
	function select_image
	function pop_image
 PROCEDURE:
	Let user select image and call function pop_image.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pop_images.pro)


POP_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pop_mosaics
 PURPOSE:
	Interactively select a mosaic image and Redislpay on top of all others,
	if top image is selected twice (image_num = inumsave)
	then start popping from bottom Level.
	Selection/pop process continues in a loop until users aborts.
 CALLING:
	pop_mosaics, mosaic_List, mosaic_imscaled
 INPUTS:
	mosaic_List = array of structures containing image locations
		and pointers into the array: mosaic_imscaled.
	mosaic_imscaled = array of image data scaled into bytes for display.
 KEYWORDS:
	POSITION_MARKS = array of mark positions.
	/SHOW_MARKS causes marks to be shown.
 EXTERNAL CALLS:
	function select_image
	pro pop_image
	pro overlap_images
	pro contour_marks
 PROCEDURE:
	Select and call pro pop_image (which does all the work).
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1990.
	F.V. 1992, added option to overlay source marks on display.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pop_mosaics.pro)


POP_PUSH_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	pop_push_images
 PURPOSE:
	Interactively select an image and pop it if left button was pressed
	(redislpay on top of all others), or push it if middle button was used.
	If top image is selected twice (im_num = inumsave)
	then start popping from bottom Level.
	Selection/pop/push process continues in a loop until users aborts
	with right mouse button.
 CALLING:
	pop_push_images, image_List, imscaled
 INPUTS:
	image_List = array of structures containing image locations
			and the images scaled into byte arrays for display.
	imscaled = optional pool-array of scaled images, pointers in image_List.
 EXTERNAL CALLS:
	function select_image
	function pop_image
	pro push_image
 PROCEDURE:
	Let user select image and call function pop_image or pro push_image.
 HISTORY:
	Frank Varosi NASA/GSFC 1998 (combined pros pop_images & push_images).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/pop_push_images.pro)


PREP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PreP
 PURPOSE:
	Read TUT image files from CCD or MAMA obs and PreProcess the images.

 CALLING:
	PreP, inventory, TUT_images, Return_Task

 INPUT and OUTPUT:

	inventory = structured array of images, to be pre-processed.
	TUT_images = structured array of images, from/TO pro mosaic (optional).

 OUTPUT:
	Return_Task = string indicating next desired major function.

 EXTERNAL CALLS:
	pro select_files
	function read_images
	pro restore_inven
	pro export_import
	pro Tofu_Task		(handles most generic operations)
	and many more...

 COMMON BLOCKS:	many

 PROCEDURE:		menu with loop around big CASE statement.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1996, modified for TOFU.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/prep.pro)


PROFILE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	profile_images
 PURPOSE:
	Interactively chose two points defining a cut across overlaping images,
	then plot the flux in the pixels of each image intersecting the cut.
	The two points are chosen with Left then Left or Middle mouse button,
	or if the first button pressed is the Middle button then a menu is
	presented whereby the user can exclude/include images from/into the
	multi-profile graph, change the axes (arcsec/pixels, Linear/Log, etc.),
	normalize fluxes, or make a hardcopy to print. Another option is the
	mode in which an angle and range of profile cut can be defined
	so that selecting a single point will plot the profiles.
 CALLING:
	profile_images, image_List, images
 INPUTS:
	image_List = array of structures containing images and information.
	images = optional, pooled array containing the image data, if not with
		the structure, then image_List has pointers into this array.
 KEYWORDS:
	GROUP = limit selects to images within specified group number.
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	function select_image
	function find_images
	function profile	(F.V.'s version, returns profile vectors xp, yp)
	function select_number
	function get_words
	function round_off
	pro plot_profiles
	pro match
	pro printw
	pro border_images
 COMMON BLOCKS:
	common profile_plot
	common profile_images
	common profile_images1
	common profile_images2
 PROCEDURE:
	Very involved.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1992.
	F.V. 1995, improved the fixed angle & range option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/profile_images.pro)


PROFILE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
Extract and Plot interactively specified profile cuts of mosaic image.
Frank Varosi STX @ NASA/GSFC 1990.
F.V. 1991, mod to use mosaic_spec structure,
		and to also work on Contoured mosaics.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/profile_mosaic.pro)


PURPOSE:[10]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 PURPOSE:
 CALLING:
	posxy = set_PostScript( mode, bitspix, nxpix, nypix )
 INPUTS:
 KEYWORDS:
 OUTPUTS:
 EXTERNAL CALLS:
 COMMON BLOCKS:
	common PS_Layout, xoff, yoff, xpap, ypap, Left, Right, Top, Bottom
 PROCEDURE:
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_postscript.pro)


PURPOSE:[11]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 PURPOSE:
 CALLING SEQUENCE:
	shift_images, image_List, xshift,yshift, GROUP=group, WINDOW=window
 INPUTS:
	image_List
	xshift,yshift
 KEYWORDS:
	GROUP=group
	WINDOW=window
 OUTPUTS:
	image_List
 EXTERNAL CALLS:
 COMMON BLOCKS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/shift_images.pro)


PURPOSE:[12]

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

 PURPOSE:
	Construct sky image from of a stack of images,
	by sorting the stack and extracting the median or minimum image,
	or else just averaging the stack.
 CALLING:
	sky_synth_stack, image_List
 INPUTS:
	image_List
 OUTPUTS:
	image_List
 EXTERNAL CALLS:
	function pick_images
	pro sort_stack
 PROCEDURE:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sky_synth_stack.pro)


PURPOSE:[13]

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

 PURPOSE:
	Create a synthetic sky image by choosing from two methods:
    1.	cutting out the source region in a data image,
	and patching the hole using Vertical and/or Horizontal interpolation,
	with optional averaging and Gaussion noise.
    2.	Construct sky image from of a stack of images,
	by sorting the stack and extracting median or minimum,
	or else just using the average of stack.
 CALLING:
	sky_synthesis, inventory
 INPUTS:

 KEYWORDS:

 OUTPUTS:

 EXTERNAL CALLS:

 PROCEDURE:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sky_synthesis.pro)


PURPOSE:[1]

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

 PURPOSE:

 CALLING:
	Edit_Eff_Meas, eff_meas
 INPUTS:
	eff_meas =
 OUTPUTS:
	eff_meas =
 EXTERNAL CALLS:
	pro print_struct
	function strconcat
 PROCEDURE:
	Use a List widget to select measurements to exclude/re-include.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/edit_eff_meas.pro)


PURPOSE:[2]

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

 PURPOSE:

 CALLING:
	gscat_define, gs_widget
 INPUTS:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/gscat_define.pro)


PURPOSE:[2]

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

 PURPOSE:

 CALLING:
	gscat_box_draw, gs_widget
 INPUTS:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/gscat_box_draw.pro)


PURPOSE:[3]

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

 PURPOSE:

 CALLING:
	gscat_extract, gs_widget, scattm, subimage
 INPUTS:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/gscat_extract.pro)


PURPOSE:[4]

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

 PURPOSE:

 CALLING:
	gscat_plot, gs_widget, scattm
 INPUTS:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/gscat_plot.pro)


PURPOSE:[5]

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

 PURPOSE:

 CALLING:
	Plot_Reflect, effics
 INPUTS:
	effics = array of structures, created by pro Calc_Effics.
 KEYWORDS:
	WINDOW =
	/HARDCOPY
	DIRECTORY =
 OUTPUTS:
	None.
 EXTERNAL CALLS:
	function N_struct
	function get_text_input
	pro get_window
	pro print_graphics
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/plot_reflect.pro)


PURPOSE:[6]

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

 PURPOSE:

 CALLING:
	Print_Eff_Meas, eff_meas
 INPUTS:
	eff_meas =  array of structures, created by pro get_Effic_Data.
 KEYWORDS:
	/HARDCOPY
	DIRECTORY =
 OUTPUTS:
	List of efficiency measurements is printed to screen or file.
 EXTERNAL CALLS:
	function get_text_input
	pro print_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/print_eff_meas.pro)


PURPOSE:[7]

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

 PURPOSE:

 CALLING:
	Print_Effics, effics
 INPUTS:
	effics = array of structures, created by pro Calc_Effics.
 KEYWORDS:
	/HARDCOPY
	DIRECTORY =
 OUTPUTS:
	List of calculated efficiencies is printed to screen or file.
 EXTERNAL CALLS:
	function get_text_input
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/print_effics.pro)


PURPOSE:[8]

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

 PURPOSE:

 CALLING:

 INPUTS:

 KEYWORDS:

 OUTPUTS:

 EXTERNAL CALLS:

 COMMON BLOCKS:

 PROCEDURE:

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_reflect.pro)


PURPOSE:[9]

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

 PURPOSE:

 CALLING:
	Save_Effics, eff_calc
 INPUTS:
	eff_calc = array of structures, created by pro Calc_Effics.
 KEYWORDS:
	NAME =
	DIRECTORY =
 OUTPUTS:
	Variable eff_calc saved to an XDR file.
 EXTERNAL CALLS:
	function get_text_input
	pro Set_Grat_Parms
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_effics.pro)


PUSH_IMAGE

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

 PURPOSE:
	Display an image behind all others 
	by redisplaying intersections with all other images in stacking order.

 CALLING:
	push_image, image_List, imnum

 INPUTS:
	image_List = array of structures containing image locations, levels,
		and the images scaled into byte arrays for display,
		or pointers into the pool-array supplied via keyword IMAGES.

	imnum = the index of the image in array to be pushed to the bottom.

 KEYWORDS:
	IMAGES = optional pool-array of scaled images, pointed to by image_List.

	/ERASE causes image to be erased, and others redisplayed on top.
	BORDER = color of border to display around selected image.

	LOCATION = optional 4 element array giving location of area in window,
			and this area is erased, then images are redisplayed.
 EXTERNAL CALLS:
	function Trp3D
	function intersection
	function find_images
	function get_imscaled
	pro display_image
	pro border_image
 PROCEDURE:
	Loop: Find the intersections and construct a redisplay image in memory,
	(i.e. what is behind the image to push) then tv it to window.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1991, added keywords BORDER and ERASE.
	F.V. 1991, first redisplay intersects in virtual memory, then tv it.
	F.V. 1993, added new code for arbitrary sized images,
		but kept old code because 15% faster for equal sized images.
	F.V. 1994, handle special case if all images are exactly co-located.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/push_image.pro)


PUSH_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	push_images
 PURPOSE:
	Interactively select an image and push it behind all others, 
	i.e. redisplay intersections with all other images in stacking order.
	Selection/push process continues in a loop until users aborts.
 CALLING:
	push_images, image_List, images
 INPUTS:
	image_List = array of structures containing image locations
		and the images scaled into byte arrays for display,
		or either pointers into the array supplied via second arg.
	images = optional array of scaled images, pointed to by image_List.
 EXTERNAL CALLS:
	function select_image
	pro push_image
 PROCEDURE:
	Let user select image and call pro push_image.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/push_images.pro)


READ_CCD

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

 PURPOSE:
	Cause the CCD to be read through amplifiers and A/D converters,
	and the data DMA transfered into shared memory on host computer.
	All accomplished by calling shareable object C-code in ccdmem.so.
	After read is initiated, the status is checked for completion,
	if not finished the timer is set on status (Label) widget
	to generate a read-check event in next second.

 CALLING:
	read_CCD, CCD_widget

 INPUT/OUTPUT:

	CCD_widget = structure variable, info & status of Integrate_CCD widget.

 KEYWORDS:
	/CHECK : assume read is initiated and just check status of read.

 EXTERNAL CALLS:
	pro get_CCD_status
	function ccd_amp_name
	and Call_External entry points in ccdmem.so.
 HISTORY:
	Frank Varosi NASA/GSFC 1994.
	F.V.1994, set shutter time in global memory so that cacq knows it.
	F.V.1994, option for CCD pixel binning factor.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_ccd.pro)


READ_CCD_FILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Read_CCD_File
 PURPOSE:
	Read a Photometrics CC200 CCD data file, return image and header info.
 CALLING:
	image = Read_CCD_File( filename, head_info, BINNING_FACTOR= )
 INPUTS:
	filename = string, filename including directory path.
 KEYWORDS:
	BINNING_FACTOR = integer, number of CCD image pixels on each side
			of square subset to rebin into single super-pixel.
	FILTER = optional structure containing outlier_filter parameters.
	ROTATION = index of IDL rotate function to apply to image (default=3).
 OUTPUTS:
	head_info = structure of information from CCD file header.

	Function returns an image (matrix of CCD counts) rebinned, filtered,
	and/or rotated as requested.
 EXTERNAL CALLS:
	function headinfo
	function outlier_filter
 HISTORY:
 	revised:  26-Feb-93 DAC
 revisions:  adding interpretations of additional information being loaded
 into the CC200 numeric header by the CC200 controller BASIC program CC200DC
 additions include:  date; Klinger stage positions; CCD temperature;
 laser power meter (flux monitor)
 5/10/96 if you send data from a PC to unix, byteswapping must be done.
 5/24/96 all device dependent data in integer header ihdr.
	revised:  June-Nov. 96 by FV,  added keyword options and structures.
	revised:  Dec. 96 by FV,  must convert image to float before rebin.
	revised:  Feb. 97 by FV,  allow arbitray BINNING_FACTOR,
				cropping image if necessary.
	rev: Mar.97 by FV, put the code for head_info into function headinfo.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_ccd_file.pro)


READ_DEVICE

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

 PURPOSE:
	Get the position or output of a GPIB device axis.

 CALLING:

	position = read_device( name, status, AXIS= )
   or
	position = read_device( ALIAS=, POSITION= )
   or
	position = read_device( NUM_DEV=, NUM_AXIS= )

 INPUTS:
	name = string, name of GPIB device (or use keywords instead).

 KEYWORDS:

	AXIS = string containing the name of the axis to be read,
		e.g. for Klinger controllers: either 'W', 'X', 'Y', or 'Z'.

	ALIAS = string to select device name and axis via one aliased name.

	NUM_DEV = integer, index of device in < common gpib, devices > array,
		an alternative way to select device (instead of using name).

	NUM_AXIS = integer, index of the axis in < devices(devnum).axis > array,
		an alternative way to select axis (instead of using name).

	/SCALED : then scaled position is returned, default is device units.

	/LIMIT : then returned position is limited by [min,max] in structure,
		(value stored in data structure is not limited).

 OUTPUT:
	status = (optional)
		-1 : error,
		 0 : busy or unknown,
		 1 : idle and success.
		 2 : moving (for Klinger axes).

	The function returns the position (or output) of device,
	and the result is also stored in common gpib, devices.

 EXTERNAL CALLS:
	function get_dev_num
	function get_axis_num
	pro get_by_alias
	function read_klinger
	function read_monochrom
	function read_filter
	function read_KEM
	function read_unidex
 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 PROCEDURE:
	Check device type and call corresponding device routine.
 HISTORY:
	written, Frank Varosi NASA/GSFC 1993.
	F.V. 1994, added keywords ALIAS= and /LIMIT_VALUE.
	F.V. 1995, added UNIDEX device type.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_device.pro)


READ_ELEVS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Read_ELevs
 PURPOSE:
	Read the ASCII file of energy levels obtained from TOPBASE (atomic db).
 CALLING:
	Read_ELevs, ener_file, ELevs
 INPUTS:
	ener_file = string, the name of file containing energy level info.
 OUTPUTS:
	ELevs = array of structures with tags for
		energy of level, quantum numbers, etc. (see code below).
 EXTERNAL CALLS:
	function N_struct
	pro copy_struct
	pro Modion_Status
 COMMON BLOCKS:
	common Read_ELevs, elev		(structure template)
 PROCEDURE:
	Read (with format) until end-of-file using record structure {EREC},
	then copy record structure to output structure {ELEV}.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_elevs.pro)


READ_FILTER

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

 PURPOSE:
	Get the position of the Filter Wheel.

 CALLING:
	position = read_filter( axist )

 INPUTS:
	axist = axis structure with fields: axis name, position, scaling,
		the GPIB I/O handle of the device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 OUTPUTS:
	axist = the fields of axis structure are updated to contain
		the current position of the Filter Wheel "axis".

	axist.status =
			-1 : error,
			 0 : busy or unknown,
			 1 : success.

	Function also returns the position of Filter Wheel in device units.

 EXTERNAL CALLS:
	function Poll_Device
	function IBWRITE
	function IBREAD
	function IB_error_mess
 PROCEDURE:
	Check if device is ready by calling function Poll_Device
	( which requests serial-poll status-byte via function IBRSP ).
	If ready then issue position query command and process response.
 HISTORY:
	written, Frank Varosi NASA/GSFC 1993.
	F.V. 1994, mod to use function Poll_Device.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_filter.pro)


READ_HPDAC

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

 PURPOSE:
	Read a measurement from a channel on HP-DA/CU.

 CALLING:
	position = read_hpdac( axist )

 INPUTS:
	axist = axis structure with fields: axis name, position, scaling,
		the GPIB I/O handle of the device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

	Note that the axis name combines DA measurement & channel.

 OUTPUTS:
	axist = the fields of axis structure are updated to contain
		the current measurement from HP-DA/CU channel.

	axist.status =
			-1 : error,
			 0 : busy or unknown,
			 1 : success.

	Function also returns the measurement scaled to units (float).

 EXTERNAL CALLS:
	function IBWRITE
	function Poll_Device
	function IBREAD
	function IB_error_mess
 PROCEDURE:
	Command the DA/CU to make a measurement on a channel.
	Check if data is ready by calling function Poll_Device
	( which requests serial-poll status-byte via function IBRSP ),
	then read the measurement from device.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_hpdac.pro)


READ_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	read_images
 PURPOSE:
	Read filter In & Out images from CCD data files,
	perform first level of processing, by calling function sig_ref,
	and return images & scaled images in structured inventory List.

 CALLING:
	inventory = read_images( obs_files, Magf )

 INPUTS:
	obs_files = string array of file names (with full dir path).
	Magf = magnification factor desired for display of images (default=1).

 KEYWORDS:
	PROCESS = string, specifying what to do with each In and Out image
		in order to form one image, to be placed in returned structure.
		If not specified, user can select from a menu.

	BINNING_FACTOR = the width of moving box in original pixels to be
		averaged into single pseudo-pixels by using IDL rebin func.
		Thus size of image is reduces and SNR is increased.
 OUTPUT:
	Function returns a structured array of images, to be pre-processed.

 EXTERNAL CALLS:
	function sig_ref
	function image_struct
	function scale_images
	function Error_Analysis

 COMMON BLOCKS:
	common read_images, selread

 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1991, option to read In & Out images seperately.
	F.V. 1996, mod version for TOFU

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_images.pro)


READ_KEM

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

 PURPOSE:
	Read the Keithly Electro-Meter (KEM).

 CALLING:
	position = read_KEM( axist )

 INPUTS:
	axist = axis structure with fields: axis name, position, scaling,
		the GPIB I/O handle of the device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 OUTPUTS:
	axist = the fields of axis structure are updated to contain
		the current reading of the electrometer "axis".

	axist.status =
			-1 : error,
			 0 : busy or unknown,
			 1 : success.

	Function also returns the electrometer reading in device units (float).

 EXTERNAL CALLS:
	function Poll_Device
	function IBREAD
	function round_off
 PROCEDURE:
	Check if device is ready by calling function Poll_Device
	( which requests serial-poll status-byte via function IBRSP ).
	Then read the electrometer process response.
 HISTORY:
	written, Frank Varosi NASA/GSFC 1993.
	F.V. 1994, mod to function Poll_Device.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_kem.pro)


READ_KLINGER

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

 PURPOSE:
	Get the position of a Klinger axis.

 CALLING:
	position = read_klinger( axist )

 INPUTS:
	axist = axis structure with fields: axis name, position, scaling,
		the GPIB I/O handle of the Klinger device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 OUTPUTS:
	axist = the fields of axis structure are updated to contain
		the current position/status of the Klinger device-axis.

	axist.status =
			-1 : error,
			 0 : busy or unknown,
			 1 : idle and success.
			 2 : moving.

	Function also returns the position of Klinger axis in device units.

 EXTERNAL CALLS:
	function Klinger_Status
	function IBWRITE
	function IBREAD
	function IBCMD
 RESTRICTIONS:
	The Klinger controllers must have been initialized
	at a time when the axes were not moving with "FS01" to define the
	status format as the moving/stationary status message.
 PROCEDURE:
	Check status of Klinger controller,
	if it's idle, then request position by writing the command "D",
	where  is either "W", "X", "Y", or "Z", to device,
	and then read position
 HISTORY:
	written: Frank Varosi NASA/GSFC 1993.
	F.V. 1994, mod to return immeadiately after moving/busy status is found.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_klinger.pro)


READ_LWS_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	read_LWS_images
 PURPOSE:
	Read Sig & Ref images from a LWS FITS file,
	perform first level of processing (optional),
	including 3 options for processing nodded observations,
	and return in structured inventory List.

 CALLING:
	inventory = read_LWS_images( LWS_file, Magf )

 INPUTS:
	LWS_file = string array of file name (with full dir path).
	Magf = magnification factor desired for display of images (default=1).

 KEYWORDS:
	PROCESS = string, specifying what to do with each Sig and Ref image
		in order to form one image, to be placed in returned structure.

 OUTPUT:
	Function returns a structured array of images, to be pre-processed.

 EXTERNAL CALLS:
	function readfits

 HISTORY:
	Written: Frank Varosi RITSS @ NASA/GSFC 2000.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_lws_images.pro)


READ_MAMA_FILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Read_MAMA_File
 PURPOSE:
	Read a MAMA data FITS file, return image and header info.
 CALLING:
	image = Read_MAMA_File( filename, head_info, BINNING_FACTOR= )
 INPUTS:
	filename = string, filename including directory path.
 KEYWORDS:
	BINNING_FACTOR = integer, number of MAMA image pixels on each side
			of square subset to rebin into single super-pixel.
	FILTER = optional structure containing outlier_filter parameters.
	ROTATION = index of IDL rotate function to apply to image (default=3).
 OUTPUTS:
	head_info = structure of information from MAMA file header.

	Function returns an image (matrix of MAMA counts) rebinned, filtered,
	and/or rotated as requested.
 EXTERNAL CALLS:
	function headinfo
	function outlier_filter
	pro Load_image
 HISTORY:
	Frank Varosi NASA/GSFC 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_mama_file.pro)


READ_MONOCHROM

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

 PURPOSE:
	Get the position of the MonoChromator,
	possible axes are usually:  wavelength, grating, and slit width.

 CALLING:
	position = read_monochrom( axist )

 INPUTS:
	axist = axis structure with fields: axis name, position, scaling,
		the GPIB I/O handle of the device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 OUTPUTS:
	axist = the fields of axis structure are updated to contain
		the current position of the MonoChromator "axis".

	axist.status =
			-1 : error,
			 0 : busy or unknown,
			 1 : success.

	Function also returns the position of MonoChromator in device units.

 EXTERNAL CALLS:
	function Poll_Device
	function IBREAD
	function IBWRITE
 PROCEDURE:
	Check if device is ready by calling function Poll_Device
	( which requests serial-poll status-byte via function IBRSP ).
	If ready then issue position query command and process response.
 HISTORY:
	written, Frank Varosi NASA/GSFC 1993.
	F.V. 1994, mod to function Poll_Device.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_monochrom.pro)


READ_OBS_DRO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	read_obs_dro
 PURPOSE:
	Read Sig & Ref images from DRO files, the output of IROBS program.

 CALLING:
	header = read_obs_dro( FILE=, PAIR=, sigim, refim )

 KEYWORD INPUTS:

	FILE = string, the file to read.
	PAIR = integer, the image pair number.
	SIZES = 4 integers defining size of image in file and as returned,
		default = [64,58,62,58].
	/HEAD_ONLY : return the header of data only, skip reading images.
	/FULL_HEAD : return the structure containing full header info.

 OUTPUT:
	sigim = Longword matrix, the signal image data.
	refim = Longword matrix, the reference image data.

	Function returns data header, a structure variable containing
	just part of the header, by default, or full header info if /FULL.

 EXTERNAL CALLS:
	function head_sig_ref
 COMMON BLOCKS:
	common read_obs_dro
	common read_obs_dro0, shift, zero_columns	;special pre-processing.
	common read_obs_dro1, nxL, nyL, nxp, nyp	;array sizes.
	common read_obs_dro2
 PROCEDURE:
	Associate structure of 59 blocks to obs_dro (skip 512 byte file header):
	first block (128 longwords) is header record for sig & ref pair,
	next 29 blocks: sig image (64,58) longwords (last 2 of each row empty),
	next 29 blocks: ref image (64,58) longwords (last 2 of each row empty).
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.
	F.V.1992, mod to use function reform on creation of sigim & refim.
	F.V.1994, added variables to handle other image array sizes.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_obs_dro.pro)


READ_PE

[Previous Routine] [Next Routine] [List of Routines]
 this procedure reads the raw data file written by the
	PerkinElmer reflectometer/tranmissometer into IDL.
 	inputs:
		file	filename, string
	outputs:
		wavelength		x array of tested wavelengths
		transmittance   y array of T(wavelength)
		text			optional output, text info
						such as title, units, date, etc
		written D.Content
 IDL Version 4.0.1 (Win32 x86)
 Journal File for user@Microsoft Windows Host
 Working directory: D:\winapp\rsi\idl40
 Date: Wed Jun 12 12:10:39 1996

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_pe.pro)


READ_PE_DATA

[Previous Routine] [Next Routine] [List of Routines]
 this procedure reads the raw data file written by the
	PerkinElmer reflectometer/tranmissometer into IDL.
 	inputs:
		file	filename, string
	outputs:
		wavelength		x array of tested wavelengths
		transmittance   y array of T(wavelength)
		text			optional output, text info
						such as title, units, date, etc
		written D.Content
 IDL Version 4.0.1 (Win32 x86)
 Journal File for user@Microsoft Windows Host
 Working directory: D:\winapp\rsi\idl40
 Date: Wed Jun 12 12:10:39 1996

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_pe_data.pro)


READ_PHOTION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Read_Photion
 PURPOSE:
	Read the ASCII file of photo-ionization cross-sections
	obtained from TOPBASE and store data in array of structures.
	Cross-sections are stored as Log base 10,
	frequencies are stored as Log10( Freq/F0 ) where F0 = edge-frequency.
 CALLING:
	Read_Photion, photion_file, ELevs, ion_info
 INPUTS:
	photion_file = string, the name of file containing energy levels.

	ion_info = structure, basic info about atom/ion, conversion constants.

	ELevs = array of structures with tags for
		energy of level, quantum numbers, etc. (see pro Read_ELevs).
 OUTPUT:
	ELevs = array of structures updated with handles pointing to
		photo-ionization frequency & cross-section arrays.

 EXTERNAL CALLS:
	function N_struct
	pro Modion_Status
	pro Handles_Free
 PROCEDURE:
	Read until end-of-file using photion record structure,
	find match to energy Level structure-array,
	then read phion-x-sec arrays and add dynamically using handles.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_photion.pro)


READ_TRANS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Read_Trans
 PURPOSE:
	Read the ASCII file of radiative transitions obtained from TOPBASE,
	which includes the oscillator strengths (gf). If transition gf > 0
	then the energy levels are interchanged so that the transition is
	from lower to higher energy (as for gf < 0) and then set gf = abs( gf ).
 CALLING:
	Read_Trans, rad_trans_file, Rad_Trans
 INPUTS:
	rad_trans_file = string, the file containing radiative transitions.
 OUTPUTS:
	Rad_Trans = array of structures with tags for transition quantum nums.,
		oscillator strength (gf), etc.(see code below).
 EXTERNAL CALLS:
	function N_struct
	pro copy_struct
 PROCEDURE:
	Read until end-of-file using record structure,
	then copy record structure to output structure and make adjustments.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_trans.pro)


READ_UNIDEX

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

 PURPOSE:
	Get the position of a Unidex axis.

 CALLING:
	position = read_unidex( axist )

 INPUTS:
	axist = axis structure with fields: axis name, position, scaling,
		the GPIB I/O handle of the Unidex device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 OUTPUTS:
	axist = the fields of axis structure are updated to contain
		the current position/status of the Unidex device-axis.

	axist.status =	-1 : error,
			 0 : busy or unknown,
			 1 : idle and success.
			 2 : moving.

	Function returns the position of Unidex axis in device units.

 EXTERNAL CALLS:
	function Unidex_Status
	function Unidex_Read
 PROCEDURE:
	Check status of Unidex controller for completion (idle),
	would then get position by reading the Encoder register,
	but encoders are not used, so just read the commanded position reg.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/read_unidex.pro)


REDUC_SCATT

[Previous Routine] [Next Routine] [List of Routines]
 This is a procedure to rotate scatter images and subtract a background

 Date 11/07/94
 Authors Standley & Norton

 in_image		input image to rotate
 out_image		output rotated image
 backgrd		per pixel background to subtract
 x0			x coordinate pivot point
 y0			y coordinate pivot point
 angle			angle for rotation

ro reduc_scatt,in_image,out_image,backgrd,x0,y0,angle

 calculation

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/reduc_scatt.pro)


REMOVE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
Remove images from collection by user selection.
Frank Varosi STX @ NASA/GSFC 1989.
F.V added option to Lasso images with rubber box, 1990.
F.V put Lasso and other options into pick_images, 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/remove_images.pro)


REMOVE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1989.
F.V. 1991, converted to use mosaic_specs structure.
F.V. 1991, call itself recursively to remove more mosaics.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/remove_mosaic.pro)


REMOVE_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 Remove mosaic-images from collection by user selection.
 Frank Varosi NASA/GSFC 1991.
  (adapted from remove_images)

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/remove_mosaics.pro)


REPLACE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	replace_mosaic
 PURPOSE:
	Replace a mosaic image with another, keeping the old display specs.
 CALLING:
	status = replace_mosaic( imos, jmos )
 INPUTS:
	imos = # of mosaic image to use in replacement
	jmos = # of mosaic image to replace with #imos,
		if not given, will ask user to select from a menu.
	All further inputs thru common mosaic_array.
 OUTPUTS:
	imos = jmos = # of mosaic image actually replaced, if successful.

 	Function returns 1 if a replace was successful, 0 otherwise.
	All other outputs thru common mosaic_array.
 EXTERNAL CALLS:
	function N_struct
	function select_mosaic
	pro image_remove
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/replace_mosaic.pro)


REREAD_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ReRead_images
 PURPOSE:
	Reread the images from files thereby recalculating the error properties
	and estimates of relative errors.
 CALLING:
	ReRead_images, image_List [ , INUMS=inums, /REDISPLAY ]
 INPUT and OUTPUT:
	image_List = structured array containing images and other info.
 KEYWORDS:
	INUMS = indices of filtered images in the structured array image_List.
	/REDISPLAY causes the filtered images to be rescaled and redisplayed.
 EXTERNAL CALLS:
	function sig_ref
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1997 (using pro filter_image).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/reread_images.pro)


RESIZE_WINDOW

[Previous Routine] [Next Routine] [List of Routines]
 Compute new size for window to hold images and place them in center.
 Frank Varosi NASA/GSFC 1989
 F.V.1992, restrict shift to actual pixel grid (shift MOD Magf).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/resize_window.pro)


RESTORE_EFFICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Restore_Effics
 PURPOSE:
	Restore previously saved efficiency calculations.
	Replaces existing effics variable.
 CALLING:
	Restore_Effics, effics
 INPUTS:
	None.
 KEYWORDS:
	DIRECTORY =
 OUTPUTS:
	effics = array of structures, saved by pro save_effics.
 EXTERNAL CALLS:
	function PickFile
	pro Calc_Effics
	pro copy_struct
 COMMON BLOCKS:
	common Calc_Effics, effr	;single structure template.
 PROCEDURE:
	Copy to current structure.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_effics.pro)


RESTORE_EFF_M

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Restore_Eff_M
 PURPOSE:
	Restore previously saved efficiency measurements.
	Option to merge with existing eff_meas variable.
 CALLING:
	Restore_Eff_M, eff_meas
 INPUTS:
	eff_meas = array of structures contained efficiency measurements.
 KEYWORDS:
	DIRECTORY =
 OUTPUTS:
	eff_meas = array of structures saved by pro Save_Eff_Meas,
		merged with input array if requested.
 EXTERNAL CALLS:
	function PickFile
	function yes_no_menu
	pro get_Effic_Data
	pro copy_struct
 COMMON BLOCKS:
	common get_Effic_Data, effd	;single structure template.
 PROCEDURE:
	Copy to current structure.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_eff_m.pro)


RESTORE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	restore_images
 PURPOSE:
	Restore an IDL save file containing a collection of images
	(structured array).  Files have extension:  *.iml

 CALLING:
	restore_images, TUT_images, change, DIR=direct

 INPUT and OUTPUT:

	TUT_images = structured array of images.
		Actual variable name used in IDL/XDR save file is: image_List.

 OUTPUT:
	change = 0 if nothing changed, =1 if array of images is changed.

 KEYWORDS:
	DIR_PATH = string array giving path of subdirectories.

 EXTERNAL CALLS:
	pro find_files
	function next_word
	function find_dirs
	function merge_images
	function image_struct
	function upgrade_struct
 COMMON BLOCKS:
	common image_scale, minval, maxval, topval, scale_type, minLog
	common image_scale2, smooth_flag
	common mosaic_options2, placement
	common TOFU_colors, TOFU_colors
 PROCEDURE:
	Get list of files on disk and restore one.
	Call recursively to go into sub-directories.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1990, added recursive call with folders.
	F.V. 1991, restore scale_type, minLog & colors if mode=Replace.
	F.V. 1996, mod for TOFU
	F.V. 1997, mod to use new functions: image_struct & upgrade_struct.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_images.pro)


RESTORE_INVEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	restore_inven
 PURPOSE:
	Restore an IDL save file containing an inventory of images
	(structured array) from disk.
	Files have extension:  *.inventory

 CALLING:
	restore_inven, inventory, change, DIR=direct

 INPUT and OUTPUT:

	inventory = structured array of images,
		Actual variable name used in IDL/XDR save file is: image_inven.

 OUTPUT:
	change = 0 if nothing changed, =1 if inventory of images is changed.
 KEYWORDS:
	DIR_PATH = string array giving path of subdirectories.

 EXTERNAL CALLS:
	pro find_files
	function next_word
	function find_dirs
	function image_struct
	function upgrade_struct
 COMMON BLOCKS:
	common image_scale, minval, maxval, topval, scale_type, minLog
	common image_scale2, smooth_flag
	common prep_colors, prep_colors
 PROCEDURE:
	Get list of files on disk and restore one.
	Call recursively to go into sub-directories.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1990, added recursive call with folders.
	F.V. 1991, restore scale_type, minLog & colors if mode=Replace.
	F.V. 1996, mod for TOFU
	F.V. 1997, mod to use new functions: image_struct & upgrade_struct.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_inven.pro)


RESTORE_MATHMOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	restore_MathMos
 PURPOSE:
	Restore a raw mosaic of mosaics (images of any size or type)
	and apply any defined filtering, factors, and offsets.
	Most of the work is done by function Setup_MathMos called at end.
 CALLING:
	restore_MathMos, change, DIR_PATH=
 I/O:
	All input/output is thru:
		common math_mosaics, mathmos_List, math_images, math_imscaled
	mathmos_List = array of structures containing image locations and
			pointers into the arrays: math_images & math_imscaled.
	math_images = pooled-array of image data, pointed to by mathmos_List.
	math_imscaled = pooled-array image data scaled into bytes for display.
 KEYWORDS:
	DIR_PATH = string array, path of sub-directories with no syntax.
 EXTERNAL CALLS:
 	function Setup_MathMos
	pro find_files
 	function find_dirs
 	function unique
	pro check_menu_size	(needed for Sun386i only)
	pro copy_struct
	pro color_ST_Load
 COMMON BLOCKS:
	common math_mosaics, mathmos_List, math_images, math_imscaled
	common analyze_mosaic2, mathmos_colors
	common contour_marks, sources, Labels
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990
	F.V. 1991, mod to handle arbitrary list (structure array) of mosaics,
		and to automatically get the mosaics from disk if not in memory,
		and if not found on disk it is left out (message is issued).
	F.V. 1991, restore source_marks and add to sources in common.
	F.V. 1991, use filter_image( /ALL_PIXELS ) if required by history.
	F.V. 1992, keep track of directory in which each *.mosaic file exists.
	F.V. 1993, added rotation & geometric scaling of image data.
	F.V.1996, moved mosaic image insertion code into function Setup_MathMos.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_mathmos.pro)


RESTORE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
	Restore mosaic image and specs from a file/memory by either:
	inquiring user via menu for which file to restore,
	or finding file if NAME= is specified and then restoring it.

 CALLING:
	restore_mosaic, imos, mosaic, change, DIR=direct, NAME=name

 KEYWORD INPUTS:

	DIRECTORY_PATH = string array of directory names forming a path
			to the mosaic files.

	NAME = optional string specifying exactly the name of mosaic file
		to be restored ( extension  *.mosaic is assumed).
		In this case there is no menu selection required.

 OUTPUTS:
	imos, mosaic, change

 EXTERNAL CALLS:
	pro restore_mosaicf, file, imos, mosaic, change
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
 HISTORY:
	Frank Varosi NASA/GSFC 1989.
	F.V. 1990, added recursive call with folders.
	F.V. 1991, added NAME option to restore named mosaic directly (no menu).
	F.V. 1991, mod to inquire with menu again instead of returning.
	F.V. 1991, mod to restore and use the saved mosaic_spec structure.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_mosaic.pro)


RESTORE_MOSAICF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	restore_mosaicf
 PURPOSE:
	Restore file and/or insert mosaic, mosaic_spec, and mosaic_info into
	arrays: mosaics (a memory pool), mosaic_specs, mosaic_infos.
	(called by: pro restore_mosaic, or pro Load_FITS_image).
 CALLING:
	restore_mosaicf, file, imos, mosaic, SPEC=mosaic_spec, /INSERT
 INPUTS:
	file = string, full name of file to restore into IDL,
		containing the IDL variables "mosaic" and "mosaic_spec".
   or:
	mosaic = 2-D image array to be inserted (if file is not specified).
   or:
	imos = integer index of existing mosaic in mosaic_specs strucure array,
		for use with /RELOAD keyword option. Then the
		mosaic image and specs are restored from file again.
 KEYWORDS:
	/RELOAD : restore existing mosaic directly from file so that
		last saved version replaces the current version in memory.
	/INSERT causes mosaic image input to be inserted into pooled memory.
	SPEC = mosaic_spec structure to insert into common array mosaic_specs.
 OUTPUTS:
	imos = integer, the insertion index of image in pooled memory.
	mosaic = 2-D image array, if file was restored.
	change = integer flag = 1 if image successfully inserted, 0 otherwise.
 EXTERNAL CALLS:
	funcs:	mosaic_struct	VarType		N_struct	scalar
	pros:	contour_markset	copy_struct	copy_struct_inx	image_insert
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common math_info, math_Lists
	common deconv_info, deconv_infos
	common contour_marks, sources, Labels
 PROCEDURE:
	Use copy_struct_inx to copy info from restored structure to current
	structure (which may be new version) and insert mosaic image into pool.
 HISTORY:
	Frank Varosi NASA/GSFC 1989-92.
	F.V. 1994, restore contour info from old structure to new sub-structure.
	F.V. 1997, added /RELOAD keyword option.
	F.V. 1998, get rid of duplicate source_marks positions via unique index.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/restore_mosaicf.pro)


RINGING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Ringing
 PURPOSE:
	Compute the  ringing of transmission versus wavelength,
	using a parabolic fit as reference level.
	Ringing can be defined as maximum peak-peak variation (default),
	or the maximum absolute deviation from mean reference parabolic fit,
	or the ratio of integrated deviation area over transmission area.
 CALLING:
	ringing = Ringing( wavelens, Transmission )
 INPUT:
	wavelens =
	Transmission =
 KEYWORDS:
	DEGREE = degree of polynomial fit, default=2 (parabolic fit).
	/OVERPLOT : overplot the fit.
	/AREA_RINGING : ringing = ratio of integ. dev. area over trans. area.
	/DEVIATION : ringing = max. abs. deviation from parabolic fit.
 OUTPUTS:
	Function returns a scalar value of peak-peak T ringing.
 EXTERNAL CALLS:
	function poly_fit
	function Trapex		(if /AREA)
	pro index_clumps	(if peak-to-peak default ringing is used)
 PROCEDURE:
	Fit polynomial (deg=2 or 3) and then find max & min excursions
	above and below the polynomail fit reference, then find max peak-peak.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ringing.pro)


RINGING_MAP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Ringing_Map
 PURPOSE:
	Produce map of max peak-to-mean ringing of transmission at each pixel,
	using a parabolic fit as reference mean level.
 CALLING:
	map_ringing = Ringing_Map( image_List )
 INPUT:
	image_List = structured array with fields containing image data.
	images = optional 3D array of image data if already available.
 KEYWORDS:
	IUP = input of the UP crossing subscripts (otherwise call wave_Tmap).
	IDOWN = input of the DOWN crossing subscripts.
	THRESHOLD = transmission threshold at which to fit parabolas, def=0.85.
 OUTPUTS:
	Function returns image (matrix) of max peak-peak T ringing.
 EXTERNAL CALLS:
	function N_struct
	function Ringing
	pro wave_Tmap		(if IUP & IDOWN are not passed).
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/ringing_map.pro)


SAVE_ANALYSIS

[Previous Routine] [Next Routine] [List of Routines]
Frank Varosi STX @ NASA/GSFC 1990
F.V. 1991, mod to save source_marks and mosaic_spec.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_analysis.pro)


SAVE_EFF_MEAS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Save_Eff_Meas
 PURPOSE:

 CALLING:
	Save_Eff_Meas, eff_data
 INPUTS:
	eff_data = array of structures, created by pro get_Effic_Data.
 KEYWORDS:
	NAME =
	DIRECTORY =
 OUTPUTS:
	Variable eff_data saved to an XDR file (var name is changed to protect).
 EXTERNAL CALLS:
	function get_text_input
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_eff_meas.pro)


SAVE_IMAGES

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_images.pro)


SAVE_IMAGES1

[Previous Routine] [Next Routine] [List of Routines]
 HISTORY:
	Frank Varosi NASA/GSFC 1989.
	F.V. 1991, save scale_type, smoothing, minLog & colors with images.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_images1.pro)


SAVE_INVEN

[Previous Routine] [Next Routine] [List of Routines]
 HISTORY:
	Frank Varosi NASA/GSFC 1989.
	F.V. 1991, save scale_type, smoothing, minLog & colors with images.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_inven.pro)


SAVE_MATHMOS

[Previous Routine] [Next Routine] [List of Routines]
 HISTORY:
	Frank Varosi NASA/GSFC 1990
	F.V. 1991, mod to save source_marks and mosaic_spec.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_mathmos.pro)


SAVE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	save_mosaic
 PURPOSE:
	Save mosaic image, mosaic_spec, and mosaic_info, etc. to IDL file.
	The default is to select & extract mosaic image from pool-memory, or
	if arg: mosaic_spec is specified, then it selects the mosaic to save.
	Inquires user for a new file name, or can overrite existing file.
 CALLING:
	save_mosaic, mosaic_spec, DIR=dir_path_array
 INPUTS:
	mosaic_spec = optional, structure describing mosaic image to save.
			(default is to select & extract image from pool-memory)
 KEYWORDS:
	DIRECTORY = string array, specifying directory path (no syntax).
			(default is current directory).
	MOSAIC_IMAGE = optional, 2-D image data array to save,
			(default is to select & extract image from pool-memory)
	/COLOR_SAVE : cause current color table to be saved with data,
			(default is to keep colors as in specs. structure).
	IMAGE_OVERLAY = optional, second image which is superimposed on mosaic.
	SPECS_OVERLAY = optional, structure display specs. for overlay image.
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	function N_struct
	function color_struct
	function select_mosaic
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common contour_marks, sources, Labels
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989.
	F.V. 1990: use mosaic_specs (structure) and save color table.
	F.V. 1991: mod to save mosaic_specs(imos) with mosaic image.
	F.V. 1991: if mosaic image came from "-math." save to different file.
	F.V. 1991: option to save mosaic and info to same or different file.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/save_mosaic.pro)


SCALE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scale_images
 PURPOSE:
	Select type of scaling and apply to all images.
 CALLING:
	scale_images, image_List, change
 INPUTS:
	image_List = structure array containing image data.
 OUTPUTS:
	image_List = structure array with new images scaled for display.
	change = true/false (1/0) flag indicating if scaling was changed.
 KEYWORDS:
	INUMS =
	SCALING =
	SMOOTH =
	/MENU
	/COLORSCALE
 HISTORY:
	Frank Varosi NASA/GSFC 1989.
	F.V. 1991, added smoothing option, and masking of unsmoothed border.
	F.V. 1991, upgraded smoothing option to also smooth edges (/ALL_PIX)
	F.V. 1991, added keyword INUMS = image #'s to scale.
	F.V. 1991, upgraded smoothing option to iterate, simulating gaussian.
	F.V. 1994, if blank menu option is selected then just return.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scale_images.pro)


SCALE_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
 PURPOSE:
 CALLING:
	mosaic_scaled = scale_mosaic( mosaic, mosaic_spec )
 INPUT:
	mosaic = 2D image array.
	mosaic_spec = structure with contour display specifications.
 HISTORY:
	Frank Varosi STX @ NASA/GSFC 1989.
	F.V.1990, added Log10 option.
	F.V.1990, added truncate option.
	F.V.1991, mod to use mosaic_spec structure.
	F.V.1991, added Magf < 1 option.
	F.V.1992, use fields .maxF & .minF for min-max of filtered mosaic.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scale_mosaic.pro)


SCALE_MOSAICS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	scale_mosaics
 PURPOSE:
	Select type of scaling and apply to all mosaic images.
 CALLING:
	scale_mosaics, mosaic_List, mosaic_images, mosaic_imscaled, change
 INPUTS:
	mosaic_List = structure array to keep track of all images.
	mosaic_images = pooled-array of mosaic image data.
	mosaic_imscaled = pooled-array of mosaic images scaled for displaying.
 OUTPUTS:
	mosaic_List = structure array to keep track of all images.
	mosaic_imscaled = pooled-array of mosaic images scaled for displaying.
	change = true/false (1/0) flag indicating if scaling was changed.
 KEYWORDS:
	INUMS =
	SCALING =
	SMOOTH =
	/MENU
	/COLORSCALE
 EXTERNAL CALLS:
	function check_struct
	function scale_image
	function image_extract
	pro image_insert
 HISTORY:
	Frank Varosi NASA/GSFC 1991 (adapted from scale_images).
	F.V. 1991, added flag all_pixels to use in scale_images (for smoothing).
	F.V. 1991, added keyword INUMS=subscripts to select mosaics.
	F.V. 1991, replace instead of recreate mosaic_imscaled if Magf is same.
	F.V. 1991, mod smoothing option to /ITER, approx convol by Gaussian PSF.
	F.V. 1994, if blank menu option is selected then just return.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scale_mosaics.pro)


SCAN_MONOCHROM

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

 PURPOSE:
	Scan the ACTON-SpectraPro monochromator wavelength between
	requested positions, units are nanometers.

 CALLING:
	scan_monochrom, axist

 INPUTS:
	axist = axis structure with sub-structure scan,
		having fields for desired start/stop/increment
		of device positions and the GPIB I/O handle of the device,
		(see pro gpib_dev_struct for structure definition).

 OUTPUTS:	none

 EXTERNAL CALLS:
	function Poll_Device
	function IBWRITE
	function N_struct
 PROCEDURE:
	Check if device axis is wavelength and device is idle, then
	send commands to scan the monochromator wavelength and return.
	Note that blank between value and command is required.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scan_monochrom.pro)


SCATTRD3

[Previous Routine] [Next Routine] [List of Routines]
read a Photometrics CC200 CCD data file into IDL
 IDL Version 2.0.12 (vms vax)
 Journal File for OPTIK::DAVEC
 Working directory: $1$DIA0:[DAVEC.MODIST]
 Date: Thu Dec 19 09:45:40 1991
 revised:  26-Feb-93 DAC
 revisions:  adding interpretations of additional information being loaded
 into the CC200 numeric header by the CC200 controller BASIC program CC200DC
 additions include:  date; Klinger stage positions; CCD temperature;
 laser power meter (flux monitor)
 3-MAR-93 returning above new header data in separate ascii harder (ahdr),
 integer (ihdr), &  real (rhdr) arrays.
 revised: 30-MAR-93 DC trying to get to work in IDL v3.0! try to open data
 file with "stream" keyword

 5/10/96 on unix systems, byteswapping isn't needed, on VAXes it is ...

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scattrd3.pro)


SCATTRD4

[Previous Routine] [Next Routine] [List of Routines]
read a Photometrics CC200 CCD data file into IDL
 revised:  26-Feb-93 DAC
 revisions:  adding interpretations of additional information being loaded
 into the CC200 numeric header by the CC200 controller BASIC program CC200DC
 additions include:  date; Klinger stage positions; CCD temperature;
 laser power meter (flux monitor)
 3-MAR-93 returning above new header data in separate ascii harder (ahdr),
 integer (ihdr), &  real (rhdr) arrays.
 revised: 30-MAR-93 DC trying to get to work in IDL v3.0! try to open data
 file with "stream" keyword

 5/10/96 on unix systems, byteswapping isn't needed, on VAXes it is ...
 more specifically, between CC200 data format and unix, none is required,
 but if you send data from a PC to unix, byteswapping must then be done.
 5/24/96 all device dependent data in integer header ihdr.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scattrd4.pro)


SCATT_RD

[Previous Routine] [Next Routine] [List of Routines]
read a Photometrics CC200 CCD data file into IDL
 revised:  26-Feb-93 DAC
 revisions:  adding interpretations of additional information being loaded
 into the CC200 numeric header by the CC200 controller BASIC program CC200DC
 additions include:  date; Klinger stage positions; CCD temperature;
 laser power meter (flux monitor)
 3-MAR-93 returning above new header data in separate ascii harder (ahdr),
 integer (ihdr), &  real (rhdr) arrays.
 revised: 30-MAR-93 DC trying to get to work in IDL v3.0! try to open data
 file with "stream" keyword

 5/10/96 on unix systems, byteswapping isn't needed, on VAXes it is ...
 more specifically, between CC200 data format and unix, none is required,
 but if you send data from a PC to unix, byteswapping must then be done.
 5/24/96 all device dependent data in integer header ihdr.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/scatt_rd.pro)


SCREEN_COORDIN

[Previous Routine] [Next Routine] [List of Routines]
Use actual relative Locations of images to define display screen coordinates,
  accounting for current magnification, and optional unsmoothed border.
If structure is for mosaics, the actual  of each image is used.
Frank Varosi NASA/GSFC 1991.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/screen_coordin.pro)


SELECT_FILES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	select_files
 PURPOSE:
 CALLING:
	select_files, obs_dir, obs_files
 INPUTS:
	None.
 OUTPUTS:
	obs_dir = string, directory.
	obs_files = string array of file names.
 COMMON BLOCKS:
	common select_files, dir_obs
 EXTERNAL CALLS:
	functions dir_generic, dir_path, find_dirs, unique, wmenux, yes_no_menu
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/select_files.pro)


SELECT_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	select_image
 PURPOSE:
	Allow selection with mouse (cursor) and return image number (top image),
	or optionally return subscripts of all images containing selected point.
	LEFT button selects, RIGHT button aborts (returns -4),
	MIDDLE button also aborts (-2), unless /MIDDLE set, then it selects.
 CALLING EXAMPLES:
	im_num = select_image( image_List, xi,yi )
	im_subs = select_image( image_List, /ALL )
 INPUTS:
	image_List = structured array with fields giving Location of images.
 KEYWORDS:
	/ALL to return subscripts of all images containing selected point.
	/CURSET
	/WINSET
	/MIDDLE
	/INSTRUCT to get default instructions at window top,
	INSTRUCT = string, then it is printed at top of window.
 OUTPUTS:
	xi, yi = location (x-y pixels) of cursor within image.
 EXTERNAL CALLS:
	function find_images
 PROCEDURE:
	Wait till mouse button is pressed and determine if within an image.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V.1990, added /ALL option.
	F.V.1991, added option to also select with MIDDLE button.
	F.V.1992 added wait,0.1 to avoid duplicate cursor reads,
				when called by Loop in select_images.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/select_image.pro)


SELECT_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	select_images
 PURPOSE:
	Select a bunch of images by clicking LEFT button on them, one by one,
	then MIDDLE button to indicate done, or RIGHT button to abort.
 CALLING:
	inums = select_images( image_List, /BOX )
 INPUTS:
	image_List = structured array with fields giving Location of images.
 KEYWORDS:
	/BOX_MARK to identify selections by highlighting image borders.
	/MARK_DOTS to identify selections with overlayed dot pattern (slow).
	WINDOW = (optional) window # in which images are displayed,
		default = image_List(0).windo
 RESULTS:
	Returns indices (unique subscripts) of selections from image_List,
	or returns (-4) if aborted by RIGHT button.
 EXTERNAL CALLS:
	function N_struct
	function select_image	(does actual selection, one at a time)
	function unique		(to eliminate duplicates)
	pro printw
	pro border_image
	pro border_images
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V.1990 added option to select from specified WINDOW=window only.
	F.V.1991 if tag IMSCALED does not exist use /BOX instead of /MARK.
	F.V.1992 eliminate duplicate selections.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/select_images.pro)


SELECT_LEVELS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Select_Levels
 PURPOSE:
	Called by pro Modion_Cursor to process cursor events of modion widget.
	Finds Levels within SLP and Energy values/range and toggles select flag,
	and also redisplays selected/unselected Levels with new colors.
	If keyword /MERGE is set, then the group tag is set to indicate
	that selected Levels should be merged with others in current group.
	Negative group tag means that levels are awaiting merge into superlevel,
	and positive group tags indicate a created superlevel which cannot
	be altered by this routine. Also, in normal mode of operation
	the select flag of a normal level or merging level is toggled, but
	in /MERGE mode the select flag of a normal level cannot be toggled.
 CALLING:
	Select_Levels
 INPUT/OUTPUT:
	All thru common blocks.
 KEYWORDS:
	/MERGE : selected Level(s) are included in current merge_group #.
	RESOLUTION =  # pixels around cursor defining selection in vertical 
		direction. Thus a single energy Level is selected only if
		distance between cursor and Location of Level is less.
 COMMON BLOCKS:
	common modion_ELevs, ELevs
	common modion_Coord, Coord_info
	common modion_Widget, modion_widget
 EXTERNAL CALLS:
	funcs:	Find_Levels,	it_get_color
	pros:	Conv_Loc_SLPE,	Display_NEW
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/select_levels.pro)


SELECT_MOSAIC

[Previous Routine] [Next Routine] [List of Routines]
F.V. 1989
F.V. 1991 added option to restore mosaic.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/select_mosaic.pro)


SELECT_REGION

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	select_region
 PURPOSE:
 CALLING:
	region = select_region( image_List, purpose, request )
 INPUTS:
	image_List = array of structures containing image locations & info,
 OUTPUTS:
 EXTERNAL CALLS:
 PROCEDURE:
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/select_region.pro)


SETUP_62X58

[Previous Routine] [Next Routine] [List of Routines]
device,RETAIN=1	;needed for old OpenWin-2 bug.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_62x58.pro)


SETUP_AXES

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

 PURPOSE:
	Stores setup info about axes of a single device in structured array
	(in common gpib, devices).

 CALLING:
	setup_axes, dev_name, AXES=, MINS=, MAXS=, ...

 INPUT:
	dev_name = string array, names of the devices on GPIB interface.

 KEYWORDS:

	AXES = string array of axis names for device (e.g. W, X, Y, Z).
	ALIASES = string array of alias names for each axis,
		(default = dev_name + ">" + axis).

	MINS = the minimum values allowed for each axis (in physical units).
	MAXS = the maximum values allowed for each axis.

	UNITS = string array naming the physical units of each axis.
	FORMATS = string array specifying format in which to print units.

	SCALE_FACTOR = the scale factor from device steps to physical units, 
			default = 1.

	/DEVICE_UNITS : to indicate that MINs & MAXs are given in device units,
		 default is that MINs & MAXs are given in physical units.

 EFFECTS:
	common gpib, devices ; is updated with axes mins, maxs, aliases, etc.

 EXTERNAL CALLS:
	function get_dev_num

 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_axes.pro)


SETUP_CCD

[Previous Routine] [Next Routine] [List of Routines]
device,RETAIN=1

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_ccd.pro)


SETUP_DEVICES

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

 PURPOSE:
	Stores device setup info in structured array (in common gpib, devices).

 CALLING:
	setup_devices, names, TYPE=, DESCRIP=

 INPUT:
	names = string array, names of the devices on GPIB interface.

 KEYWORDS:
	TYPE_DEVICES = string array giving the devices types
			(e.g. Klinger, DMM,...) corresponding to the names.
	Note: the device type must be specified correctly for pro init_devices.

	DESCRIPTIONS = optional string array describing each device,
			corresponding to the device names.

 EFFECTS:
	The devices array (in common gpib) is updated with types, etc.

 EXTERNAL CALLS:
	function N_struct
	pro match

 COMMON BLOCKS:
	common gpib, devices	;structured array of device names, handles, etc.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_devices.pro)


SETUP_LEAR

[Previous Routine] [Next Routine] [List of Routines]
device,RETAIN=1

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_Lear.pro)


SETUP_MAMA

[Previous Routine] [Next Routine] [List of Routines]
;print_que = ["irlaser","tek350"]

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_mama.pro)


SETUP_MATHMOS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Setup_MathMos
 PURPOSE:
	Setup a raw mosaic of mosaics (images of any size or type)
	and apply any defined filtering, factors, offsets, scaling, rotation.
	Called by Restore_MathMos.
 CALLING:
	status = Setup_MathMos( DIR_PATH= )
 I/O:
	Function returns 1 if any images were found and inserted, otherwise 0.

	All input/output is thru:
		common math_mosaics, mathmos_List, math_images, math_imscaled
	mathmos_List = array of structures containing image locations and
			pointers into the arrays: math_images & math_imscaled.
	math_images = pooled-array of image data, pointed to by mathmos_List.
	math_imscaled = pooled-array image data scaled into bytes for display.
 EXTERNAL CALLS:
 	function RotMag
 	function image_extract
	pro image_insert
	pro restore_mosaic
 COMMON BLOCKS:
	common math_mosaics, mathmos_List, math_images, math_imscaled
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
	common dir_names, dirinv, dirmos_raw, dirmos_aver
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1990
	F.V. 1991, mod to handle arbitrary list (structure array) of mosaics,
		and to automatically get the mosaics from disk if not in memory,
		and if not found on disk it is left out (message is issued).
	F.V. 1991, restore source_marks and add to sources in common.
	F.V. 1991, use filter_image( /ALL_PIXELS ) if required by history.
	F.V. 1992, keep track of directory in which each *.mosaic file exists.
	F.V. 1993, added rotation & geometric scaling of image data.
	F.V.1996, this code was in pro restore_mathmos, now called from there.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_mathmos.pro)


SETUP_RASCAL

[Previous Routine] [Next Routine] [List of Routines]
setup_devices, "filter", TYPE="FILTER", DESCRIP="ARC SpectraPro filter assembly"

setup_axes, "filter",	AXES=	"filter"	, $
			ALIAS=	"Filter"	, $
			UNITS=	""		, $
			SCALE=	1		, $
			FORM=	"(I3)"		, $
			MIN=	1,	MAX=	6

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_rascal.pro)


SETUP_SPIRAC

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

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_spirac.pro)


SETUP_USER

[Previous Routine] [Next Routine] [List of Routines]
device,RETAIN=1

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/setup_user.pro)


SET_BBT_LOCS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Set_BBT_Locs
 PURPOSE:
	Set the X-Y graphics device coordinate Locations for
	bound-bound transitions. Coordinates are obtained
	from energy Levels and SuperLevels.
 CALLING:
	Set_BBT_Locs

 INPUTS & OUTPUTS:

	All thru common blocks:

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc.

	SupLevs = array of SuperLevel structures with tags for
		average energy, effective temperature, etc.

	ion_info = structure, basic info about atom/ion.

	BB_Trans = array of structures, bound-bound transitions between Levels,
		with tags for "gf" values, wavelengths, quantum numbers, etc.

	Coord_info = structure with information to convert (x,y)
		Location coordinates back to (S,L,P) and Energy.
 COMMON BLOCKS:
	see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	pro match
 PROCEDURE:
	Match ILV_ISLP for single Levels, match group #s for SuperLevels,
	and get Locations from respective matches found.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_bbt_locs.pro)


SET_COLORS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Set_Colors
 PURPOSE:
	Set the color index tags in the structures for Energy Levels,
	SuperLevels and B-B transitions, to current respective table numbers.
 CALLING:
	Set_Colors

 INPUTS & OUTPUTS:

	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for color index of level,
		energy of level, quantum numbers, etc. (see code below).
	BB_Trans = array of structures with tags for color index of
		selected bound-bound transitions (optional).
	SupLevs = array of super-Level structures with tags for
		effective energy, effective temperature, etc. (see code below).

 COMMON BLOCKS:
	 see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_colors.pro)


SET_COORD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Set_Coord
 PURPOSE:
	Compute X-Y graphics device coordinate Locations for Energy Levels,
	and store in same structure. Also create X & Y axis Labels for display.
 CALLING:
	Set_Coord, DRAW_SIZE=dsize

 INPUTS & OUTPUTS:

	All thru common blocks:

	ELevs = array of structures with tags for energy, quantum numbers, etc.
		The graphics Location tags of structure are updated.
	E_axis = array of structures, Energy strings and Locations for Y-axis.
	L_axis = array of structures, (S,L,P) strings and Locations for X-axis.
	Coord_info = structure with information to convert (x,y)
		Location coordinates back to (S,L,P) and Energy.
 KEYWORDS:
	DRAW_SIZE = [Horiz,Vert] size of graphics, default = [2048,2048].
 COMMON BLOCKS:
	 and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	pro SupLevs_Style
	pro Set_BBT_Locs
 PROCEDURE:
	Linear mapping from SLP to X coordinate and Energy to Y coordinate.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_coord.pro)


SET_GRAT_PARMS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Set_Grat_Parms
 PURPOSE:
	Set grating parameters: angle of incidence, groove density, order,
	in the efficiency calculation structure array.
 CALLING:
	Set_Grat_Parms, effics
 INPUT/OUTPUT:
	effics = array of structures (optional) containing efficiency of grating
		and all measurements/errors/info used in computation.
 COMMON:
	common Calc_Effics, efft   (structure template, also input/output).
 EXTERNAL CALLS:
	pro X_Var_Edit
	pro copy_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_grat_parms.pro)


SET_HARD_COPY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	set_Hard_Copy
 PURPOSE:
	Interactively (via menu) set image hard-copy (PS) options for OPTICON.
 CALLING:
	HC_specs = set_Hard_Copy( bitspix, nxpix, nypix )
 INPUTS:
	bitspix = bits per image pixel for PostScript graphics.
	nxpix, nypix = size of image to be printed.
 KEYWORDS:
	/INITIALIZE : return an empty structure variable, no menu options.
 OUTPUTS:
	Function returns structure containing chosen hard-copy options.
 SIDE EFFECTS:
	Device is set to PostScript (i.e. IDL> set_plot,"PS"  is done).
 EXTERNAL CALLS:
	function get_words
	function select_number
	function get_text_input
	function find_dir
	function set_PostScript
 COMMON BLOCKS:
	common Hard_Copy, Nhc
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_hard_copy.pro)


SET_PLATE_SCALE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	set_plate_scale
 PURPOSE:
 CALLING EXAMPLE:
 INPUTS:
 KEYWORDS:
 OUTPUTS:
 EXTERNAL CALLS:
 COMMON BLOCKS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/set_plate_scale.pro)


SHOW_HEADER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	show_header
 PURPOSE:
	Print header information about images in separate window(s).
 CALLING:
	show_header, image_List
 INPUTS:
	image_List = structured array with fields containing information.
 KEYWORDS:
	IMAGES=imscaled
 EXTERNAL CALLS:
	function N_struct
	function select_image
	function pop_image
	pro show_info
	pro show_header1
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/show_header.pro)


SHOW_HEADER1

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	show_header1
 PURPOSE:
	Print single header information structure in a window.
 CALLING:
	show_header1, info_header
 INPUTS:
	info_header = structure with tags containing header information.
 EXTERNAL CALLS:
	pro print_struct
	pro get_window
	pro printw
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/show_header1.pro)


SHOW_INFO

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	show_info
 PURPOSE:
	Print information about images on the displayed images.
 CALLING:
	show_info, image_List, which_info, action
 INPUTS:
	image_List = structured array with fields containing information.
	which_info = string, values:	"source", "wavelength",
					"Logbook", "name", "date",
					"bias", "all", "history".
	action = string, "clear" or "pop", default is overwrite.
 KEYWORDS:
	WINDOW = window number, default is image_List(0).windo
	INUMS = indices used to select from image_List, default is all.
 EXTERNAL CALLS:
	function check_struct
	function select_image
	function pop_image
	pro display_images
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V., 1990, option to select and/or clear images.
	F.V., 1990, option to get menu again with middle button.
	F.V., 1991, option to select and POP image before writing info.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/show_info.pro)


SIG_REF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sig_ref
 PURPOSE:
	Call either function sig_ref_CCD or sig_ref_MAMA to
	read Sig & Ref (filter In & Out) image pair from a file,
	and perform first level of processing (optional).
	The detector CCD or MAMA is selected by string variable detector
	in common block detector.

 CALLING:
	image = sig_ref( obs_file, header, sig, ref )

 INPUT:
	obs_file = string, file name.

 KEYWORDS:
	DIRECTORY = string, obs_dir.
	PROCESS = string, specifying what to do with Sig and Ref image pair
		in order to form one image, default is do nothing.
	S_FILTER, R_FILTER = structure variables to dictate sigma filter
		paramaters for Sig and Ref images (in & out) respectively.

 OUTPUTS:
	head_i, head_o = the header info structures for in & out images.

	Function returns an image, the result of Sig & Ref pre-processing.

 EXTERNAL CALLS:
	function sig_ref_CCD
	function sig_ref_MAMA
 COMMON BLOCKS:
	common detector, detector	(value of this string is CCD or MAMA).
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1997.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sig_ref.pro)


SIG_REF_CCD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sig_ref_CCD
 PURPOSE:
	Read Sig & Ref (filter In & Out) image pair,
	that was taken by CCD detector, from a file,
	and perform first level of processing (optional).

 CALLING:
	image = sig_ref_CCD( obs_file, header, sig, ref )

 INPUT:
	obs_file = string, file name.

 KEYWORDS:
	DIRECTORY = string, obs_dir.
	PROCESS = string, specifying what to do with Sig and Ref image pair
		in order to form one image, default is do nothing.
	S_FILTER, R_FILTER = structure variables to dictate sigma filter
		paramaters for Sig and Ref images (in & out) respectively.

 OUTPUTS:
	head_i, head_o = the header info structures for in & out images.

	Function returns an image, the result of Sig & Ref pre-processing.

 EXTERNAL CALLS:
	function Read_CCD_File
	function scalar
	function outlier_filter
	function error_info
	pro sky	(from idlastrolib)
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.
	FV 1997 mod to keep bias image at full resolution, for transmission,
		images are kept at full resolution until final division,
		use new outlier_filter on I-B and O-B,
		added process options to return I-B or O-B.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sig_ref_ccd.pro)


SIG_REF_MAMA

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sig_ref_MAMA
 PURPOSE:
	Read Sig & Ref (filter In & Out) image pair,
	that was taken by MAMA detector, from a file,
	and perform first level of processing (optional).

 CALLING:
	image = sig_ref_MAMA( obs_file, header, sig, ref )

 INPUT:
	obs_file = string, file name.

 KEYWORDS:
	DIRECTORY = string, obs_dir.
	PROCESS = string, specifying what to do with Sig and Ref image pair
		in order to form one image, default is do nothing.
	S_FILTER, R_FILTER = structure variables to dictate sigma filter
		paramaters for Sig and Ref images (in & out) respectively.

 OUTPUTS:
	head_i, head_o = the header info structures for in & out images.

	Function returns an image, the result of Sig & Ref pre-processing.

 EXTERNAL CALLS:
	function Read_MAMA_File
	function scalar
	function outlier_filter
	function error_info
	pro sky	(from idlastrolib)
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1997 (based on sig_ref_CCD).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sig_ref_mama.pro)


SKY_GAIN_INTERP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sky_gain_interp
 PURPOSE:
	Setup the interpolation between sky or gain images.
 CALLING:
	sky_gain_interp, inventory, skys_gains, inums, TYPE=sgtype
 INPUT:
	inventory = structured array of images to be corrected.
 KEYWORD:
	TYPE = string: "gain" or "sky".
 OUTPUT:
	skys_gains =
	inums =
 EXTERNAL CALLS:
	function select_image
	function check_struct
	function N_struct
	function normalize
	pro conv_ascii_time
	pro min_max_set
	pro print_struct
	pro display_images
	pro show_info
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sky_gain_interp.pro)


SKY_STACK_AVERAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sky_stack_average
 PURPOSE:
	Stack a set of sky images (e.g from LWS-Keck) and average them
	into single sky image.
 CALLING:
	sky_stack_average, inventory
 INPUT:
	inventory = structured array of images to be stacked and averaged.
 OUTPUT:
	inventory = structure of single averaged sky image.
 EXTERNAL CALLS:
	function select_image
	function check_struct
	function N_struct
	function normalize
	pro conv_ascii_time
	pro min_max_set
	pro print_struct
	pro display_images
	pro show_info
 HISTORY:
	Written: Frank Varosi RITSS @ NASA/GSFC 2000.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sky_stack_average.pro)


SKY_SUB_GAIN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	sky_sub_gain
 PURPOSE:
	Select blank sky image and subtract from selected source images,
	thereby removing residual offsets due to telescope,
	or select gain image and divide (normalized) into selected images,
	thereby attempting to correct for the gain matrix of detector array.
 CALLING:
	sky_sub_gain, inventory, image_SS_FF, image_List, ReTask

 INPUT and OUTPUT:

	inventory = structured array of images to be corrected.

	image_SS_FF = structured array of images,
			corrected for residual sky or gain matrix.

	image_List = structured array of images,
			for exporting to pro mosaic (optional).
 OUTPUT:
	ReTask = string indicating next desired major function.
 EXTERNAL CALLS:
	function image_math_1
	function image_math_2
	function select_image
	function select_images
	function Lasso_images
	function normalize
	pro sky_gain_interp
	pro display_images
	and more....
 COMMON BLOCKS:
	common dir_names, dirinv, dirmos_raw, dirmos_aver
	common sky_sub_gain, N_SS_FF
	common menus, menu_window
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1989, added more options for selecting images.
	F.V. 1990, added options: match & synthesize sky image.
	F.V. 1990, added option to export directly to mosaic.
	F.V. 1991, check to see if new window can be created.
	F.V. 1991, mod allowing remove_images to act on image_SS_FF.
	F.V. 1992, added option to divide by normalized gain image.
	F.V. 1994, added option to interpolate between 2 sky or gain images.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/sky_sub_gain.pro)


SLP_CHAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SLP_char
 PURPOSE:
	Form the standard SLP string (e.g. 2Pe) from the SLP quantum numbers,
	and optionally return (S,L,P) triplet from SLP 3-digit input.
 CALLING:
	strings = SLP_char( S,L,P [, SLP=SLP ] )
 INPUTS:
	S,L,P : integers (scalars or arrays), quantum numbers 2S+1, L, parity.
 KEYWORD:
	SLP = integer (scalar or array), quantum numbers combined into 3 digits.
 OUTPUTS:
	S,L,P : if keyword SLP= is specified then S,L,P arrays are returned.
	Function returns the SLP string, e.g. 2Pe if S=2, L=1, P=1, or SLP=211.
 COMMON BLOCKS:
	common SLP_char, Lchar, Pchar
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/slp_char.pro)


SPLICE_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
Splice (no averaging) the images in raw_mosaic into one mosaic image,
Order of splicing is determined by Level (stacking) of images in raw mosaic.
Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/splice_images.pro)


STACK_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
find all other images which will be obscured by image Location,
  then return one plus the maximum Level of obscuration.
 Loc = [xmin,xmax,ymin,ymax] of new image Location.
 Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/stack_image.pro)


STACK_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 increase Levels of images(inums) by maximum Level of all images,
 in order to pop them to the top all at once.
 Frank Varosi NASA/GSFC 1989

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/stack_images.pro)


START_INTEG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	start_integ
 PURPOSE:
	Set the pixel size and tell xmacq to integrate for (dt) seconds.
 CALLING:
	start_integ, dt
 INPUTS:
	dt = integration time, in seconds.
 KEYWORDS:
	/I_32_BITS : sets pixels to be 32-bits (4 bytes), default is 16-bits.
 EXTERNAL CALLS:
	Uses entry points _pixel_size and _newint in macqmem.so,
	via Call_External, to set pixel size and start integration.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/start_integ.pro)


STATS_IN_CIRCLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Stats_in_Circle
 PURPOSE:
	Get statistics of image within a circle (specified by 2nd arg.)
	and return it as a structure.  Called by pro InBand_Fspecs.
 CALLING:
	specs = Stats_in_Circle( image, pavt )
 INPUT:
	image = 2D array, such as blue_50, red_50, av_inband_T, etc...
	pavt = structure, with center and radius of circle to analyze.
 OUTPUTS:
	Function returns structure containing statistics of image within circle.
 EXTERNAL CALLS:
	pro Look_image
	pro copy_struct
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/stats_in_circle.pro)


STAT_IMAGES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	stat_images
 PURPOSE:
	Estimate the sky level and noise in images selected interactively.
	(function Sky_Noise actually finds the st.dev. of noise and sky level)
	Return a structure array containing statistics,
	with option to order alphabetically by image name structure tag.

 CALLING EXAMPLES:

	stats = stat_images( image_List, /VERBOSE )

	stats = stat_images( image_List, image_data, /GET_FWHM )

	print_stats, stat_images( image_List, /ALL )

 INPUTS:
	image_List = array of structures containing image info, image data,
			or pointers to image data.
	image_data = optional pooled-array containing image data.
 KEYWORDS:
	GET_FWHM = 1 for Linear interp method to estimate Full-Width-Half-Max,
		   2 for Gaussian fit to profiles,
		   3 for Lorenztian fit.
		If not set, user is queried via menu for FWHM method.

	/ALL : skip the interactive selection and do all the images.
	/ALPHABETIC : sort output into alphbetic order by image names.
	/VERBOSE : print the statistics as computed.
 OUTPUTS:
	Function returns structure array containing statistics,
	pro print_stats is then called to print the results.
 EXTERNAL CALLS:
	function im_stats	;calls function Sky_Noise
	pro print_stats
	function fsort
	function N_struct
	function pick_images
	function get_image
 PROCEDURE:
	Call function pick_images, function im_stats and pro print_stats.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/stat_images.pro)


STOP_INTEG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	stop_integ
 PURPOSE:
	Tell xmacq to stop an integration (i.e. set mode= 0 ).
 CALLING:
	stop_integ
 INPUTS:
	none
 EXTERNAL CALLS:
	Uses entry point _mac_mode in macqmem.so, via Call_External.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/stop_integ.pro)


STORE_FITS_IMAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	store_FITS_imag
 PURPOSE:
	Write a mosaic image to FITS file.
	Inquire user via menu for which one to write.
 CALLING:
	store_FITS_imag, mosaic_spec, DIR=dir_path_array

 INPUTS:
	mosaic_spec = optional, structure describing mosaic image to save.
			(default is to select & extract image from pool-memory)
 KEYWORDS:
	DIRECTORY_PATH = string array of directory names forming a path.
			(default is current directory).
	MOSAIC_IMAGE = optional, 2-D image data array to save,
			(default is to select & extract image from pool-memory)
 OUTPUTS:
	none.
 EXTERNAL CALLS:
	function VarType
	function N_struct
	pro mkhdr
	pro writefits
 COMMON BLOCKS:
	common mosaic_array, mosaics, mosaic_specs, mosaic_infos
 PROCEDURE:
 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/store_fits_imag.pro)


STORE_IMAGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	store_image
 PURPOSE:
	Store header & image of MAMA data into a FITS file.
	The structure header is converted to FITS type of header.
	Note that the filename is contained in header structure fields:
	output file = header.directory + header.filename + ".fits".

 CALLING:
	store_image, header, image

 INPUTS:
	header = the image header  (structure).
	image = the image data  (2-D array).

 OUTPUTS:
	head_fits = the header from FITS file (optional).

 EXTERNAL CALLS:
	pro fxpar
	pro fxaddpar
	pro fxwrite
	pro header_to_fits
	function N_struct

 HISTORY:
	Frank Varosi NASA/GSFC 1993.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/store_image.pro)


SUPLEVS_REORDER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SupLevs_ReOrder
 PURPOSE:
	Modify group tags of SuperLevels to go in order of average energies,
	and modify group tags of Energy Levels to keep correspondence.
 CALLING:
	SupLevs_ReOrder

 INPUT & OUTPUT:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for SuperLevel merge group,
		quantum numbers, energy of level, etc.

	SupLevs = array of SuperLevel structures with tags for group,
		effective temperature, average energy, etc.

 COMMON BLOCKS:
	common modion_Widget, modion_widget
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function Fsort
 PROCEDURE:
	Construct a mapping from old group #s to new energy-sorted group #s
	and apply mapping to all structure variables having the group tag.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/suplevs_reorder.pro)


SUPLEVS_STYLE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SupLevs_Style
 PURPOSE:
	Change the appearance of SuperLevels on the display of Grotrian diagram
	between either the standard box enclosing all levels in the group or a
	single line at the average energy instead of showing the levels in box.
	The default mode (no keywords set) is to check if any are in box-style
	and if so then set all to box-style, else set all to Line-style.
	Default mode also sets the x-coordinates to standard ranges.
 CALLING:
	SupLevs_Style

 INPUT & OUTPUT:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc. (see read_elevs.pro).

	SupLevs = array of SuperLevel structures with tags for average energy,
		effective temperature, etc. (see suplev_create.pro).

 KEYWORDS:
	/BOX_STYLE : causes box around group of levels to be set for display.
	/LINE_STYLE : single line at average energy is set for displaying.

 COMMON BLOCKS:
	common modion_Widget, modion_widget
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	pro SupLevs_Style
 PROCEDURE:
	In default mode, once current style is determined call recursively.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1997, fixed bug when ng=1.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/suplevs_style.pro)


SUPLEV_CREATE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SupLev_Create
 PURPOSE:
	Merge the selected energy levels (indicated by negative group tags)
	into a SuperLevel and add to the array of SuperLevel structures.
	Negative group tags in the ELevs array then become abs( ) positive
	indicating that merging of levels is complete.
	SuperLevel energy is calculated as the Maxwell-Boltzman statistical
	average energy at a given temperature which is queried from the user.
	Optionally, can create SuperLevels for each 2S+1 and parity seperately.
 CALLING:
	SupLev_Create

 INPUT & OUTPUT:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc. (see read_elevs.pro).

	SupLevs = array of SuperLevel structures with tags for
		average energy, effective temperature, etc. (see code below).

	ion_info = structure variable with ion/atom info (see ion_info.pro).

 KEYWORDS:
	/PARITY_GROUPS : causes SuperLevels to be created for each 2S+1 value
			and parity (even/odd) seperately (merging L only),
			if selected Levels are not all the same 2S+1 & parity.
	/SET_TEMPERATURE : causes query for new effective temperature setting,
			and then just returns with no futher processing.
 COMMON BLOCKS:
	common SupLev_Create, SLev		(structure template)
		and see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function unique
	function get_text_input
	pro copy_struct
	pro print_struct
	pro Modion_Status
 PROCEDURE:
	In case of /PARITY_GROUPS call SupLev_Create recursively.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V.1997, fixed bug: SLev.np was limited to 16-bits, now 32-bits.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/suplev_create.pro)


SUPLEV_DESTROY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SupLev_Destroy
 PURPOSE:
	Ask the user to select which super-Level to breakup from
	a List of all super-Levels, then destroy the selected one
	by removing it from the array of super-Level structures
	and reseting the related energy level group tags to zero.
 CALLING:
	SupLev_Destroy

 INPUT & OUTPUT:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc. (see read_elevs.pro).

	SupLevs = array of SuperLevel structures with tags for average energy,
		effective temperature, etc. (see suplev_create.pro).
 COMMON BLOCKS:
	see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function wmenux
	pro Modion_Status
	pro Handles_Free
 PROCEDURE:
	Function wmenux creates the List widget for making the selection.	
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/suplev_destroy.pro)


TOFU

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Tofu
 PURPOSE:
	Create a Raw Mosaic out of collection of images (all same size).

 CALLING:
	Tofu, TUT_images, inventory, imcalc, Return_Task, INBAND= , OUTBAND=

 INPUTS and OUTPUTS:

	TUT_images = structured array of images, to be averaged/spliced.
	inventory = structured array of images, from pro Prep (optional).

 KEYWORDS OUTPUT:

	INBAND = structure, measured filter specs in-band.
	OUTBAND = structure, measured filter specs out ob band.

 OUTPUTS:
	imcalc = image result of computation/deconv (optional).
	Return_Task = string indicating next desired major function (optional).

 COMMON BLOCKS:
	common dir_names, dirinv, dir_images, dir_results
	common TOFU_colors, TOFU_colors
						and many more...
 EXTERNAL CALLS:

	pro Tofu_Task		(handles most generic operations)
	pro display_images
	pro centroid_images
	pro align_images
	pro save_images
	pro restore_images
	pro export_import
	pro image_math_menu
	function calc_im_stack
	function DeConv_images
	function InBand_Fspecs
				and many more...

 PROCEDURE:	Loop around menu and big CASE statement.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1989.
	F.V. 1996, modified for TOFU.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tofu.pro)


TOFU_MAIN

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

 PURPOSE:
	Main program for calling:	Prep
					Tofu
					Display
 EXECUTION:
	IDL> .run  tofu_main
   or  IDL> .run  main

	Further execution is all menu-driven.
	Information, status, and directions are printed in the terminal window
	and the info/menu_window, and the windows displaying images.

 MAIN VARIABLES:

	task = string, next task requested by user.

	inventory = array of structures containing images, locations, info, etc.
		created in pro Prep by reading data files.

	TUT_images = array of structures containing images, locations, info, ...
		imported from Prep to Tofu

 HISTORY:
	Written: Frank Varosi, NASA/GSFC, 1990 as MOSAIC,
	Modified by F.V. 1996 to create TOFU.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tofu_main.pro)


TOFU_OPTIONS

[Previous Routine] [Next Routine] [List of Routines]
	"ignore": BEGIN

		menu = ["Width of border to neglect ?",string(indgen(10))]
		sel = wmenu( menu, INIT=2, TITLE=0 ) > 1
		border_ignore = sel-1
		print," width of ignored border = ", strtrim( border_ignore,2 )
	     END

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tofu_options.pro)


TOFU_SETUP

[Previous Routine] [Next Routine] [List of Routines]
 FILE:
	tofu_setup.pro
 PURPOSE:
	Do NOT modify this file!
	This file should be linked to: ~/tofu/setup.pro
	so that it is automatically executed by ~/idl/idl_startup.pro
	(need:  setenv  IDL_STARTUP  ~/idl/idl_startup.pro).
	Copy and put any desired modifications and variable settings in: 
	~/tofu/setup_user.pro,  which is invoked at end of this IDL script.
 HISTORY:
	Written by Frank Varosi, NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tofu_setup.pro)


TOFU_TASK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Tofu_Task
 PURPOSE:
	Perform tasks commonly requested by MOSAIC & PREP & ANALYZE,
	by routing request to other procedures and function.
 CALLING:
	Tofu_Task, task, request, image_List
 INPUTS:
	task = string, the task to be performed (a single word, see code cases).
	request = string, more information about the task to be performed,
			(usually the first word of request is checked).
	image_List = array of structures containing image locations & info,
		and the images scaled into byte arrays for display,
		or pointers into the arrays DATA_IMAGES & SCALED_IMAGES.
 KEYWORDS:
	DATA_IMAGES = optional array of image data, pointed to by image_List.
	SCALED_IMAGES = optional array of images scaled into bytes for display.
 OUTPUTS:
	image_List = this array of structures could be modified by user choices,
			and the KeyWord arrays may also be modified.
 EXTERNAL CALLS:
	Very many, see code...
 COMMON BLOCKS:
	common dir_names, dirinv, dirmos_raw, dirmos_aver
 PROCEDURE:
	Big CASE statement calls other routines to do the work.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1989 (originally mosaic_task).
	F.V. 1991, use new /RESIZE keyword of display_images.
		and set /SHOW_NUMBER keyword option of border_images.
	F.V. 1992, added options: show statistics, plot profiles/spectrum.
	F.V. 1993, added keywords DATA_IMAGES and SCALED_IMAGES for when
		structure image_List has pointer to data and/or scaled data.
	F.V. 1997, added probe_image option.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tofu_task.pro)


TQCM_MONITOR

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

 PURPOSE:
	Create widget interface (GUI) to monitor the TQCM which is read
	by means of the HP-3412A Data Acquisition device.
	The temperature (voltage) and frequency reads are done periodically
	by widget timer events.

 CALLING:
	TQCM_monitor, dev_name

 INPUT:
	dev_name = string, GPIB device name of HP-3412A Data Acquisition Unit,
		(default = "hpdac").

 KEYWORDS:

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	PARENT = the ID of the widget which is to be the base of the
		new widget created by this procedure. If specified,
		this TQCM_monitor widget is just defined but not realized.

	XPOS, YPOS = desired position on screen of free base (no parent) widget.

 EXTERNAL CALLS:

	pro Xmanager
	pro TQCM_Event		(event handler called by Xmanager)
	pro iconify_windows
	functions get_dev_num, N_struct, get_words, check_dir

 COMMON BLOCKS:
	common gpib, devices
 PROCEDURE:
	Create a base, and register the widgets with the Xmanager.
 HISTORY:
	Written: Frank Varosi HSTX @ NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tqcm_monitor.pro)


TQCM_PLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	TQCM_plot
 PURPOSE:
	Plot the TQCM temperature, frequency, freq. rate of change, vs. time.
	Called by TQCM_event, the widget event handler for TQCM_monitor.
 CALLING:
	TQCM_plot, TQCM_widget, tfh
 INPUT:
	TQCM_widget = structure with graphing specifications.
	tfh = array of structures with time, temp, freq, freq-rate fields.
 EXTERNAL CALLS:
	function N_struct
	pro get_window
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tqcm_plot.pro)


TQCM_RECORD

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	TQCM_record
 PURPOSE:
	Record the TQCM temperature, frequency, freq. rate of change, and time,
	to a file (appended), and update the status widgets.
	Called by TQCM_event, the widget event handler for TQCM_monitor.
 CALLING:
	TQCM_record, axes, TQCM_widget, tfh
 INPUTS:
	axes = structure array, containing position of temp. and freq. axes.

 COMMON BLOCKS:

 	common TQCM_monitor, TQCM_widget
	TQCM_widget = structure with widget info.

	common TQCM_history, tfh
	tfh = array of structures with time, temp, freq, freq-rate fields.
		updated with new element upon each call.

 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tqcm_record.pro)


TQCM_SAVE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	TQCM_save
 PURPOSE:
	Record the TQCM temperature, frequency, freq. rate of change, and time,
	to a file (appended), and update the status widgets.
	Called by TQCM_event, the widget event handler for TQCM_monitor.
 CALLING:
	TQCM_save

 COMMON BLOCKS:

 	common TQCM_monitor, TQCM_widget
	TQCM_widget = structure with widget info.

	common TQCM_history, tfh
	tfh = array of structures with time, temp, freq, freq-rate fields.

	Both variables are saved to TQCM_widget.file
	(with .save in place of .record of the filename).

 EXTERNAL CALLS:
	functions N_struct, check_dir, substwid
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1994.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/tqcm_save.pro)


TRANSREDUC

[Previous Routine] [Next Routine] [List of Routines]
 reduce transmission data in IDL
 revised:  14-june-96 TAN
 laser power meter (flux monitor) accounted for
 varying integration times between I and IO accounted for
 bias level of the detector accounted for at constant of 147 counts/pixel

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/transreduc.pro)


TRANSREDUC1

[Previous Routine] [Next Routine] [List of Routines]
 reduce transmission data in IDL
 revised:  10-june-96 TAN
 laser power meter (flux monitor) accounted for
 varing integration times between I and IO accounted for
 bias level of the detector accounted for at constant of 147 counts

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/transreduc1.pro)


UNDO_FACTORS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	undo_factors
 PURPOSE:
	Undo factors & offsets that were applied to images.
 CALLING EXAMPLE:
	undo_factors, image_List, INUMS=inums, /REDISPLAY
 INPUTS:
 KEYWORDS:
 OUTPUTS:
 EXTERNAL CALLS:
 COMMON BLOCKS:
 PROCEDURE:
 MODIFICATION HISTORY:
	Written, Frank Varosi NASA/GSFC 1992.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/undo_factors.pro)


UNIDEX_ADC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Unidex_ADC
 PURPOSE:
	Command UNIDEX controller to perform Analog to Digital conversion
	of voltage at analog input and read back the value (fraction of 10 V).
 CALLING:
	value = Unidex_ADC( dev_handle )
 INPUT:
	dev_handle = Longword, the GPIB device handle.
 OUTPUT:
	ibstat = GPIB write status code (optional).

	Function returns the value of A/D conversion (8 bit resolution),
	which is a fraction of 10 volts, if PRM:140 scale factor = 1.
 EXTERNAL CALLS:
	function IBWRITE
	function Unidex_Read
 PROCEDURE:
	Send the host mode command string which puts A/D convert result
	into floating var. # 1, then read and return the float.var.#1 value.
	Must wait a short time after sending host mode immeadiate command (ADC).
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_adc.pro)


UNIDEX_BUTTONS

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

 PURPOSE:
	Create widget interface to control a particular Unidex device
	by means of an exclusive array of buttons commanding preset moves.

 CALLING:
	Unidex_Buttons, dn, axn

 INPUTS:
	dn = device number (referring to structure in common gpib, devices).
	axn = axis number (referring to structure devices(dn).axis).

 KEYWORDS:
	BASE = id of the device base widget, otherwise assume this routine
		has been called and axis base already exists.

	/HIDE : hide all controls, just create a button to show if desired.
	/SHOW : show all controls.

 EXTERNAL CALLS:
	function read_device
	function CW_pdmenu
	function CW_bgroup
	function since_version
 COMMON BLOCKS:
	common gpib, devices
 HISTORY:
	Written: Frank Varosi HSTX @ NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_buttons.pro)


UNIDEX_CONTROL

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

 PURPOSE:
	Create widget interface (GUI) to control the Unidex device axes
	by means of sliders, text entry, and buttons.

 CALLING:
	Unidex_Control, dev_names

 INPUT:
	dev_names = string array,
		GPIB device names of Unidex motion controllers.
		Note that there is only one axis per controller.

 KEYWORDS:

	PRESETS = array of structures containing preset moves for certain
		devices and the buttons names to correspond with the moves.

	GROUP = the ID of the widget that calls this procedure,
		if specified, death of caller results in death of this widget.

	XPOS, YPOS = desired position on screen of base widget.

 EXTERNAL CALLS:

	pro Unidex_Slider
	function get_dev_num
	function strconcat
	pro Xmanager
	pro Unidex_Event

 COMMON BLOCKS:
	common gpib, devices
 PROCEDURE:
	Create a base, call pro Unidex_Slider to create widgets for each axis,
	and register the widgets with the Xmanager.
 HISTORY:
	Written, Frank Varosi HSTX @ NASA/GSFC 1995 (based on Klinger_Control).

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_control.pro)


UNIDEX_FEEDBACK

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Unidex_FeedBack
 PURPOSE:
	Get feedback from the Unidex motion controller
	by reading the analog or digital inputs.
	Analog is scaled and displayed as volts in widget,
	or first 3-bits of digital input is mapped and displayed in widget.
 CALLING:
	Unidex_FeedBack, dev_num
 INPUT:
	dev_num = device number (in structure array: common gpib, devices).
 OUTPUT:
	Common block and widgets are modified,
	optional output:
		fval = feedback.fvalue	from ADC
		bval = feedback.bvalue	from DIN
 COMMON BLOCKS:
	common gpib, devices	(structures, all the info about GPIB devices).
	common Unidex_FeedBack, Locmap	(input bits mapped to true Locations)
 EXTERNAL CALLS:
	function Unidex_ADC
	function Unidex_Read
	function N_struct
 PROCEDURE:
	Get the feedback via A/D convert or reading digital input register
	and set the widget to display feedback value.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_feedback.pro)


UNIDEX_READ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Unidex_Read
 PURPOSE:
	Read the value of a parameter, register, or variable on the Unidex
	motion controller, while in the GPIB host mode of operation.
 CALLING:
	value = Unidex_Read( dev_handle, parm_reg_num  )
 INPUT:
	dev_handle = Longword, the GPIB device handle.
	parm_reg_num = the id number of the parameter/register/variable to read.
 KEYWORDS:
	/REGISTER : to indicate the target is a register, default is parameter.
	/ONLY_READ : set to indicate the target is a read only register.
	VARTYPE = string indicating type of variable to read (overrides /REG):
		"I" = integer, "L"=Longword, "F"=floating, "P"=port.
 OUTPUT:
	ibstat = GPIB write status code (optional).

	Function returns the value of parameter or register.
 EXTERNAL CALLS:
	function IBWRITE
	function IBREAD
	function scalar
	function IB_error_mess
 PROCEDURE:
	Form the host mode command string and send it, then read a value.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_read.pro)


UNIDEX_SLIDER

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

 PURPOSE:
	Create widget interface to command a Unidex controller (GPIB device)
	by means of sliders, text entry, and move/reset/options buttons.

 CALLING:
	Unidex_Slider, dn, axn

 INPUTS:
	dn = device number (index in structure array: common gpib, devices).
	axn = axis number (referring to structure devices(dn).axis(axn)).

 KEYWORDS:
	BASE = id of the device base widget, otherwise assume this routine
		has been called and axis base already exists.
	SLIDER_INCREM = optional increment for slider, default=1.

	/HIDE : hide all controls, just create a button to show if desired.
	/SHOW : show all controls.
	/INCREMENTAL : create widgets for incremental moving mode (no slider).

 COMMON BLOCKS:
	common gpib, devices	(structures, all the info about GPIB devices).
 EXTERNAL CALLS:
	function read_device
	function CW_pdmenu
	function Widget_Lab_Text
	function since_version
 HISTORY:
	Written: Frank Varosi HSTX @ NASA/GSFC 1995 (based on Klinger_Widget).
	F.V.1996, added widget button & label for device feedback.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_slider.pro)


UNIDEX_STATUS

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

 PURPOSE:
	Get the status of a Unidex device & axis.

 CALLING:
	Unidex_Status, axist

 INPUTS:
	axist = axis structure with fields: axis name, position, status,
		the GPIB I/O handle of the Unidex device,
		and the I/O handle of the GPIB bus, etc.,
		(see gpib_dev_struct for structure definition).

 KEYWORDS:
	/WAIT or WAIT = seconds to wait in loop checking until status=1 (OK).
			(calls function recursively in loop).
	MAXTRY = max # of checks for status=1 in wait loop, default = 20.

 OUTPUTS:
	axist = the status field of axis structure is updated with
		the current status of the Unidex device & axis.

	Function returns the value of axist.status:
			-1 : error,
			 0 : busy or unknown,
			 1 : idle and in position.
			 2 : moving.
 EXTERNAL CALLS:
	function Unidex_Read
	function Unidex_Status
 PROCEDURE:
	Check the status registers of Unidex controller for motion/completion.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.
	FV 1996, added keyword options /WAIT and MAXTRY.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_status.pro)


UNIDEX_WRITE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Unidex_Write
 PURPOSE:
	Modify the value of a parameter or register of the Unidex motion
	controller, while in the GPIB host mode of operation.
 CALLING:
	Unidex_Write, dev_handle, parm_reg_num, value [, ibstat ]
 INPUT:
	dev_handle = Longword, the GPIB device handle.
	parm_reg_num = the id number of the parameter or register to modify.
	value = new value of parameter or register.
 KEYWORDS:
	/REGISTER : to indicate the target is a register, default is parameter.
	/ONLY : set to indicate the target is a write only register.
 OUTPUT:
	ibstat = GPIB write status code.
 EXTERNAL CALLS:
	function IBWRITE
 PROCEDURE:
	Form the host mode command string and send it with the new value.
 HISTORY:
	written: Frank Varosi NASA/GSFC 1995.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/unidex_write.pro)


WAVECEN

[Previous Routine] [Next Routine] [List of Routines]
ACS/TUT specific routine - find central wavelength for each TUT pixel
inputs:	inventory -- should include .01 edges on red & blue sides
		blue01map	- wavelengths for each pixel for blue01edge
		red01map	-wavelengths for each pixel for red01edge
output:	wavecenmap	-integer(nm) wavelength for equal area in
				each direction == central wavelength.

 IDL Version 4.0.1 (sunos sparc)
 Journal File for acs@michelson
 Working directory: /home/acs/tofu
 Date: Fri Sep 20 14:37:30 1996

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/wavecen.pro)


WAVEMAPATT

[Previous Routine] [Next Routine] [List of Routines]
pro Wave_Map_at_T  map wavelengths at which transmission = Tval
ACS/TUT specific routine, written 9/19/96 D. Content
inputs:
	inventory	set of TUT images at a range of wavelengths
	Tval		specific (scalar) value of transmission to find
 (optional)	rising	flag, if not present or 1, look for first W at which
			T rises to Tval; if ne 1, look for falling edge
output:
	Wmap		wavelength for each pixel at which T=Tval

modification history:


test to see if enough parameters were passed

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/WaveMapAtT.pro)


WAVE_TCENTER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	wave_Tcenter
 PURPOSE:
	Produce map of central wavelengths:
	the wavelength where integrated transmission of filter is half of total.
 CALLING:
	center_wavel_map = wave_Tcenter( image_List )
 INPUT:
	image_List = structured array with filter transmission images.
 KEYWORDS:
	IUP = input of the UP T=1% crossing subscripts.
	IDOWN = input of the DOWN T=1% crossing subscripts.
	IMAGES = optional input of 3D array of image data if available,
		this just to save the trouble of re-extracting from structure.
		Note that this routine will overwrite the array with integral.
	WHERE_FBP = optional array of subscripts indicating which pixels
		are actually measuring the filter bandpass (default is all).
 OUTPUT:
	T_half_integ = optional output image of half integral of Transmission.

	Function returns image (matrix) of center wavelengths (interpolated).

 EXTERNAL CALLS:
	function N_struct
 PROCEDURE:
	Integrate transmission vs. wavelength using trapezoidal rule,
	for all image pixels simultaneously, then search for half of total
	looping over all pixels in filter data.
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/wave_tcenter.pro)


WAVE_TMAP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	wave_Tmap
 PURPOSE:
	Produce map of wavelengths at which transmission crosses a threshold.
 CALLING:
	wave_Tmap, image_List
 INPUT:
	image_List = structured array with fields containing image data.
 KEYWORDS:
	THRESHOLD = transmission threshold, default = 0.5.
	/INTERPOLATE : interpolate wavelengths to get exact threshold crossing.
	IMAGES = optional I/O of 3D array of image data (used internally).
	IUP = output of the UP crossing subscripts.
	IDOWN = output of the DOWN crossing subscripts.
 OUTPUTS:
	wave_up = wavelength at which transmission goes above threshold.
	wave_down = wavelength at which transmission goes below threshold.
	avtran = average transmission between up & down wavelengths.
 EXTERNAL CALLS:
	function N_struct
 HISTORY:
	Written, Frank Varosi NASA/GSFC 1996.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/wave_tmap.pro)


WRITE_ISA_WIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Write_ISA_Wind
 PURPOSE:
	Write selected levels & transitions and to a formatted file
	for use by the ISA-Wind stellar model.
	Write approximate cross-sections to a separate file.
 CALLING:
	Write_ISA_Wind
 INPUTS:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc.

	SupLevs = array of SuperLevel structures with tags for
		average energy, effective temperature, etc.

	ion_info = structure, basic info about atom/ion.

	BB_Trans = array of structures, bound-bound transitions between Levels,
		with tags for "gf" values, wavelengths, quantum numbers, etc.
 OUTPUTS:
	None explicit.
	Creates new files with names of form:  ISA-Wind_*.atom  & RBF_*.dat.
 COMMON BLOCKS:
		see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function Fsort
	pro match
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V. 1995, match BB_Trans levels with ELvs thus checking consistency.
	F.V. 1995, combine SuperLevels with selected single Energy Levels.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/write_isa_wind.pro)


WRITE_TLUSTY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	Write_TLUSTY
 PURPOSE:
	Write selected levels, transitions and approximate cross-sections
	to a formatted file for use by the TLUSTY stellar model.
 CALLING:
	Write_TLUSTY
 INPUTS:
	All thru common blocks in file: ~/modion/code/modion_common.pro

	ELevs = array of structures with tags for energy of level,
		quantum numbers, graphics Locations, etc.

	SupLevs = array of SuperLevel structures with tags for
		average energy, effective temperature, etc.

	ion_info = structure, basic info about atom/ion.

	BB_Trans = array of structures, bound-bound transitions between Levels,
		with tags for "gf" values, wavelengths, quantum numbers, etc.
 OUTPUTS:
	None explicit. (creates new file with name of form:  tlusty_*.dat)
 COMMON BLOCKS:
		see file: ~/modion/code/modion_common.pro
 EXTERNAL CALLS:
	function N_struct
	function Fsort
	pro match
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1995.
	F.V. 1995, match BB_Trans levels with ELvs thus checking consistency.
	F.V. 1995, combine SuperLevels with selected single Energy Levels.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/write_tlusty.pro)


ZOOM_MOSAIC

[Previous Routine] [List of Routines]
 NAME:
	zoom_mosaic
 PURPOSE:
	If mosaic_spec.zoom_enable=1 then return zoomed region of mosaic image.
	The mosaic_spec.zoom field of structure defines zoomed region.
	/SET_ZOOM allows interactive specification of the zoomed region,
	and then the average zoom factor is returned.
 CALLING:
	mosaic_zoom = zoom_mosaic( mosaic_spec, mosaic )
   or:
	zoom_factor = zoom_mosaic( mosaic_spec, /SET_ZOOM )
 INPUTS:
	mosaic_spec = structure variable containing all display info.
	mosaic = the image described by mosaic_spec (not used if /SET_ZOOM).
 KEYWORDS:
	/SET_ZOOM : interactive mode for specification of the zoomed region,
		thereby setting the  field of structure.
 OUTPUTS:
	mosaic_spec = structure variable containing new zoom info.
 RESULTS:
	Function returns a subregion (2-D array) of mosaic image,
	or if /SET_ZOOM then it returns a vector of zoom factors.
 EXTERNAL CALLS:
	pro window_set_show
	pro image_sections
	pro rotate_coordin
	pro printw
	pro box_draw
	pro box_erase
	function box_create
 PROCEDURE:
	If-then-else statement checks for one of three basic options:
	if /SET_ZOOM, or if mosaic_spec.zoom_enable, or else do nothing.
	Section for /SET_ZOOM has a lot of interactive options.
 HISTORY:
	Written: Frank Varosi NASA/GSFC 1991.
	Mod F.V. 1992, added option to specify zoom coordinates,
			and can now zoom the zoom (subregion or larger region).
	Mod F.V. 1993, added option to zoom quadrants in sequence.
	Mod F.V. 1998, option to zoom by coordinates now just asks for range.

(See /host/bluemoon/usr2/idllib/astron/contrib/varosi/code/allpro/zoom_mosaic.pro)