code: def test_fit_data():
      fdata, fbval, fbvec = dpd.get_fnames("small_25")
      fstreamlines = dpd.get_fnames("small_25_streamlines")
      gtab = grad.gradient_table(fbval, fbvec)
      ni_data = nib.load(fdata)
      data = np.asarray(ni_data.dataobj)
  
      tensor_streamlines = nib.streamlines.load(
          fstreamlines
      ).streamlines
      sft = StatefulTractogram(tensor_streamlines, ni_data, Space.RASMM)
      sft.to_vox()
      tensor_streamlines_vox = sft.streamlines
  
      life_model = life.FiberModel(gtab)
      life_fit = life_model.fit(data, tensor_streamlines_vox, np.eye(4))
      model_error = life_fit.predict() - life_fit.data
      model_rmse = np.sqrt(np.mean(model_error**2, -1))
      matlab_rmse, matlab_weights = dpd.matlab_life_results()
      # Lower error than the matlab implementation for these data:
      npt.assert_(np.median(model_rmse) < np.median(matlab_rmse))
      # And a moderate correlation with the Matlab implementation weights:
      npt.assert_(
          np.corrcoef(matlab_weights, life_fit.beta)[0, 1] > 0.6
      )
  
file_path: dipy/dipy/tracking/tests/test_life.py
imports: import os.path
  import dipy.core.gradients
  import dipy.core.optimize
  import dipy.data
  from dipy.io.image import load_nifti_data
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.io.stateful_tractogram import Space, StatefulTractogram
  import dipy.tracking.life
  import nibabel
  import numpy
  import numpy.testing
  import scipy.linalg
label_desc: Use image node_id 7 for calling a global function with example usage: test_fit_data() without return types