code: def fits_recarray_to_dict(table):
      
  
      cols = {}
      for icol, col in enumerate(table.columns.names):
  
          col_data = table.data[col]
          if type(col_data[0]) == np.float32:
              cols[col] = np.array(col_data, dtype=float)
          elif type(col_data[0]) == np.float64:
              cols[col] = np.array(col_data, dtype=float)
          elif type(col_data[0]) == str:
              cols[col] = np.array(col_data, dtype=str)
          elif type(col_data[0]) == np.string_:
              cols[col] = np.array(col_data, dtype=str)
          elif type(col_data[0]) == np.int16:
              cols[col] = np.array(col_data, dtype=int)
          elif type(col_data[0]) == np.ndarray:
              cols[col] = np.array(col_data)
          else:
              raise Exception(
                  'Unrecognized column type: %s %s' % (col, str(type(col_data))))
  
      return cols
docs: Convert a FITS recarray to a python dictionary.