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

pro Display_InBand, fs_inband, image_List, CWAVE_ONLY=cw_only, $
				HARDCOPY=hardcopy, SHOW_GRAPHS=show_graphs

   common Display_InBand1, win_B_50, win_R_50, win_avt, win_cwav, win_ring
   common Display_InBand2, win_BS_high, win_BS_Low
   common Display_InBand3, win_RS_high, win_RS_Low
   common Display_InBand4, win_tc
   common site_name, site_name
   common print_queue, print_que
   common InBand_Fspecs, win_pavt

	if N_struct( fs_inband ) NE 1 then begin
		message,"nothing to display" + string(7b),/INFO
		print," first analyze InBand Filter Specs"
		return
	   endif

	if keyword_set( hardcopy ) then begin

		menu = ["Select Hardcopy Mode:",$
			"B & W (grey scale)", "COLOR","abort Hardcopy"]
		colorflag = (( wmenu( menu, INIT=1, TIT=0 ) - 1) > 0 )
		if (colorflag GT 1) then return
		PS_mode = ["_bw","_color"]
		PS_file = find_dir( "save" ) + $
			get_text_input( "PS output file name ?", $
					DEF=fs_inband.filter_name ) $
						+ PS_mode(colorflag) + ".ps"
		comment = get_text_input( ["File = " + PS_file, $
					"comment on output ?"] )
		message,"writing PS to file:  " + PS_file,/INFO
		psport,/SQUARE, FILE=PS_file
		plot_Peak_Tr, fs_inband.Tpeak_Radii, MAX_RADIUS=fs_inband.radius
		if VarType( comment ) NE "STRING" then comment=""
		if VarType( site_name ) NE "STRING" then $
			site_name="NASA/GSFC/DGEF"
		xyouts,/NORM, 0, -0.15, comment
		xyouts,/NORM, 0, -0.2, site_name + "   " + the_date()
		plot_TranSpec, fs_inband, /RINGING
		xyouts,/NORM, 0, -0.15, comment
		xyouts,/NORM, 0, -0.2, site_name + "   " + the_date()
		plot_TranSpec, fs_inband, /ERROR
		xyouts,/NORM, 0, -0.15, comment
		xyouts,/NORM, 0, -0.2, site_name + "   " + the_date()
		device, BIT=8, XS=10, YS=10, XOFF=5, YOFF=9, COLOR=colorflag

	 endif else if keyword_set( show_graphs ) then begin

		get_window, win_pavt,/SHOW
		plot_Peak_Tr, fs_inband.Tpeak_Radii, MAX_RADIUS=fs_inband.radius
		plot_TranSpec, fs_inband, /RINGING
	  endif

	if N_struct( image_List ) GT 0 then begin
		date_time, image_List.info, dates, times, ymd
		dates = dates( unique( ymd,/SORT ) )
		dirs = get_words( image_List.info.file_name, DEL="/" )
		Nwave = N_elements( image_List )
		dirs = reform( dirs, N_elements(dirs)/Nwave, Nwave )
		sz = size( dirs )
		dirs = strconcat( transpose( dirs( 0:sz(1)-2, * ) ) + "/" )
		dirs = dirs( unique( dirs,/SORT ) )
		dirs(0) = "Directories:	   " + dirs(0)
		if N_elements( dirs ) GT 1 then $
					dirs(1:*)="___________"+dirs(1:*)
		sinfo = [ "Measurement Dates:  " + strconcat( dates + ",  " ), $
			image_List(0).winame, dirs ]
	   endif

	if keyword_set( cw_only ) then goto,CWAVE

; 50% Transmission:

	Display_InBand1, fs_inband.Blue_50, WIN=win_B_50, $
					COMMENT=comment, INFO=sinfo, $
					TIT="Blue (nm) @ 50% peak T", $
					XPOS=10, YPOS=!DEVY - 250

	Display_InBand1, fs_inband.Red_50, WIN=win_R_50, $
					COMMENT=comment, INFO=sinfo, $
					TIT="Red (nm) @ 50% peak T", $
					XPOS=400, YPOS=!DEVY - 250
; High Slopes:

	Display_InBand1, fs_inband.Blue_Slope_High, WIN=win_BS_high, $
						COMMENT=comment, INFO=sinfo, $
						XPOS=10, YPOS=330

	Display_InBand1, fs_inband.Red_Slope_High, WIN=win_RS_high, $
						COMMENT=comment, INFO=sinfo, $
						XPOS=400, YPOS=330
; InBand_T & Ringing:

	Display_InBand1, fs_inband.Tav_InBand, WIN=win_avt, $
						COMMENT=comment, INFO=sinfo, $
						TIT="Average Inband T", $
						XPOS=!DEVX-360, YPOS=330

	Display_InBand1, fs_inband.Ringing, WIN=win_ring, $
					COMMENT=comment, INFO=sinfo, $
					XPOS=!DEVX-360, YPOS=!DEVY-250, $
		TIT="Ringing for T > " + $
		string( fs_inband.Thresh_Ring*100, F="(I3)" ) + "% Tpeak"

CWAVE:	; Display central wavelength of bandpass & Low Slopes, if present:

	if max( tag_names( fs_inband ) EQ "CENTRAL_WAVE" ) then begin

		Display_InBand1, fs_inband.central_wave, WIN=win_cwav, $
						COMMENT=comment, INFO=sinfo, $
					TIT="Central Wavelength (nm)", $
					XPOS=!DEVX-360, YPOS=30
	   endif

	if max( tag_names( fs_inband ) EQ "RED_SLOPE_LOW" ) AND $
	   max( tag_names( fs_inband ) EQ "RED_SLOPE_LOW" ) then begin

		Display_InBand1, fs_inband.Blue_Slope_Low, WIN=win_BS_Low, $
						COMMENT=comment, INFO=sinfo, $
						XPOS=10, YPOS=30

		Display_InBand1, fs_inband.Red_Slope_Low, WIN=win_RS_Low, $
						COMMENT=comment, INFO=sinfo, $
						XPOS=400, YPOS=30
	   endif

	if max( tag_names( fs_inband ) EQ "T_CENTER" ) then begin

		Display_InBand1, fs_inband.T_center, WIN=win_tc, $
						COMMENT=comment, INFO=sinfo, $
						XPOS=10, YPOS=100, $
				TIT="Transmission  @" + $
				string( fs_inband.W_center, F="(F7.1)" ) + " nm"
	   endif

	if keyword_set( hardcopy ) then begin
		if (VarType( print_que ) NE "STRING") or $
		   (N_elements( print_que ) NE 2) then $
						print_que = ["lpPS","lpcolor"]
		psclose
		if Yes_No_menu( "print  " + PS_file + "  now",/BIN ) then $
			print_graphics, PS_file, QUE=print_que(colorflag)
	   endif
end