code: def test_MK_singularities():
      # To test MK in case that analytical solution was a singularity not covered
      # by other tests
  
      dkiM = dki.DiffusionKurtosisModel(gtab_2s)
  
      # test singularity L1 == L2 - this is the case of a prolate diffusion
      # tensor for crossing fibers at 90 degrees
      angles_all = np.array(
          [
              [(90, 0), (90, 0), (0, 0), (0, 0)],
              [(89.9, 0), (89.9, 0), (0, 0), (0, 0)],
          ]
      )
      for angles_90 in angles_all:
          s_90, dt_90, kt_90 = multi_tensor_dki(
              gtab_2s,
              mevals_cross,
              S0=100,
              angles=angles_90,
              fractions=frac_cross,
              snr=None,
          )
          dkiF = dkiM.fit(s_90)
          MK_an = dkiF.mk(analytical=True)
          MK_nm = dkiF.mk(analytical=False)
  
          assert_almost_equal(MK_an, MK_nm, decimal=3)
  
          # test singularity L1 == L3 and L1 != L2
          # since L1 is defined as the larger eigenvalue and L3 the smallest
          # eigenvalue, this singularity theoretically will never be called,
          # because for L1 == L3, L2 have also to be  = L1 and L2.
          # Nevertheless, I decided to include this test since this singularity
          # is relevant for cases that eigenvalues are not ordered
  
          # artificially revert the eigenvalue and eigenvector order
          dki_params = dkiF.model_params.copy()
          dki_params[1] = dkiF.model_params[2]
          dki_params[2] = dkiF.model_params[1]
          dki_params[4] = dkiF.model_params[5]
          dki_params[5] = dkiF.model_params[4]
          dki_params[7] = dkiF.model_params[8]
          dki_params[8] = dkiF.model_params[7]
          dki_params[10] = dkiF.model_params[11]
          dki_params[11] = dkiF.model_params[10]
  
          MK_an = dki.mean_kurtosis(dki_params, analytical=True)
          MK_nm = dki.mean_kurtosis(dki_params, analytical=False)
  
          assert_almost_equal(MK_an, MK_nm, decimal=3)
  
imports: import numpy
  import random
  import dipy.reconst.dki
  import dipy.reconst.dti
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_almost_equal, assert_raises
  from dipy.sims.voxel import multi_tensor_dki
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.core.gradients import gradient_table
  from dipy.data import get_fnames
  from dipy.reconst.dti import from_lower_triangular, decompose_tensor
  from dipy.reconst.dki import mean_kurtosis, carlson_rf, carlson_rd, axial_kurtosis, radial_kurtosis, mean_kurtosis_tensor, _positive_evals, lower_triangular, kurtosis_fractional_anisotropy
  from dipy.core.sphere import Sphere
  from dipy.data import default_sphere
  from dipy.core.geometry import sphere2cart
  from dipy.utils.optpkg import optional_package
  from dipy.utils.tripwire import TripWireError
label_desc: Use image node_id 17 for calling a global function with example usage: test_MK_singularities() without return types