code: def test_msdki_statistics():
      # tests if MD and MK are equal to expected values of a spherical
      # tensors
  
      # Multi-tensors
      ub = unique_bvals_magnitude(bvals_3s)
      design_matrix = msdki.design_matrix(ub)
      msignal, ng = msdki.mean_signal_bvalue(DWI, gtab_3s, bmag=None)
      params = msdki.wls_fit_msdki(design_matrix, msignal, ng)
      assert_array_almost_equal(params[..., 1], MKgt_multi)
      assert_array_almost_equal(params[..., 0], MDgt_multi)
  
      mdkiM = msdki.MeanDiffusionKurtosisModel(gtab_3s)
      mdkiF = mdkiM.fit(DWI)
      mk = mdkiF.msk
      md = mdkiF.msd
      assert_array_almost_equal(MKgt_multi, mk)
      assert_array_almost_equal(MDgt_multi, md)
  
      # Single-tensors
      mdkiF = mdkiM.fit(signal_sph)
      mk = mdkiF.msk
      md = mdkiF.msd
      assert_array_almost_equal(MKgt, mk)
      assert_array_almost_equal(MDgt, md)
  
      # Test with given mask
      mask = np.ones(DWI.shape[:-1])
      v = (0, 0, 0)
      mask[1, 1, 1] = 0
      mdkiF = mdkiM.fit(DWI, mask=mask)
      mk = mdkiF.msk
      md = mdkiF.msd
      assert_array_almost_equal(MKgt_multi, mk)
      assert_array_almost_equal(MDgt_multi, md)
      assert_array_almost_equal(
          MKgt_multi[v], mdkiF[v].msk
      )  # tuple case
      assert_array_almost_equal(
          MDgt_multi[v], mdkiF[v].msd
      )  # tuple case
      assert_array_almost_equal(
          MKgt_multi[0], mdkiF[0].msk
      )  # not tuple case
      assert_array_almost_equal(
          MDgt_multi[0], mdkiF[0].msd
      )  # not tuple case
  
      # Test returned S0
      mdkiM = msdki.MeanDiffusionKurtosisModel(
          gtab_3s, return_S0_hat=True
      )
      mdkiF = mdkiM.fit(DWI)
      assert_array_almost_equal(S0gt_multi, mdkiF.S0_hat)
      assert_array_almost_equal(MKgt_multi[v], mdkiF[v].msk)
  
file_path: dipy/dipy/reconst/tests/test_msdki.py
imports: import numpy
  import random
  from numpy.testing import assert_array_almost_equal, assert_raises, assert_almost_equal, assert_
  from dipy.sims.voxel import single_tensor, multi_tensor_dki
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.core.gradients import gradient_table, unique_bvals_magnitude, round_bvals
  from dipy.data import get_fnames
  import dipy.reconst.msdki
  from dipy.reconst.msdki import msk_from_awf, awf_from_msk
label_desc: Use image node_id 7 for calling a global function with example usage: test_msdki_statistics() without return types