code: def calc_cov_x(infodic, p):
      
  
      fjac = infodic["fjac"]
      ipvt = infodic["ipvt"]
      n = len(p)
  
      # adapted from leastsq function in scipy/optimize/minpack.py
      perm = np.take(np.eye(n), ipvt - 1, 0)
      r = np.triu(np.transpose(fjac)[:n, :])
      R = np.dot(r, perm)
      try:
          cov_x = np.linalg.inv(np.dot(np.transpose(R), R))
      except LinAlgError:
          cov_x = None
      return cov_x
docs: Calculate cov_x from fjac, ipvt and p as is done in leastsq