function  bcs_norm,index,dspectra,notime=notime,nofq=nofq


idx_sz = size(index)
dat_sz = size(dspectra)

;       check index and data same dimension!!
if (idx_sz(0) ne 1) or (dat_sz(0) ne 2) or (idx_sz(1) ne dat_sz(2)) then begin
   print,'*** Index and Data arrays dimensions do not match ***'
   help,index,dspectra
   return,dspectra      ;????????
endif

;   check dspectra real - i.e. decompressed
if dat_sz(3) ne 4 then begin
   print,'*** Supplied Data array is not Decompressed ***
   help,dspectra
   return,dspectra      ;????????
endif


if not keyword_set(notime) then print,'Normalized by Integration Time'

;   data is affected, so work from saved array
ddspectra = dspectra

kdat = n_elements(index)-1

for k = 0,kdat do begin

;   TODO    data gaps...

if not keyword_set(nofq) then begin
;       Normalize the Fast Queue data
   if index(k).bcs.blockid eq 1 and  $
    (index(k).bcs.controltally gt 0 and index(k).bcs.controltally lt 100) and  $
    total(ddspectra(*,k)) gt 0 then begin
      if (k gt 0) then begin
         if index(k-1).bcs.blockid eq 1 and  $
            total(ddspectra(*,k-1)) gt 0 and  $
            (index(k).bcs.controltally - index(k-1).bcs.controltally eq 1) then begin
            dspectra(*,k) = ddspectra(*,k) - ddspectra(*,k-1)
         endif else begin
;               time needs adjusting???
            dspectra(*,k) = ddspectra(*,k)/(index(k).bcs.controltally+1)
         endelse
      endif else begin
;       time needs adjusting???
         if total(ddspectra(*,k)) gt 0 then $
            dspectra(*,k) = ddspectra(*,k)/(index(k).bcs.controltally+1)
      endelse

   endif
endif

;       Zero out any negative points ????
   wz = where(dspectra(*,k) le 0)
   if wz(0) ge 0 then dspectra(wz,k) = 0
;       Normalize for integration time unless inhinited
   if not keyword_set(notime) then dspectra (*,k) = dspectra(*,k)*(1./(index(k).bcs.dgi*0.125))

endfor

return,dspectra
end