code: def test_peaks_shm_coeff():
      SNR = 100
      S0 = 100
  
      _, fbvals, fbvecs = get_fnames("small_64D")
  
      sphere = default_sphere
  
      bvals, bvecs = read_bvals_bvecs(fbvals, fbvecs)
  
      gtab = gradient_table(bvals, bvecs)
      mevals = np.array(
          ([0.0015, 0.0003, 0.0003], [0.0015, 0.0003, 0.0003])
      )
  
      data, _ = multi_tensor(
          gtab,
          mevals,
          S0,
          angles=[(0, 0), (60, 0)],
          fractions=[50, 50],
          snr=SNR,
      )
  
      from dipy.reconst.shm import CsaOdfModel
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          model = CsaOdfModel(gtab, 4)
          pam = peaks_from_model(
              model,
              data[None, :],
              sphere,
              0.5,
              45,
              return_odf=True,
              return_sh=True,
          )
      # Test that spherical harmonic coefficients return back correctly
      odf2 = np.dot(pam.shm_coeff, pam.B)
      assert_array_almost_equal(pam.odf, odf2)
      assert_equal(pam.shm_coeff.shape[-1], 45)
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          pam = peaks_from_model(
              model,
              data[None, :],
              sphere,
              0.5,
              45,
              return_odf=True,
              return_sh=False,
          )
      assert_equal(pam.shm_coeff, None)
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=tournier07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          pam = peaks_from_model(
              model,
              data[None, :],
              sphere,
              0.5,
              45,
              return_odf=True,
              return_sh=True,
              sh_basis_type="tournier07",
          )
  
      odf2 = np.dot(pam.shm_coeff, pam.B)
      assert_array_almost_equal(pam.odf, odf2)
  
imports: import warnings
  import numpy
  import pickle
  from io import BytesIO
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_almost_equal, assert_equal, assert_
  from dipy.reconst.odf import OdfFit, OdfModel, gfa
  from dipy.direction.peaks import peaks_from_model, peak_directions, peak_directions_nl, reshape_peaks_for_visualization
  from dipy.core.subdivide_octahedron import create_unit_hemisphere
  from dipy.core.sphere import unit_icosahedron
  from dipy.sims.voxel import multi_tensor, multi_tensor_odf
  from dipy.data import get_fnames, get_sphere, default_sphere
  from dipy.core.gradients import gradient_table, GradientTable
  from dipy.core.sphere_stats import angular_similarity
  from dipy.core.sphere import HemiSphere
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.reconst.shm import descoteaux07_legacy_msg, tournier07_legacy_msg
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 10 for calling a global function with example usage: test_peaks_shm_coeff() without return types