pro lcwda,index,data,hxs=hxs,sxs1=sxs1,sxs2=sxs2,psym=psym,charsize=charsize,noscale=noscale
;
;+
; pro lcwda - plot out light curves for all wbs data hxs,sxs1,sxs2
;
; Author: atp - 24/3/1992 vn 0.2
;
; Purpose: Plot out some or all of the WBS light curves for HXS,SXS-1.SXS-2
;
; Calling Sequence:
;         LCWDA,index,data[,hxs=[0,1],sxs1=[0,1],sxs2=[0,1],psym=psym]
;         
; Inputs:
;         index - index structure
;         data  - wbs data structure
; Optional inputs:
;         hxs = [0,1] - array of values 0 = hxs_pc1, 1 = hxs_pc2
;         sxs1 = [0,1]- array of values 0 = sxs_pc11, 1 = hxs_pc21
;         sxs2 = [0,1]- array of values 0 = sxs_pc12, 1 = hxs_pc22
;         psym = psym = plot symbol default = 0
; Example:
;         The default plot is equivalent to,
;         lcwda,index,data,hxs=[0,1],sxs1=[0],sxs2=[0]
;          will plot hxs_pc1, hxs_pc2, sxs_pc11, sxs_pc12
;
; Side Effects:
;         Plot is produced, either on Xterminal (idl7) or to postscript.
;         postscript plot is designed to fit on 8.5x11 paper.
;
; History:
;	
; Author: atp - 24/3/1992 vn 0.1
;	  atp - 2/7/1992  vn 0.2 - fixed factor of 100 off.
;
;-
;defaults;
;
if (not keyword_set(hxs)) then hxs = [-1]
if (not keyword_set(sxs1)) then sxs1 = [-1]
if (not keyword_set(sxs2)) then sxs2 = [-1]
if (not keyword_set(psym)) then psym = 0

 

if total(hxs+sxs1+sxs2) eq -3 then begin
   ;defaults
   hxs = [0,1]
   sxs1 = [0]
   sxs2 = [0]
   endif

nplots = n_elements(hxs)+n_elements(sxs1)+n_elements(sxs2)
if hxs(0) eq -1 then nplots = nplots -1
if sxs1(0) eq -1 then nplots = nplots -1
if sxs2(0) eq -1 then nplots = nplots -1


if n_elements(hxs) gt 1 then hxs = 3 else hxs = hxs(0)+1
if n_elements(sxs1) gt 1 then sxs1 = 3 else sxs1 = sxs1(0)+1
if n_elements(sxs2) gt 1 then sxs2 = 3 else sxs2 = sxs2(0)+1
;
; index.wbs.unit_time is in fact in units of 0.01 seconds.
;

hxspc1 = sumrow(hxt_decomp(data.pc.hxs_pc1))/(index.wbs.unit_time/100.) 
hxspc2 = sumrow(hxt_decomp(data.pc.hxs_pc2))/(index.wbs.unit_time/100.) 
sxs1pc1 = sumrow(data.pc.sxs_pc11)/(index.wbs.unit_time/100.) 
sxs1pc2 = sumrow(data.pc.sxs_pc21)/(index.wbs.unit_time/100.) 
sxs2pc1 = sumrow(data.pc.sxs_pc12)/(index.wbs.unit_time/100.) 
sxs2pc2 = sumrow(data.pc.sxs_pc22)/(index.wbs.unit_time/100.) 

if (not keyword_set(noscale)) then begin 
!p.multi = [0,1,nplots,0,0]
if (!d.name eq 'X') then window,7,xs=600,ys=800 
if (!d.name eq 'PS') then device,ys=24.,yoffset=2.5
endif 
if (keyword_set(charsize)) then begin
       chars=!p.charsize
       !p.charsize=charsize
	endif else begin
       chars=!p.charsize
       !p.charsize=1.6
	endelse

case hxs of
 '0':
 '1': utplot,index,hxspc1,psym=psym,/ynozer,title='HXS Time Profile hxs_pc1 20-60 KeV',ytitle='Counts/sec'
 '2': utplot,index,hxspc2,psym=psym,/ynozer,title='HXS Time Profile hxs_pc2 60-600 KeV',ytitle='Counts/sec'
 '3': begin
      utplot,index,hxspc1,psym=psym,/ynozer,title='HXS Time Profile hxs_pc1 20-60 KeV',ytitle='Counts/sec'
      utplot,index,hxspc2,psym=psym,/ynozer,title='HXS Time Profile hxs_pc2 60-600 KeV',ytitle='Counts/sec'
      end
  else: print,'error in selection of plots 0=none, 1= hxs1, 2=hxs1, 3 = hxs1+2'
  endcase
case sxs1 of 
 '0':
 '1': utplot,index,sxs1pc1,psym=psym,/ynozer,title='SXS-1 Time Profile sxs_pc11 2.6-7.5 KeV',ytitle='Counts/sec'
 '2': utplot,index,sxs1pc2,psym=psym,/ynozer,title='SXS-1 Time Profile sxs_pc21 ??-?? KeV',ytitle='Counts/sec'
 '3': begin
      utplot,index,sxs1pc1,psym=psym,/ynozer,title='SXS-1 Time Profile sxs_pc11 2.6-7.5 KeV',ytitle='Counts/sec'
      utplot,index,sxs1pc2,psym=psym,/ynozer,title='SXS-1 Time Profile sxs_pc21 ??-?? KeV',ytitle='Counts/sec'
      end
  else: print,'error in selection of plots 0=none, 1= sxs11, 2=sxs21, 3 = sxs11+21'
  endcase

case sxs2 of 
 '0':
 '1': utplot,index,sxs2pc1,psym=psym,/ynozer,title='SXS-2 Time Profile sxs_pc12 7.5-15 KeV',ytitle='Counts/sec'
 '2': utplot,index,sxs2pc2,psym=psym,/ynozer,title='SXS-2 Time Profile sxs_pc22 ??-?? KeV',ytitle='Counts/sec'
 '3': begin
      utplot,index,sxs2pc1,psym=psym,/ynozer,title='SXS-2 Time Profile sxs_pc12 7.5-15 KeV',ytitle='Counts/sec'
      utplot,index,sxs2pc2,psym=psym,/ynozer,title='SXS-2 Time Profile sxs_pc22 ??-?? KeV',ytitle='Counts/sec'
      end
  else: print,'error in selection of plots 0=none, 1= sxs12, 2=sxs22, 3 = sxs12+22'
  endcase
!p.multi = 0
!p.charsize=chars 
end


