if (n_elements(sxl_out) eq 0) then begin
    restore, '/2p/morrison/soft/solara_db/test/sxl_image.idl
    img2 = alog10(img>1)
    ndays = n_elements(sxl_out)
end
;
ss_good = where(sxl_out.img_avg lt 5000)
;
x = indgen(ndays)
y1 = (sxl_out.img_avg/500)*250 + 256
y2 = gt_filtb(sxl_out)/6.*250 + 256
y3 = (gt_dpe(sxl_out)-15)/30.*250 + 256
xx = sfd_decomp( bindgen(256) )
;
loadct, 0
!p.multi = 0
utplot, sxl_out(ss_good), sxl_out(ss_good).img_avg
pause
;
if (!d.name ne 'PS') then begin
    loadct, 11
    erase
    tvscl, img2
    tvplot, x, y1
    xyouts, 100, 450, 'Line plot is Integrated Aveverage Flux', /dev, charsize=2
    tvplot, [ndays+10, ndays+50], [1,1]*130	& xyouts, ndays+52, 130, 'A', /dev
    tvplot, [ndays+10, ndays+50], [1,1]*120	& xyouts, ndays+52, 120, 'B', /dev
    pause
    ;
    ;;erase
    ;;tvscl, img2
    ;;tvplot, x, y2
    ;;pause

    erase
    tvscl, img2
    tvplot, x, y3
    xyouts, 100, 450, 'Line plot is DPE level', /dev, charsize=2
    tvplot, [ndays+10, ndays+50], [1,1]*130	& xyouts, ndays+52, 130, 'A', /dev
    tvplot, [ndays+10, ndays+50], [1,1]*120	& xyouts, ndays+52, 120, 'B', /dev
    pause
end
;
loadct, 0
idset = tim2dset(sxl_out, ['1-feb-92', '17-May-92'])
tit = fmt_tim(sxl_out(idset(0))) + ' (solid) and ' + fmt_tim(sxl_out(idset(1))) + ' (dashed)'
plot_oo, xx, img(idset(0),*), psym=10, yrange=[.1, 10e+4], tit=tit, ytit='Num of Occurrances'
oplot, xx, img(idset(1),*), linestyle = 1
pause
;
!p.multi = [0,2,2]
idset = tim2dset(sxl_out, ['1-nov-91', '1-jan-92', '1-may-92', '1-jun-92'])
for i=0,3 do plot_oo, xx, img(idset(i),*), psym=10, yrange=[.1, 10e+4], tit=fmt_tim(sxl_out(idset(i))), ytit='Num of Occurrances'
pause
;
!p.multi = 0
plot_oo, xx, total(img, 1)/ndays, psym=10, yrange=[.1, 10e+4], tit='Average of all histograms', ytit='Num of Occurrances'
pause
;
ss = indgen(20)
plot_oo, xx, total(img, 1)/ndays, /nodata, yrange=[.1, 10e+4], tit='20 Day Averages', ytit='Num of Occurrances'
for i=0,ndays-20,20 do oplot, xx, total(img(ss+i,*), 1)/20
pause
;
ss = indgen(14)
!p.multi = [0,4,4]
for i=0,ndays-14,14 do begin
    plot_oo, xx, total(img(ss+i,*), 1)/14, yrange=[.1, 10e+4], tit='14 Day Avg '+gt_day(sxl_out(i),/str), ytit='Num of Occurrances'
    if ((i/14 mod 16) eq 15) then pause
end
;
end
