pro lchda,index,hxt=hxt,psym=psym,log=log
;
;+
; pro lchda - plot out light curves for all hxt
;
; Author: atp - 27/3/1992 vn 0.3
;
; Purpose: Plot out some or all of the light curves for hxt 0-3 channels
;          at a max time resolution of 2 seconds. (1 sample per major frame) 
;
; Calling Sequence:
;         LCHDA,index[,hxt=[0,1,2,3],psym=psym,/log]
;         
; Inputs:
;         index - index structure
;
; Optional inputs:
;         hxt = [0,1,2,3] - array of values 0 = low (15-24.4) KeV
;					    1 = medium (24.4-35.2) KeV
;					    2 = medium (35.2-56.8) KeV
;					    3 = high   (56.8-100)  KeV
;
;         psym = psym = plot symbol default = 0
;         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,
;         lchda,index,hxt=[0,1,2,3]
;          will plot all of the hxt channels 
;
; Side Effects:
;         Plot is produced, either on Xterminal (idl7) or to postscript.
;         postscript plot is designed to fit on 8.5x11 paper.
;
;-
;defaults;
;
if (not keyword_set(hxt)) then hxt = [-1]
if (not keyword_set(psym)) then psym = 0
if (keyword_set(log)) then ytype = 1 else ytype = 0

 
if total(hxt) eq -1 then begin
   ;defaults
   hxt = [0,1,2,3]
   endif

nplots = n_elements(hxt)

hxt_low = gt_sum_l(index)
hxt_med1 = gt_sum_m1(index)
hxt_med2 = gt_sum_m2(index)
hxt_high = gt_sum_h(index)

if ytype eq 1 then begin
  hxt_low = hxt_low > 1
  hxt_med1 = hxt_med1 > 1
  hxt_med2 = hxt_med2 > 1
  hxt_high = hxt_high > 1
  endif

!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
chars=!p.charsize
!p.charsize=1.6

for ii = 0,nplots-1 do begin

case hxt(ii) of
 '0': utplot,index,hxt_low,psym=psym,/ynozer,ytype=ytype,title='HXT Time Profile 15-24.4 KeV',ytitle='Counts/sec'
 '1': utplot,index,hxt_med1,psym=psym,/ynozer,ytype=ytype,title='HXT Time Profile 24.4-35.2 KeV',ytitle='Counts/sec'
 '2': utplot,index,hxt_med2,psym=psym,/ynozer,ytype=ytype,title='HXT Time Profile 35.2-56.8 KeV',ytitle='Counts/sec'
 '3': utplot,index,hxt_high,psym=psym,/ynozer,ytype=ytype,title='HXT Time Profile 56.8-100 KeV',ytitle='Counts/sec'

  else: print,'Error in selection of plots - usage: lchda,index[,hxt=[0,1,2,3],psym=symbol,/log]'
  endcase

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


