code: def multi_tensor_dki(
      gtab,
      mevals,
      S0=1.0,
      angles=((90.0, 0.0), (90.0, 0.0)),
      fractions=(50, 50),
      snr=20,
  ):
      r"""Simulate the diffusion-weight signal, diffusion and kurtosis tensors
      based on the DKI model
  
      Parameters
      ----------
      gtab : GradientTable
      mevals : array (K, 3)
          eigenvalues of the diffusion tensor for each individual compartment
      S0 : float (optional)
          Unweighted signal value (b0 signal).
      angles : array (K,2) or (K,3) (optional)
          List of K tensor directions of the diffusion tensor of each compartment
          in polar angles (in degrees) or unit vectors
      fractions : float (K,) (optional)
          Percentage of the contribution of each tensor. The sum of fractions
          should be equal to 100%.
      snr : float (optional)
          Signal to noise ratio, assuming Rician noise.  If set to None, no
          noise is added.
  
      Returns
      -------
      S : (N,) ndarray
          Simulated signal based on the DKI model.
      dt : (6,)
          elements of the diffusion tensor.
      kt : (15,)
          elements of the kurtosis tensor.
  
      Notes
      -----
      Simulations are based on multicompartmental models which assumes that
      tissue is well described by impermeable diffusion compartments
      characterized by their only diffusion tensor. Since simulations are based
      on the DKI model, coefficients larger than the fourth order of the signal's
      taylor expansion approximation are neglected.
  
      Examples
      --------
      >>> import numpy as np
      >>> from dipy.sims.voxel import multi_tensor_dki
      >>> from dipy.data import get_fnames
      >>> from dipy.core.gradients import gradient_table
      >>> from dipy.io.gradients import read_bvals_bvecs
      >>> fimg, fbvals, fbvecs = get_fnames('small_64D')
      >>> bvals, bvecs = read_bvals_bvecs(fbvals, fbvecs)
      >>> bvals_2s = np.concatenate((bvals, bvals * 2), axis=0)
      >>> bvecs_2s = np.concatenate((bvecs, bvecs), axis=0)
      >>> gtab = gradient_table(bvals_2s, bvecs_2s)
      >>> mevals = np.array([[0.00099, 0, 0],[0.00226, 0.00087, 0.00087]])
      >>> S, dt, kt =  multi_tensor_dki(gtab, mevals)
  
      References
      ----------
      .. [1] R. Neto Henriques et al., "Exploring the 3D geometry of the
             diffusion kurtosis tensor - Impact on the development of robust
             tractography procedures and novel biomarkers", NeuroImage (2015)
             111, 85-99.
  
      """
      if np.round(np.sum(fractions), 2) != 100.0:
          raise ValueError("Fractions should sum to 100")
  
      fractions = [f / 100.0 for f in fractions]
  
      # S = np.zeros(len(gtab.bvals))
  
      sticks = _check_directions(angles)
  
      # computing a 3D matrix containing the individual DT components
      D_comps = np.zeros((len(fractions), 3, 3))
      for i in range(len(fractions)):
          R = all_tensor_evecs(sticks[i])
          D_comps[i] = dot(dot(R, np.diag(mevals[i])), R.T)
  
      # compute voxel's DT
      DT = np.zeros((3, 3))
      for i in range(len(fractions)):
          DT = DT + fractions[i] * D_comps[i]
      dt = np.array(
          [DT[0][0], DT[0][1], DT[1][1], DT[0][2], DT[1][2], DT[2][2]]
      )
  
      # compute voxel's MD
      MD = (DT[0][0] + DT[1][1] + DT[2][2]) / 3
  
      # compute voxel's KT
      kt = np.zeros(15)
      kt[0] = kurtosis_element(D_comps, fractions, 0, 0, 0, 0, DT, MD)
      kt[1] = kurtosis_element(D_comps, fractions, 1, 1, 1, 1, DT, MD)
      kt[2] = kurtosis_element(D_comps, fractions, 2, 2, 2, 2, DT, MD)
      kt[3] = kurtosis_element(D_comps, fractions, 0, 0, 0, 1, DT, MD)
      kt[4] = kurtosis_element(D_comps, fractions, 0, 0, 0, 2, DT, MD)
      kt[5] = kurtosis_element(D_comps, fractions, 0, 1, 1, 1, DT, MD)
      kt[6] = kurtosis_element(D_comps, fractions, 1, 1, 1, 2, DT, MD)
      kt[7] = kurtosis_element(D_comps, fractions, 0, 2, 2, 2, DT, MD)
      kt[8] = kurtosis_element(D_comps, fractions, 1, 2, 2, 2, DT, MD)
      kt[9] = kurtosis_element(D_comps, fractions, 0, 0, 1, 1, DT, MD)
      kt[10] = kurtosis_element(D_comps, fractions, 0, 0, 2, 2, DT, MD)
      kt[11] = kurtosis_element(D_comps, fractions, 1, 1, 2, 2, DT, MD)
      kt[12] = kurtosis_element(D_comps, fractions, 0, 0, 1, 2, DT, MD)
      kt[13] = kurtosis_element(D_comps, fractions, 0, 1, 1, 2, DT, MD)
      kt[14] = kurtosis_element(D_comps, fractions, 0, 1, 2, 2, DT, MD)
  
      # compute S based on the DT and KT
      S = dki_signal(gtab, dt, kt, S0, snr)
  
      return S, dt, kt
  
imports: import numpy
  from numpy import dot
  from dipy.core.geometry import sphere2cart
  from dipy.core.geometry import vec2vec_rotmat
  from dipy.core.gradients import GradientTable
  from dipy.reconst.utils import dki_design_matrix
  from scipy.special import jn
label_desc: Use image node_id 12 for calling a global function with example usage: multi_tensor_dki(gtab, mevals, S0, angles, fractions, snr) and returns: S,  dt,  kt