code: def get_phi_comps_from_recfile(recfile):
      
      iiter = 1
      iters = {}
      f = open(recfile,'r')
      while True:
          line = f.readline()
          if line == '':
              break
          if "starting phi for this iteration" in line.lower() or \
              "final phi" in line.lower():
              contributions = {}
              while True:
                  line = f.readline()
                  if line == '':
                      break
                  if "contribution to phi" not in line.lower():
                      iters[iiter] = contributions
                      iiter += 1
                      break
                  raw = line.strip().split()
                  val = float(raw[-1])
                  group = raw[-3].lower().replace('\"', '')
                  contributions[group] = val
      return iters
docs: read the phi components from a record file by iteration
  
      Parameters
      ----------
      recfile : str
          pest record file name
  
      Returns
      -------
      iters : dict
          nested dictionary of iteration number, {group,contribution}