pro print_fpmux,hk,valid 
; 
;   prints the fp mux channels  
; 
; @(#)print_fpmux.pro	1.1 01/23/98 :LASCO IDL LIBRARY
;
if n_params() eq 2 then vld=valid else vld=1 
openw,lu,'fpmux.lst',/get_lun 
printf,lu,'                             FP MUX Channels' 
printf,lu 
hk2=gethkn(hk,2) 
getcputime,hk2,first,time,cdstime=utc
date=utc2str(utc(0),/ecs,/date_only)
printf,lu," Date = ",date
printf,lu 
mux = indgen(24) 
printf,lu,'   TIME   VALD',mux,format='(a,24i5)' 
printf,lu 
s=size(hk2) 
n=s(2) 
if (s(0) eq 2) then begin  
   if vld eq 1 then begin 
      w=where(hk2(243,*) gt 0) 
      s=size(w) 
      if (s(0) eq 1) then begin 
         if (w(0) gt 0) then w=[w(0)-1,w] 
         w=[w,w(n_elements(w)-1)+1] 
         dw=w-shift(w,1) 
         print,dw 
         dw=dw(1:n_elements(dw)-1) 
         nw=where(dw ne 1) 
print,nw 
         k=n_elements(nw)-1 
         u=w(0:nw(0)) 
         for i=0,k-1 do u=[u,w(nw(i))+1,w(nw(i)+1)-1,w(nw(i)+1:nw(i+1))] 
         u=[u,w(nw(k))+1,w(nw(i)+1)-1,w(nw(i)+1:*)] 
         hk2=hk2(*,u) 
      endif 
   endif 
   s=size(hk2) 
   n=s(2) 
   even = 2*indgen(25) + 242
   odd = even+1
   if s(0) eq 2 then begin  
      for i=0,n-1 do begin 
         tai=obt2tai(hk2(6:11,i))
         time=utc2str(tai2utc(tai),/ecs,/time_only,/truncate)
         mux = hk2(even,i)*256L + hk2(odd,i)
         printf,lu,time,mux,format='(a8,"  ",25z5)' 
      endfor
   endif else printf,lu,'No valid fp mux data' 
endif else printf,lu,'No fp mux data' 
close,lu 
free_lun,lu 
return 
end 
