;+
; NAME:
;	POSN_PLOT
; PURPOSE:
; CATEGORY:
; CALLING SEQUENCE:
;	.run posn_plot
; INPUTS:
;	Read files "posn_log.dat" on current directory
; OPTIONAL INPUT PARAMETERS:
; KEYWORD PARAMETERS:
; OUTPUTS:
; OPTIONAL OUTPUT PARAMETERS:
; COMMON BLOCKS:
; SIDE EFFECTS:
; RESTRICTIONS:
;	VMS specific at the moment
; PROCEDURE:
; MODIFICATION HISTORY:
;	RDB  22-Mar-94	Written
;-

spawn,'typ posn_log.dat',resp

resp = strcompress(strtrim(resp,2))

cc = strmid(resp,0,2)

ps_long
!p.charsize=1.5

for jchan=0,3 do begin
  ccx = where(cc eq jchan)
  nccx = n_elements(ccx)
  ff = strarr(10,nccx)
  help,ff
  for j = 0,nccx-1 do begin
    ff(*,j) = str2arr(resp(ccx(j)),delim=' ')
  endfor

  tims = anytim2ints(ff(0,*)+' '+ff(1,*))
  stday = '1-JAN-90'
  tim0 = anytim2ints(stday)
  timx = tims.day - tim0.day
  vals = float(ff(4:9,*))

  !p.multi = [0,1,3]
;;  yran = [26,28]
;;  if jchan ge 2 then yran = [25,27]
  mtit=string('BCS channel',jchan+1,format='(a,i2)')
;;  utplot,tims,vals(0,*),yra=yran,tit=mtit
;;  utplot,tims,vals(2,*),yra=[100,108]
;;  utplot,tims,vals(4,*),yra=[227,232]
  xtit = 'Days since '+stday
  plot,timx,vals(0,*),yra=[24.5,28.5],yst=1,ytit='LH Stim', $
	xtitle=xtit,tit=mtit
  errbar,timx,vals(0,*),vals(1,*)
  plot,timx,vals(2,*),yra=[102,106],yst=1,ytit='Cen Stim', $
	xtitle=xtit
  errbar,timx,vals(2,*),vals(3,*)
  plot,timx,vals(4,*),yra=[227,231],yst=1,ytit='RH Stim', $
	xtitle=xtit
  errbar,timx,vals(4,*),vals(5,*)
  !p.multi=0

if !d.name ne 'PS' then yesnox,'Continue',ans
endfor

!p.charsize=1.0
ps_reset

end
