;+
; NAME:
;     QUICKSTRAY
; PURPOSE:
;     look at last few days of SLS data for new leaks
; CATEGORY:
; CALLING SEQUENCE:
;     quickstray 
; INPUTS:
;     before - the look-back time, in days
;     side - ? a hook for some purpose
; OPTIONAL (KEYWORD) INPUT PARAMETERS:
; OUTPUTS:
; COMMON BLOCKS:
; SIDE EFFECTS:
;     opens a window, makes a plot 
; RESTRICTIONS:
; MODIFICATION HISTORY:
;     5-mar-98, written (HSH)
;    18-jul-98, converted to procedure (HSH)
;    13-aug-98, changed hard paths to environment paths (DA)
;    22-aug-98, revised same (HSH)
;    17-apr-1999 - S.L.Freeland - subselect recent 14 days
;     2-may-1999 - HSH tidied up the plot a bit
;-
pro quickstray, before = before, side = side, qstop = qstop
if n_elements(side) eq 0 then side = 512
if n_elements(before) eq 0 then before = 14
wdef,0,side
sfrs=newfiles(/sfr)
infil=sel_filetimes(reltime(days=-before),reltime(/now),sfrs)
rd_roadmap,infil,rm
rm1 = rm
ss = where(gt_filta(rm1) eq 2 and gt_filtb(rm1) eq 1 and $
  gt_percentd(rm1) eq 100 and gt_expmode(rm1) eq 1 and gt_res(rm1) eq 2)
rd_xda,infil,ss,index,data
tots = reform(total(total(sxt_decomp(data),1),1))
high = where(tots gt 1e8 and tots lt 1.5e8)
low = where(tots gt 5e7 and tots lt 1e8)
empirical_fact = 1.80                   ; set 2-May-1999
tots(low) = empirical_fact * tots(low)
good = where(tots gt 1e8 and tots lt 1.5e8)
bad = where(tots gt 1.5e8, n_bad)
tit = 'Recent stray-light level'
if n_bad gt 4 then tit = 'Points out of range!!!'
utplot,index(good),tots(good),psym=-1,$
  lines=1,tit='Recent stray-light level',yr=[1.2e8,1.4e8]
outplot,index(low),tots(low),psym=4
timestamp
if keyword_set(qstop) then stop
end
