 mat = rdfile('rad_sum.txt', 5)
;
;perigee angle =  10.45 on 10-Oct-91 20:00:00
;   "     "    = 127.97 on 23-Oct-91 14:00:00
;
;perigee angle variation = 9.4 deg/day
;that means the angle was 0 sometime on 9-Oct-91
;
tarr_ref = timstr2ex('23-Oct-91 14:00:00')
tarr_st = timstr2ex('1-sep-91')
days = int2secarr(tarr_ref, tarr_st)/86400.
days = days - 127.97/9.4	;# days past 1-sep when angle was zero (38.9695)
;
st_day = days - 360/9.4		;(0.671627)
		;^ = 38.2979 days
;
;have a time for every 30 deg of percession
n = 150
x = indgen(n)*30/9.4 + st_day
y_ang = indgen(n)*30 mod 360
y_sub = intarr(n)
;
for i=0,n_elements(y_ang)-1 do begin
    y_sub(i) = where(mat(0,*) eq y_ang(i))
end
;
tit = ['Electrons (0.1-5.0 MeV)', $
	'Protons (4-30 MeV)', $
	'Protons (30-150 MeV)', $
	'Protons (150-400 MeV)']
openw, lun, 'rad_dose.txt', /get_lun
printf, lun, 'Days since 1-sep-91  Angle   ', tit
printf, lun, ' '
for i=0,n_elements(x)-1 do begin
    print, x(i), y_ang(i), mat(1:4, y_sub(i))
    printf, lun, x(i), y_ang(i), mat(1:4, y_sub(i))
end
free_lun, lun
;
mat2 = rdfile('rad_dose.txt', 6, 2)
tit = ['Electrons (0.1-5.0 MeV)', $
	'Protons (4-30 MeV)', $
	'Protons (30-150 MeV)', $
	'Protons (150-400 MeV)']
!p.charsize = 1.6
!p.multi = [0,1,4]
!x.ticklen = 0.04

;;for i=2,5 do plot, mat2(0,*), mat2(i, *), xtitle='Days past 1-Sep-91', psym=-2, ytitle = 'Avg Flux/day', title=tit(i-2) 
;;plottime & pause

for i=2,5 do utplot, mat2(0,*)*86400, mat2(i, *), '1-sep-92', xtitle='Days past 1-Sep-91', psym=-2, $
	ytitle = 'Avg Flux/day', title=tit(i-2)
plottime & pause

for i=2,5 do utplot, mat2(0,0:70)*86400, mat2(i, 0:70), '1-sep-92', xtitle='Days past 1-Sep-91', psym=-2, $
	ytitle = 'Avg Flux/day', title=tit(i-2)
plottime & pause

end
