;+
;NAME:
; hxt_unpack_grause
;PURPOSE:
; unpacks hxi_index.grause, the grid use array
;CATEGORY:
; Yohkoh HXT
;CALLING SEQUENCE:
; iuse = hxt_unpack_grause(hxi_index)
;INPUT:
; hxi_index = the index structure for an HXI image, or an 8-element
;             byte array
;OUTPUT:
; iuse = a 64 element intarr, set to zero if that mod. collimator
;        was not used in the fit, set to 1 if it was.
;HISTORY:
; 26-nov-1996, jmm
; New name, 24-jun-1998
;-
FUNCTION Hxt_unpack_grause, hxi_index

   sizi = size(hxi_index) & typ = sizi(sizi(0)+1)
   IF(typ EQ 8) THEN grause = hxi_index(0).grause $
     ELSE IF((typ EQ 1) AND sizi(0) EQ (1) AND sizi(1) EQ 8) THEN grause = hxi_index $
     ELSE BEGIN
      message, /info, 'Bad input, all SCs will be used'
      iuse = intarr(64)+1
      RETURN, iuse
   ENDELSE

   juse = intarr(8, 8)
   FOR kj = 0, 7 DO BEGIN
      bits, grause(kj), arrx
      juse(*, kj) = arrx
   ENDFOR

   iuse = reform(juse, 64)

   RETURN, iuse
END

   
   
