Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/display_inband1.pro'
;+
; 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.
;-

pro Display_InBand1, inbsp, WINDOW=windo, XPOS=xpos, YPOS=ypos, TITLE=title, $
				COMMENT=comment, INFO=info

   common Display_InBand, topval, circle
   common site_name, site_name

	if N_struct( inbsp ) NE 1 then begin
		if (N_elements( windo ) EQ 1) AND $
		   ((!D.flags AND 256) EQ 256) then wdelete,windo
		return
	   endif
	sz = size( inbsp.image )

	if !D.name EQ "PS" then begin
		Magf = round( float( !D.x_size )/sz(1) )
	 endif else begin
		Magf = ceil( float( (!D.table_size + 30) > 200 )/sz(1) )
	  endelse

	xyc = [ inbsp.xcen, inbsp.ycen ]
	xycmag = (xyc+0.5) * Magf
	radmag = inbsp.radius * Magf

	name = get_words( tag_names( inbsp,/STRUC ), DEL="_" )
	name = strconcat( name(0:N_elements(name)-2) + " " )

	get_window, windo, XSIZ=Magf*sz(1) + 100, $
			YSIZ=Magf*sz(2) + fix( !D.y_ch_size * 1.5 ), $
			TIT=name,/SHOW, XPOS=xpos, YPOS=ypos
	erase
	tvs, inbsp.image, MIN=inbsp.min, MAX=inbsp.max, MAG=Magf, $
			COLOR_BAR=2, TOPVAL=topval, BOT=1

	if VarType( title ) NE "STRING" then title = name
	radtit = strtrim( inbsp.radius, 2 ) + $
		"  (" + strtrim( inbsp.radius * inbsp.Bin_Factor, 2 ) + ")"

	if !D.name EQ "PS" then begin
		if N_elements( circle ) LT 2*360 then begin
			angle = 2 * !PI * findgen( 361 )/360
			circle = [ [cos(angle)], [sin(angle)] ]
		   endif
		cr = circle * (radmag + 13)
		cx = cr(*,0) + xycmag(0)
		cy = cr(*,1) + xycmag(1)
		plots, cx, cy, COL=0,/DEV
		cr = circle * radmag
		cx = cr(*,0) + xycmag(0)
		cy = cr(*,1) + xycmag(1)
		plots, cx, cy, COL=!D.table_size-1,/DEV
		xyouts,/NORM, 0, 1.05, title
		xyouts,/NORM, -0.1, 1.55, "Filter:    " + inbsp.filter_name
		if N_elements( info ) GT 0 then begin
			for i = 1, (N_elements( info )<6) do $
			   xyouts,/NORM, -0.1, 1.5-0.05*i, info(i-1),SIZ=0.9
		   endif
		xybs = strtrim( xyc, 2 )
		xyubs = strtrim( xyc * inbsp.Bin_Factor, 2 )
		subtit = [ "Bin Factor = " + strtrim( inbsp.Bin_Factor,2 ), $
			   "Circle Radius = " + radtit, $
			   "Center X = " + xybs(0) + $
				"  Y = " + xybs(1) + $
				"    (" + xyubs(0) + "," + xyubs(1) + ")", $
			   "peak Wavelen = " + $
				string( inbsp.peak_wave, F="(F6.1)" ), $
			   "T peak = " + string( inbsp.Tpeak, F="(F5.3)" ) ]
		for i=1,N_elements( subtit ) do $
			xyouts,/NORM, -0.1, -0.07*i, subtit(i-1)
		subinfo = [ "mean = ", "st.dev. = ", $
			"max - mean = ", "mean - min = ", "max - min = " ]
		subvals = [ string( inbsp.mean, F="(G10.4)" ), $
				string( [ inbsp.stdev, $
					inbsp.max - inbsp.mean, $
					inbsp.mean - inbsp.min, $
					inbsp.max - inbsp.min ], F="(G9.3)" ) ]
		xyouts,/NORM, 1, -0.1, title, AL=0.5
		for i=1,N_elements( subinfo ) do $
			xyouts,/NORM, 1, -0.07*i-0.1, subinfo(i-1), AL=1
		for i=1,N_elements( subvals ) do $
			xyouts,/NORM, 1, -0.07*i-0.1, subvals(i-1)
		if VarType( comment ) EQ "STRING" then $
			xyouts,/NORM, -0.1, -0.7, comment
		if VarType( site_name ) EQ "STRING" then $
			xyouts,/NORM, -0.1, -0.8, site_name + "   " + the_date()
	 endif else begin
		tvcircle, radmag, xycmag(0), xycmag(1), COL=!D.table_size-1
		tvcircle, radmag + 1, xycmag(0), xycmag(1), COL=0
		printw, title + "    R=" + radtit, LINE=-1, XOFF=1
	  endelse

	if !DEBUG GT 1 then stop
end