pro lcobs,win=win,start_time=start_time,dur=dur,interactive=interactive,psym=psym,ystyle=ystyle,bcs=bcs,wbs=wbs
;
;+
; pro lcobs - plot out light curves for all bcs channels
;
; Author: atp - 27/11/1992 vn 0.01
;
; Purpose: Plot out some or all of the observing logs
;
; Calling Sequence:
;         LCOBS[,bcs='1,2,3,4',wbs='1,2,3,4',psym=psym,win=win, - 
;             start_time=[hh,mm,ss,msec,dd,mm,yy],dur=hours]
; Inputs:
;
; Optional inputs:
;         bcs = '1,2,3,4' - string of values  1 = FeXXVI 
;					      2 = FeXXV
;					      3 = CaXIX
;					      4 = SXV
;	         Wild cards are allowed '-,*'
;
;	  wbs = '1,2,3'   - string of values  1 = hxs 20-600 KeV
;					      2 = sxsm 7.5-15 KeV
;					      3 = sxsl 2.6-7.5 KeV
;	
;         psym = psym = plot symbol default = 3
;         log  = keyword switch to turn on log plots
;                 Only data greater than 1 are plotted, anything below
;		  1 will be rounded up to 1, if log plot selected.
;
; Example:
;         The default plot is equivalent to,
;         lcobs,bcs='3',wbs='1'
;          will plot all of the bcs channels 
;
; Side Effects:
;         Plot is produced, either on Xterminal (idl7) or to postscript.
;         postscript plot is designed to fit on 8.5x11 paper.
;
;-
; notes, this is initial version
;	 need to add SAA/Day/night => nick code from bcs_24_hour plotter
;	 hacked together from lcbda/lcwda + obs data structure.
;
;defaults;
;
if (keyword_set(bcs)) then begin
	range,bcs,4,bchan,ier,1
	nbchan = n_elements(bchan)
	if (ier ne 0) then return
	endif else begin
	bchan = [0]
	nbchan = 0
	endelse

if (keyword_set(wbs)) then begin
	range,wbs,3,wchan,ier,1
	nwchan = n_elements(wchan)
	if (ier ne 0) then return
	endif else begin
	wchan = [0]
	nwchan = 0
	endelse

nplots = nbchan+nwchan

if (nplots eq 0) then begin
	nplots = 2
    	nbchan = 1
	nwchan = 1
	bchan = [3]
	wchan = [1]
	endif
	
if (not keyword_set(psym)) then psym = 3
if (keyword_set(log)) then ytype = 1 else ytype = 0
;
; defaults 
;
if (not keyword_set(start_time)) then start_time=[12,00,00,00,18,04,92] 
if (not keyword_set(dur)) then dur=2.5
if (keyword_set(interactive)) then begin
;	start=get_start(); bad idea --- 
;	end_t = get_end()	
	endif

end_time = start_time
days = fix((start_time(4) + (fix(dur) + start_time(0))/24))
hours = (start_time(0) + fix(dur)) mod 24 
mins = fix((dur - fix(dur))*60)
end_time(0)=hours
end_time(1)=mins
end_time(4)=days



rd_obs,start_time, end_time, obcs, sxtf, sxtp, w_h


plot_=[2,3,4]

goodat = where(gt_blockid(obcs) eq 0)


bcs_fexxvi = gt_total_cnts(obcs(goodat),1)  > 0
bcs_fexxv = gt_total_cnts(obcs(goodat),2)  > 0
bcs_caxix = gt_total_cnts(obcs(goodat),3) > 0
bcs_sxv =   gt_total_cnts(obcs(goodat),4) > 0

if ytype eq 1 then begin
  bcs_fexxvi = bcs_fexxvi > 1
  bcs_fexxv = bcs_fexxv > 1
  bcs_caxix = bcs_caxix > 1
  bcs_sxv = bcs_sxv > 1
  endif

!p.multi = [0,1,nplots,0,0]
if (!d.name eq 'X') then begin
		if (not keyword_set(win)) then begin
			window,7,xs=600,ys=800 
			endif else begin
			wset,win
			endelse
		endif

if (!d.name eq 'PS') then ps_long
chars=!p.charsize
!p.charsize=1.6

for ii = 0,nbchan-1 do begin

case bchan(ii)-1 of
 '0': utplot,obcs(goodat),bcs_fexxvi,psym=psym,/ynozer,ytype=ytype,title='BCS Time Profile FeXXVI',ytitle='Counts/sec'
 '1': utplot,obcs(goodat),bcs_fexxv,psym=psym,/ynozer,ytype=ytype,title='BCS Time Profile FeXXV',ytitle='Counts/sec'
 '2': utplot,obcs(goodat),bcs_caxix,psym=psym,/ynozer,ytype=ytype,title='BCS Time Profile CaXIX',ytitle='Counts/sec'
 '3': utplot,obcs(goodat),bcs_sxv,psym=psym,/ynozer,ytype=ytype,title='BCS Time Profile SXV',ytitle='Counts/sec'
  else: print,'Error in selection of plots - usage: lcbda,index[,bcs=[0,1,2,3],psym=symbol,/log]'
  endcase

endfor

hxs = hxt_decomp(w_h.wbs_hxs)
sxs1 = hxt_decomp(w_h.wbs_sxs1) 
sxs2 = hxt_decomp(w_h.wbs_sxs2)

for ii = 0,nwchan-1 do begin

case wchan(ii)-1 of
 '0': utplot,w_h,hxs,psym=psym,/ynozer,title='HXS Time Profile  20-600 KeV',ytitle='Counts/sec'
 '1': utplot,w_h,sxs1,psym=psym,/ynozer,title='SXS1 Time Profile 7.5-15 KeV',ytitle='Counts/sec'
 '2': utplot,w_h,sxs2,psym=psym,/ynozer,title='SXS2 Time Profile 2.6-7.5 KeV',ytitle='Counts/sec'
  else: print,'error in selection of plots 0=none, 1= hxs1, 2=hxs1, 3 = hxs1+2'
  endcase

endfor
!p.multi = 0
!p.charsize=chars 
!y.type = 0
end


