code: def test_exponential_iso():
      fdata, fbvals, fbvecs = dpd.get_fnames()
      data_dti = load_nifti_data(fdata)
      gtab_dti = grad.gradient_table(fbvals, fbvecs)
      data_multi, gtab_multi = dpd.dsi_deconv_voxels()
  
      for data, gtab in zip(
          [data_dti, data_multi], [gtab_dti, gtab_multi]
      ):
          sfmodel = sfm.SparseFascicleModel(
              gtab, isotropic=sfm.ExponentialIsotropicModel
          )
  
          sffit1 = sfmodel.fit(data[0, 0, 0])
          sphere = dpd.get_sphere()
          odf = sffit1.odf(sphere)
          pred = sffit1.predict(gtab)
          npt.assert_equal(pred.shape, data[0, 0, 0].shape)
          npt.assert_equal(
              odf.shape, data[0, 0, 0].shape[:-1] + (sphere.x.shape[0],)
          )
  
          sffit2 = sfmodel.fit(data)
          sphere = dpd.get_sphere()
          odf = sffit2.odf(sphere)
          pred = sffit2.predict(gtab)
          npt.assert_equal(pred.shape, data.shape)
          npt.assert_equal(
              odf.shape, data.shape[:-1] + (sphere.x.shape[0],)
          )
  
          mask = np.zeros(data.shape[:3])
          mask[2:5, 2:5, :] = 1
          sffit3 = sfmodel.fit(data, mask=mask)
          sphere = dpd.get_sphere()
          odf = sffit3.odf(sphere)
          pred = sffit3.predict(gtab)
          npt.assert_equal(pred.shape, data.shape)
          npt.assert_equal(
              odf.shape, data.shape[:-1] + (sphere.x.shape[0],)
          )
  
          SNR = 1000
          S0 = 100
          mevals = np.array(
              ([0.0015, 0.0005, 0.0005], [0.0015, 0.0005, 0.0005])
          )
          angles = [(0, 0), (60, 0)]
          S, sticks = sims.multi_tensor(
              gtab,
              mevals,
              S0,
              angles=angles,
              fractions=[50, 50],
              snr=SNR,
          )
          sffit = sfmodel.fit(S)
          pred = sffit.predict()
          npt.assert_(xval.coeff_of_determination(pred, S) > 96)
  
file_path: dipy/dipy/reconst/tests/test_sfm.py
imports: import warnings
  import numpy
  import numpy.testing
  import pytest
  import dipy.reconst.sfm
  import dipy.data
  import dipy.core.gradients
  import dipy.sims.voxel
  import dipy.core.optimize
  import dipy.reconst.cross_validation
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.io.image import load_nifti_data
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 7 for calling a global function with example usage: test_exponential_iso() without return types