class_docstr: Ivim model
      
docstr: Use leastsq to find ivim_params
  
  Parameters
  ----------
  data : array, (len(bvals))
      An array containing the signal from a voxel.
      If the data was a 3D image of 10x10x10 grid with 21 bvalues,
      the multi_voxel decorator will run the single voxel fitting
      on all the 1000 voxels to get the parameters in
      IvimFit.model_paramters. The shape of the parameter array
      will be (data[:-1], 4).
  
  x0 : array
      Initial guesses for the parameters S0, f, D_star and D
      calculated using a linear fitting.
  
  Returns
  -------
  x0 : array
      Estimates of the parameters S0, f, D_star and D.
code: def _leastsq(self, data, x0):
      """Use leastsq to find ivim_params
  
      Parameters
      ----------
      data : array, (len(bvals))
          An array containing the signal from a voxel.
          If the data was a 3D image of 10x10x10 grid with 21 bvalues,
          the multi_voxel decorator will run the single voxel fitting
          on all the 1000 voxels to get the parameters in
          IvimFit.model_paramters. The shape of the parameter array
          will be (data[:-1], 4).
  
      x0 : array
          Initial guesses for the parameters S0, f, D_star and D
          calculated using a linear fitting.
  
      Returns
      -------
      x0 : array
          Estimates of the parameters S0, f, D_star and D.
      """
      gtol = self.options["gtol"]
      ftol = self.options["ftol"]
      xtol = self.tol
      maxfev = self.options["maxiter"]
      bounds = self.bounds
  
      try:
          res = least_squares(
              _ivim_error,
              x0,
              bounds=bounds,
              ftol=ftol,
              xtol=xtol,
              gtol=gtol,
              max_nfev=maxfev,
              args=(self.gtab, data),
              x_scale=self.x_scale,
          )
          ivim_params = res.x
          if np.all(np.isnan(ivim_params)):
              return np.array([-1, -1, -1, -1])
          return ivim_params
      except ValueError:
          warningMsg = "x0 is unfeasible for leastsq fitting."
          warningMsg += " Returning x0 values from the linear fit."
          warnings.warn(warningMsg, UserWarning)
          return x0
  
imports: import warnings
  import numpy
  from scipy.optimize import least_squares, differential_evolution
  from dipy.reconst.base import ReconstModel
  from dipy.reconst.multi_voxel import multi_voxel_fit
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 6 for calling the IvimModelTRR obj's underlying member method code with example usage: obj._leastsq(data, x0) and returns: ivim_params, np, x0