;+
; Project     : HESI
;                   
; Name        : PLOT_ANGC
;               
; Purpose     : This procedure plots the angular coverage of HESSI vs other
;		instruments.
;               
; Category    : HESI
;               
; Explanation : 
;               
; Use         : 
;    
; Inputs      : 
;               
; Opt. Inputs : None
;               
; Outputs     : None
;
; Opt. Outputs: None
;               
; Keywords    : 
;		NOSOLID
;		NODIMES
;		DO_COLOR
;		GD_FILE
; Calls	      :
;
; Common      : None
;               
; Restrictions: screen is restricted to X windows
;               
; Side effects: produces gif, eps, and ps files.
;               
; Prev. Hist  : 
; 		Written by Eric Carzon, Hughes/STX
; 		February 15, 1995
;
; Modified    : 
;		Version 2, RAS, 14-apr-1997,
;		Version 3, RAS, 23-may-1997, changed e_box limits
;		Version 4, richard.schwartz@gsfc.nasa.gov, 31-dec-1997, supports overplotting previous dimensions
;		when environmental, MORE_GDFILE is set to 'T'
;		Version 5, richard.schwartz@gsfc.nasa.gov, modified with NOSETUP and DEF_SCR_DEVICE
;		keywords to support ALL3 plot procedure.
;-            
Pro plot_angc,nosolid=nosolid,nodimes=nodimes,do_color=do_color,$
	gdfile=gdfile, def_scr_device=def_scr_device, nosetup=nosetup


xyminmax=[1,1e4,1,1e3]
pl_range = [1,9]
hd_cp = 0
ped_are = 2
nxsize = 22
nysize = 16
do_color = 1	; 0 is black/white and 1 is color 
checkvar, def_scr_device, 'X'
pl_dims = 1
harm = 1

erase

pl_dims = 1 - keyword_set(nodimes) 
if (not keyword_set(do_color)) then do_color=0 

angc_get_gd, e_diff_50, e_trans_50, res, gdfile=gdfile

if getenv('MORE_GDFILE') eq 'T' then begin
;
;  Get a grid file with 55 micron gold grids for overplotting.
;
	gdfile2=loc_file(path=path_dir('hessi'),'smex_gd_9_970602.dat', count=count2)
	
	angc_get_gd, e_diff_502, e_trans_502, res2, gdfile=gdfile2(0)
endif

Set_plot,def_scr_device

Make_plot:

; Use only energies that are above 3.0 keV, set ener_pl and en_xax > 2.0' 
e_box = [3.0, 1e4]	;HESSI SMEX BOUNDARIES


plot_it:
pmulti = !p.multi

if getenv('MORE_GDFILE') eq 'T' then nofill_are, xyminmax, e_box, res2, e_diff_502, e_trans_502, pl_dims=pl_dims,$
	box_style={ color:2, style:1, thick:4}
!p.multi = pmulti

nofill_are, xyminmax, e_box, res, e_diff_50, e_trans_50, pl_dims=pl_dims, noerase=( getenv('MORE_GDFILE') eq 'T' )

if keyword_set( nosetup ) then return

hard_copy:

if !d.name ne 'X' then begin
    if hd_cp  then begin

    if not (eps > 0) then psplot,color=do_color, file= file, qual=(['','-h'])(os_family() eq 'unix')
      
    hd_cp = 0
    endif
    device,/close
    goto,get_out
endif else begin

ask_print:
    hard_cp=' '
    rd_land=' '
    eps = ''
    read,'Create (E)PS file (e/p/n)?', eps
    eps = strmid(strupcase(strtrim(eps,2)),0,1)
    
    case 1 of
    	eps eq 'E': eps= 1
    	eps eq 'P': eps=-1
    	else: eps=0
    	endcase
    
    if eps then begin
    print,'Printing Options: b = bw/grayscale; c = color; n = no print'
    print,'The Print Queues may be controlled by setting the '
    print,'Logical/environmental variables PSLASER and PSCOLOR for
    print,'B/W and Color printing, respectively.'
    rd_land = 'Y'
    read,'landscape (y/n)? ',rd_land
        do1_land = strupcase(strmid(strcompress(string(rd_land),/remove),0,1))
        do_land  = (do1_land eq 'Y') 
    hard_cp = 'N'
    read,'hard copy (y/n)?  ',hard_cp
    hd_cp = (strupcase(strmid(strcompress(string(hard_cp),/remove_all),0,1)) eq 'Y')
    do_color = 'N'
    read,'Color Postscript (y/n)?  ',do_color
    do_color = (strupcase(strmid(strcompress(string(do_color),/remove_all),0,1)) eq 'Y')
    sps, encaps = eps>0, color=do_color
    set_plot,'ps',/copy
    ;help,!p.font
    file='ang_cov'+(['.ps','.eps'])(eps >0)
    device,bits=8, landscape=do_land, xoff=3,yoff=25,$
        	xsize=nxsize,ysize=nysize, /bold,/times, file=file 
   	;help,/device
	goto,make_plot
   endif 
   goto, get_out   

endelse
	
error_exit:
print,'Error in Plot_angc!'

get_out:

set_x
write_gif,'ang_cov.gif',tvrd()

return
end
