code: def find_signal_means(
      b_unique, data_norm, bvals, rho, lb_matrix, w=1e-03
  ):
      r"""Calculate the mean signal for each shell.
  
      Parameters
      ----------
      b_unique : 1d ndarray,
          unique b-values in a vector excluding zero
      data_norm : 1d ndarray,
          normalized diffusion signal
      bvals : 1d ndarray,
          the b-values
      rho : 2d ndarray,
          SH basis matrix for fitting the signal on each shell
      lb_matrix : 2d ndarray,
          Laplace-Beltrami regularization matrix
      w : float,
          weight for the Laplace-Beltrami regularization
  
      Returns
      -------
      means : 1d ndarray
          the average of the signal for each b-values
  
      """
      lb = len(b_unique)
      means = np.zeros(lb)
      for u in range(lb):
          ind = bvals == b_unique[u]
          shell = data_norm[ind]
          if np.sum(ind) > 20:
              M = rho[ind, :]
              coef = np.linalg.multi_dot(
                  [
                      np.linalg.inv(np.dot(M.T, M) + w * lb_matrix),
                      M.T,
                      shell,
                  ]
              )
  
              means[u] = coef[0] / np.sqrt(4 * np.pi)
          else:
              means[u] = shell.mean()
  
      return means
  
imports: from warnings import warn
  import numpy
  from dipy.reconst.cache import Cache
  from dipy.reconst.multi_voxel import multi_voxel_fit
  from dipy.reconst.csdeconv import csdeconv
  from dipy.reconst.shm import real_sh_descoteaux_from_index
  from scipy.special import gamma, hyp1f1
  from dipy.core.geometry import cart2sphere
  from dipy.data import default_sphere
  from dipy.reconst.odf import OdfModel, OdfFit
  from scipy.optimize import leastsq
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 1 for calling a global function with example usage: find_signal_means(b_unique, data_norm, bvals, rho, lb_matrix, w) and returns: means