pro hxt_struct, HXT_QS_Instr = HXT_QS_Instr,  $
                     HXT_QS_Conv = HXT_QS_Conv,  $
                     HXT_Index = HXT_Index,  $
                     HXT_PC_Data = HXT_PC_Data,  $
                     HXT_PH_Data = HXT_PH_Data,  $
                     HXT_RoadMap = HXT_RoadMap,  $
                     HXT_Version = HXT_Version,  $
                     HXI_Index = HXI_Index,  $
                     HXI_RoadMap = HXI_RoadMap,  $
                     HXI_QS_SCPara = HXI_QS_SCPara,  $
                     HXI_QS_Bkg = HXI_QS_Bkg
   
   
;+
;       NAME:
;               HXT_STRUCT
;       PURPOSE:
;               Define the following HXT specific database structures
;                       * HXT_QS_Instr_Rec         
;                       * HXT_QS_Conv_Rec          
;                       * HXT_Index_Rec            
;                       * HXT_PC_Data_Rec          
;                       * HXT_PH_Data_Rec          
;                       * HXT_RoadMap_Rec          
;
;       CALLING SEQUENCE:
;               HXT_STRUCT
;       HISTORY:
;               written by Mons Morrison, Fall 90.
;                1-Sep-94 (MDM) - Clarified the "dataRecTypes" definition
;
;-
   
   
HXT_QS_Instr = { HXT_QS_Instr_Rec,              $
                                             ;       NOT IMPLEMENTED AS OF 25-Mar-92]
                                             ;
      entry_type : FIX('4011'x),  $          ;
                                             ; 00- Structure/Entry type
                                             ;
      st_time: LONG(0),  $                   ; 02- Start time (millisec of day) entries are valid
      st_day: FIX(0),  $                     ; 06- Start day (since 1-Jan-79)
      en_time: LONG(0),  $                   ; 08- End time (millisec of day)
      en_day: FIX(0),  $                     ; 12- End day (since 1-Jan-79)
                                             ;
                                             ;TBD
                                             ;
      spare: BYTARR(50) }                    ; 14- Spare
   
   
   
HXT_QS_Conv = { HXT_QS_Conv_Rec,              $
                                             ;       NOT IMPLEMENTED AS OF 25-Mar-92]
                                             ;
      entry_type : FIX('4021'x),  $          ;
                                             ; 00- Structure/Entry type
                                             ;
      st_time: LONG(0),  $                   ; 02- Start time (millisec of day) entries are valid
      st_day: FIX(0),  $                     ; 06- Start day (since 1-Jan-79)
      en_time: LONG(0),  $                   ; 08- End time (millisec of day)
      en_day: FIX(0),  $                     ; 12- End day (since 1-Jan-79)
                                             ;
      off_dhk: LONARR(2),  $                 ; 14- Offset time in millisec from MF time for DHK data
      off_pc: LONARR(2),  $                  ; 22- Offset time in millisec from MF time for PC data
      off_ph: LONARR(2),  $                  ; 30- Offset time in millisec from MF time for PHA data
      off_hxa: LONARR(2),  $                 ; 38- Offset time in millisec from MF time for HXA data
                                             ;       (1) = high rate; (2) = medium rate
                                             ;
      energy: LONARR(5),  $                  ; 46- Energy conversion in 0.01 KeV
      hv_conv: LONARR(2),  $                 ; 66- Conversion for high voltage in 0.01 KeV
                                             ;       (1) = intercept; (2) = slope
      temp_conv: LONARR(2),  $               ; 74- Conversion for temperature in 0.01 deg.
      solution_ver: FIX(0),  $               ; 82- Solution version
                                             ;
      spare: BYTARR(44) }                    ; 84-
   
   
   
HXT_Index = { HXT_Index_Rec,              $
      index_version : FIX('4011'x),  $       ;
                                             ;  0- Index structure version                                   Ground 
                                             ;       AAAABBBB CCCCDDDD
                                             ;
      Pow_stat: BYTARR(2),  $                ;  2- Power status                                              W48 F32
                                             ;       b7 = HXT1 (electronics for 00 to 31)
                                             ;       b6 = HXT2 (electronics for 32 to 63)
                                             ;       b5 = OS memory status 
                                             ;       b4 = HXA on/off
                                             ;       b3 = HXA cal
                                             ;       b2 = HXT cal
                                             ;       b1 = HV reduction fuction on/off (enable SAA HV on/off)
                                             ;            Usually HV is 900 V, reduced to ~0 V when on
                                             ;       b0 - HV enable (double command safety)
                                             ;            HV cannot go on until this is enabled
      HV_stat: BYTARR(2),  $                 ;  4- HV Status on/off                                          W48 F32
                                             ;       b7 = HV0 on/off for sensor 00 to 07
                                             ;       b6 = HV7 on/off for sensor 56 to 63
      HXT_Mon: BYTARR(2),  $                 ;  6- Memory content of OS-Memory                               W49 F32
                                             ;       b7 = HXT1 (electronics for 00 to 31)
                                             ;       b6 = HXT2 (electronics for 32 to 63)
                                             ;       b5 = HXA on/off
                                             ;       b4 = Analog part of HXT-E on/off
                                             ;       b3 = HV reduction fuction on/off (enable SAA HV on/off)
                                             ;            Usually HV is 900 V, reduced to ~0 V when on
                                             ;       b2 = RBM flag (from DP)
                                             ;
      gain_control: BYTARR(64),  $           ;  8- Electronics gain for each sensor                          W65
                                             ;       Hopefully changed only once a month
      HV_control: BYTARR(8),  $              ; 72- HV setting                                                W49 F32
                                             ;       Hopefully changed only once a month
                                             ;
      HV_values: BYTARR(8),  $               ; 80- High voltage values (HK monitor output)                   W32 F19
                                             ;     (See quasi-static section for conversions)
      temps: BYTARR(21),  $                  ; 88- HXT Temperatures (HK monitor output)                      W32 F61
                                             ;     (See quasi-static section for conversions)
                                             ;                                                               W32 F00
      dhk_data: BYTARR(64),  $               ;109- DHK PC Data (low energies)                                W64 F00
                                             ;     In PC mode:
                                             ;       Integrated photon counts in low channel
                                             ;     In PH (cal) mode:
                                             ;       Sensor number (same value for 4 minor frames...)
                                             ;
      sum_L: FIX(0),  $                      ;173- Summation of all 64 subcollimator
                                             ;       counts (cnts/sec)
                                             ;     Low energy (15-24.4 KeV)
      sum_M1: FIX(0),  $                     ;175- Medium-1 energy (24.4-35.2 KeV) cnts/sec
      sum_M2: FIX(0),  $                     ;177- Medium-2 energy (35.2-56.8 KeV) cnts/sec
      sum_H: FIX(0),  $                      ;179- High energy (56.8-100 KeV) cnts/sec
      sigma_L: FIX(0),  $                    ;181- Standard deviation of low energy channels
                                             ;     of fan beam elements only.  Not corrected for
                                             ;     integration period.
                                             ;       Sensor #s: (octal)      00,01,04,05
                                             ;                               10,11,14,15
                                             ;                               60,61,64,65
                                             ;                               70,71,74,75
                                             ;     For PH mode .... TODO 
                                             ;
      dataRecTypes: BYTE(0),  $              ;183- What data follows (setting bits)                          Derived
                                             ;       b0 = PC data follows
                                             ;       b1 = PH (cal) data follows
                                             ;       Derived from (W51 F7 b0:1) - Output from DP
                                             ;               00 = No Data (PC data in index only)  (=0)
                                             ;               01 = PC data                          (=1)
                                             ;               10 = PH data (CAL)                    (=2)
                                             ;               11 = ??
                                             ;
      spare: BYTARR(8) }                     ;184- Spare
   
   
   
HXT_PC_Data = { HXT_PC_Data_Rec,              $
                                             ;       hxt_pc(i,j,k)           i=energy band
                                             ;                               j=sensor #
                                             ;                               k=repetition #
      pc_data: BYTARR(4,64,4) }              ;   0- PC data
   
   
   
HXT_PH_Data = { HXT_PH_Data_Rec,              $
                                             ;       hxt_ph(i,j)             i=energy channel
                                             ;                               j=sensor #
      ph_data: BYTARR(64,64) }               ;   0- PH data
   
   
   
HXT_RoadMap = { HXT_RoadMap_Rec,              $
                                             ;     For a full description of the fields,
                                             ;     look at the Index_Rec definition
                                             ;
      ByteSkip: LONG(0),  $                  ; 00- Start byte of index rec
                                             ;
      time: LONG(0),  $                      ; 04- Major frame time (millisec of day)
      day: FIX(0),  $                        ; 08- Major frame day (since 1-Jan-79)
      Flare_Control: BYTE(0),  $             ; 14- Flare flag control (active triggers) 
                                             ;     Copied from GEN_INDEX (needed here to put
                                             ;     into the observing log entry)
      Flare_Status: BYTE(0),  $              ; 15- Flare flag status 
                                             ;
      DP_mode: BYTE(0),  $                   ; 10- DP Mode
      DP_rate: BYTE(0),  $                   ; 11- DP Rate
                                             ;
      Pow_stat: BYTE(0),  $                  ; 12- Power status 
      HV_stat: BYTE(0),  $                   ; 13- HV Status 
                                             ;
      sum_L: FIX(0),  $                      ; 14- Summation of Low energy counts (cnts/sec)
      sum_M1: FIX(0),  $                     ; 16- Medium-1 energy
      sum_M2: FIX(0),  $                     ; 18- Medium-2 energy
      sum_H: FIX(0),  $                      ; 20- High energy
      sigma_L: FIX(0),  $                    ; 22- Standard deviation of low energy channels
                                             ;
      dataRecTypes: BYTE(0),  $              ; 24- What data follows
                                             ;TODO - Flag to show start of PH data ??
                                             ;
      spare: BYTARR(5) }                     ; 25-
   
   
   
HXT_Version = { HXT_Version_Rec,              $
      roadmap : FIX('40F2'x),  $             ;
                                             ; 00- The version number of the Roadmap
                                             ;     This value is not contained in the
                                             ;     roadmap structure to save space.  It is
                                             ;     saved in the "Pointer Record"
      hxi_roadmap : FIX('40F3'x),  $         ;
                                             ;   - The HXI data file roadmap version number
                                             ;
                                             ;     This structure is not written to any files
      spare: BYTARR(12) }                    ;     (need for automatic conversion to IDL format)
   
   
   
HXI_Index = { HXI_Index_Rec,              $
      index_version : FIX('4021'x),  $       ;
                                             ;  0- Index structure version                                   Ground 
                                             ;       AAAABBBB CCCCDDDD
                                             ;
                                             ;    --------------- Selection of Data -----------------------
      chan: BYTE(0),  $                      ;   - Channel that was converted to an image
                                             ;       0 = Low energy (15-24.4 KeV)
                                             ;       1 = Medium-1 energy (24.4-35.2 KeV) cnts/sec
                                             ;       2 = Medium-2 energy (35.2-56.8 KeV) cnts/sec
                                             ;       3 = High energy (56.8-100 KeV) cnts/sec
      cnts_p_cm2: FLOAT(0),  $               ;   - Counts per CM^2 for the selected channel (not per sec)
                                             ;       16 coarsest collomators (fan beam)
      actim: FIX(0),  $                      ;   - accumulation time in 0.1 sec units (cannot be less than 0.5 sec)
      interval: FIX(0),  $                   ;   - end time minus start time (should equal "actim" if no data is mis
                                             ;     (0.1 sec units)
                                             ;   - The time/day of the start time of the data is in the GEN structur
                                             ;
      bkg_time: LONG(0),  $                  ;   - Time of start of background data used (millisec of day)
      bkg_day: FIX(0),  $                    ;   - Days of start of background data used (days since 1-Jan-79)
                                             ;       bkg_day = 0 means no background subtracted
                                             ;       bkg_day = -1 means user defined background was used
      bkg_actim: FIX(0),  $                  ;   - accumulation time in 0.1 sec units for background
                                             ;       bkg_actim = 0 means no background subtracted
      bkg_interval: FIX(0),  $               ;   - end time minus start time (should equal "actim" if no data is mis
                                             ;     (0.1 sec units)
                                             ;
                                             ;    --------------- Input Parameters to Synthesis Routine ------------
                                             ;
      grause: BYTARR(8),  $                  ;   - Grid assembly usage (set = used)
                                             ;       (0) = coarsest spatial resolution (single pitch angle)
                                             ;             (top of grouse.1 file)
                                             ;               b0 = largest position angle
                                             ;               b7 = smallest position angle
                                             ;                         1 1 1 1 1 1 1 1
                                             ;                       smallest     largest
                                             ;       (7) = finest spatial resolution
      x0: FLOAT(0),  $                       ;   - FOV X Center position in HXT units of 126 arcsec
      y0: FLOAT(0),  $                       ;   - FOV Y Center position in HXT units of 126 arcsec
      alpha: FLOAT(0),  $                    ;   - Amplitude of phase correction factor
      iway: FIX(0),  $                       ;   - Patter to use
                                             ;               =0 for triangular mo. patterns
                                             ;               =1 for sine wave patterns
      syserr_tech: BYTE(0),  $               ;   - Technique used for handling "syserr"
                                             ;               0 = ??
      he_mod_adj: BYTE(0),  $                ;   - Model used for adjusting the high energy modulation pattern
                                             ;               0 = ??
      syserr: FLOAT(0),  $                   ;   - systematic error term to be added to Poisson Uncertainty
      gamma0: FLOAT(0),  $                   ;   - initial value of iteration gain
      laminc: FIX(0),  $                     ;   - initial value for lambda increment
      chilim: FLOAT(0),  $                   ;   - minimum value of chi^2 needed
      area: FLOAT(0),  $                     ;   - total area in cm^2 of scintillators
                                             ;
      resolution: FIX(0),  $                 ;   - In milli arc seconds
                                             ;
                                             ;    --------------- Results of Synthesis -----------------------
                                             ;
      lambda: FIX(0),  $                     ;
      iteration: FIX(0),  $                  ;
      chi2: FLOAT(0),  $                     ;
      delta: FLOAT(0),  $                    ;
                                             ;
      max_bright: FLOAT(0),  $               ;   - Maximum brightness
      x_max: FIX(0),  $                      ;   - Column of maximum (starting at 0)
      y_max: FIX(0),  $                      ;   - Line of maximum (starting at 0)
                                             ;
      shape_sav: INTARR(2),  $               ;   - Size of image 
                                             ;       (0) = number of columns (ie: 64)
                                             ;       (1) = number of lines (ie: 64)
                                             ;
      spare: BYTARR(7) }                     ;   - Spare
   
   
   
HXI_RoadMap = { HXI_RoadMap_Rec,              $
                                             ;     For a full description of the fields,
                                             ;     look at the Index_Rec definition
                                             ;
      ByteSkip: LONG(0),  $                  ; 00- Start byte of index rec
                                             ;
      time: LONG(0),  $                      ; 04- Major frame time (millisec of day)
      day: FIX(0),  $                        ; 08- Major frame day (since 1-Jan-79)
                                             ;
      chan: BYTE(0),  $                      ; 10- Channel that was converted to an image
      actim: FIX(0),  $                      ; 11- accumulation time in millisec (cannot be less than 0.5 sec)
      cnts_p_cm2: FLOAT(0),  $               ; 13- Counts per CM^2 for the selected channel (not per sec)
                                             ;
      lambda: FIX(0),  $                     ; 17-
      iteration: FIX(0),  $                  ; 19
      chi2: FLOAT(0),  $                     ; 21
      max_bright: FLOAT(0),  $               ; 25- Maximum brightness
                                             ;
      spare: BYTARR(3) }                     ; 29-
   
   
   
HXI_QS_SCPara = { HXI_QS_SCPara_Rec,              $
      entry_type : FIX('4031'x),  $          ;
                                             ; 00- Structure/Entry type
                                             ;
      st_time: LONG(0),  $                   ; 02- Start time (millisec of day) entries are valid
      st_day: FIX(0),  $                     ; 06- Start day (since 1-Jan-79)
      en_time: LONG(0),  $                   ; 08- End time (millisec of day)
      en_day: FIX(0),  $                     ; 12- End day (since 1-Jan-79)
                                             ;
      sensor: INTARR(64),  $                 ; 14- Sensor # (0-63)
                                             ;       ( 0-15 are fan beam elements)
                                             ;       (16-63 are sine/cosine)
      spat_freq: INTARR(64),  $              ;   - Spatial frequency (1-8)
      pos_angle: INTARR(64),  $              ;   - Position angle in degrees (0,45,90,135,30,60,120,150)
      st$id: BYTARR(64),  $                  ;   - Identification
                                             ;       1-4 = fan beam sub-element
                                             ;       C   = cosine element
                                             ;       S   = sine element
      dc: FLTARR(64),  $                     ;   - DC offset of modulation pattern
      amp: FLTARR(64),  $                    ;   - Amplitiude of modulation pattern
      phase: FLTARR(64),  $                  ;   - Phase of modulation pattern
      phase_corr: FLTARR(64),  $             ;   - Phase correction factor of modulation pattern
                                             ;
      st$para_filnam: BYTARR(10),  $         ;   - The parameter file name used to load the above parameters
                                             ;
      spare: BYTARR(40) }                    ; 14- Spare
   
   
   
HXI_QS_Bkg = { HXI_QS_Bkg_Rec,              $
      entry_type : FIX('4041'x),  $          ;
                                             ; 00- Structure/Entry type
                                             ;
      st_time: LONG(0),  $                   ; 02- Start time (millisec of day) entries are valid
      st_day: FIX(0),  $                     ; 06- Start day (since 1-Jan-79)
      en_time: LONG(0),  $                   ; 08- End time (millisec of day)
      en_day: FIX(0),  $                     ; 12- End day (since 1-Jan-79)
                                             ;
      bkg: FLTARR(64,4),  $                  ; 14- The background counts used
                                             ;       (i,j)
                                             ;               (i) = sensor #
                                             ;               (j) = channel
      st$comments: BYTARR(20),  $            ;526-
                                             ;
      spare: BYTARR(46) }                    ;546- Spare
   
   
   
  
  
end
