;+
;Function: THM_FFT_DECOMPRESS
;
;Purpose:  Decompresses DFB FFT spectral data.
;Arguements:
;	DATA, any BYTE data type (scalar or array), 8-bit compressed FFT spectral estimates.
;keywords:
;   VERBOSE.
;Example:
;   result = thm_fft_compress( data)
;
;Notes:
;	-- Stub version, to allow for testing.
;
; $LastChangedBy: jbonnell $
; $LastChangedDate: 2007-06-21 14:15:51 -0700 (Thu, 21 Jun 2007) $
; $LastChangedRevision: 834 $
; $URL $
;-
function thm_fft_decompress, data, verbose=verbose

thm_init

;----------------------------------------
; Vectorized decompression from 8-bit pseudolog
; to 34-bit unsigned.  Uses an unsigned 64-bit
; vector for the output.
;  Algorithm courtesy Chris Cully, LASP, 19 June 2007.
;----------------------------------------

  data=ulong64(data)

  ;--- separate mantissa/exponent ---
  n = data/8
  y = data and 7

  ;--- decompress ---
  z = ulon64arr( size( data, /dim))
  indx = where(n eq 0, count, complement=indx2, ncomplement=count2)
  if (count gt 0)  then z[indx]=ulong64(y[indx])
  if (count2 gt 0) then $
    z[indx2]=(y[indx2]+8)*2UL^(n[indx2]-1)

return, float( z)
end