parameters: (peak_file_name)
return_statement: return scan_peak_dict
docstring: read a csv file saved from the peak integration information table
      :param peak_file_name:
      :return: a dictionary of peak integration result information in STRING form
docstring_summary: read a csv file saved from the peak integration information table
      :param peak_file_name:
      :return: a dictionary of peak integration result information in STRING form
docstring_tokens: read a csv file saved from the peak integration information table : param peak_file_name : : return : a dictionary of peak integration result information in STRING form
function: def read_peak_integration_table_csv(peak_file_name):
      """
      read a csv file saved from the peak integration information table
      :param peak_file_name:
      :return: a dictionary of peak integration result information in STRING form
      """
      # check input
      assert isinstance(peak_file_name, str), 'Peak integration table file {0} must be a string but not a {1}.' \
                                              ''.format(peak_file_name, type(peak_file_name))
  
      if os.path.exists(peak_file_name) is False:
          raise RuntimeError('Peak integration information file {0} does not exist.'.format(peak_file_name))
  
      # read
      scan_peak_dict = dict()
      with open(peak_file_name, 'r') as csv_file:
          reader = csv.reader(csv_file, delimiter='\t', quotechar='#')
          title_list = None
          for index, row in enumerate(reader):
              if index == 0:
                  # title
                  title_list = row
              else:
                  # value
                  peak_dict = dict()
                  for term_index, value in enumerate(row):
                      peak_dict[title_list[term_index]] = value
                  scan_number = int(peak_dict['Scan'])
                  scan_peak_dict[scan_number] = peak_dict
              # END-IF-ELSE
          # END-FOR
      # END-WITH
  
      return scan_peak_dict
function_tokens: def read_peak_integration_table_csv ( peak_file_name ) : # check input assert isinstance ( peak_file_name , str ) , 'Peak integration table file {0} must be a string but not a {1}.' '' . format ( peak_file_name , type ( peak_file_name ) ) if os . path . exists ( peak_file_name ) is False : raise RuntimeError ( 'Peak integration information file {0} does not exist.' . format ( peak_file_name ) ) # read scan_peak_dict = dict ( ) with open ( peak_file_name , 'r' ) as csv_file : reader = csv . reader ( csv_file , delimiter = '\t' , quotechar = '#' ) title_list = None for index , row in enumerate ( reader ) : if index == 0 : # title title_list = row else : # value peak_dict = dict ( ) for term_index , value in enumerate ( row ) : peak_dict [ title_list [ term_index ] ] = value scan_number = int ( peak_dict [ 'Scan' ] ) scan_peak_dict [ scan_number ] = peak_dict # END-IF-ELSE # END-FOR # END-WITH return scan_peak_dict