code: def test_peaksFromModelParallel():
      SNR = 100
      S0 = 100
  
      _, fbvals, fbvecs = get_fnames("small_64D")
  
      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,
      )
  
      for sphere in [_sphere, default_sphere]:
          # test equality with/without multiprocessing
          model = SimpleOdfModel(gtab)
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore",
                  message=descoteaux07_legacy_msg,
                  category=PendingDeprecationWarning,
              )
              pam_multi = peaks_from_model(
                  model,
                  data,
                  sphere,
                  0.5,
                  45,
                  normalize_peaks=True,
                  return_odf=True,
                  return_sh=True,
                  parallel=True,
              )
  
              pam_single = peaks_from_model(
                  model,
                  data,
                  sphere,
                  0.5,
                  45,
                  normalize_peaks=True,
                  return_odf=True,
                  return_sh=True,
                  parallel=False,
              )
  
              pam_multi_inv1 = peaks_from_model(
                  model,
                  data,
                  sphere,
                  0.5,
                  45,
                  normalize_peaks=True,
                  return_odf=True,
                  return_sh=True,
                  parallel=True,
                  num_processes=-1,
              )
  
              pam_multi_inv2 = peaks_from_model(
                  model,
                  data,
                  sphere,
                  0.5,
                  45,
                  normalize_peaks=True,
                  return_odf=True,
                  return_sh=True,
                  parallel=True,
                  num_processes=-2,
              )
  
          for pam in [pam_multi, pam_multi_inv1, pam_multi_inv2]:
              assert_equal(pam.gfa.dtype, pam_single.gfa.dtype)
              assert_equal(pam.gfa.shape, pam_single.gfa.shape)
              assert_array_almost_equal(pam.gfa, pam_single.gfa)
  
              assert_equal(pam.qa.dtype, pam_single.qa.dtype)
              assert_equal(pam.qa.shape, pam_single.qa.shape)
              assert_array_almost_equal(pam.qa, pam_single.qa)
  
              assert_equal(
                  pam.peak_values.dtype, pam_single.peak_values.dtype
              )
              assert_equal(
                  pam.peak_values.shape, pam_single.peak_values.shape
              )
              assert_array_almost_equal(
                  pam.peak_values, pam_single.peak_values
              )
  
              assert_equal(
                  pam.peak_indices.dtype, pam_single.peak_indices.dtype
              )
              assert_equal(
                  pam.peak_indices.shape, pam_single.peak_indices.shape
              )
              assert_array_equal(
                  pam.peak_indices, pam_single.peak_indices
              )
  
              assert_equal(
                  pam.peak_dirs.dtype, pam_single.peak_dirs.dtype
              )
              assert_equal(
                  pam.peak_dirs.shape, pam_single.peak_dirs.shape
              )
              assert_array_almost_equal(
                  pam.peak_dirs, pam_single.peak_dirs
              )
  
              assert_equal(
                  pam.shm_coeff.dtype, pam_single.shm_coeff.dtype
              )
              assert_equal(
                  pam.shm_coeff.shape, pam_single.shm_coeff.shape
              )
              assert_array_almost_equal(
                  pam.shm_coeff, pam_single.shm_coeff
              )
  
              assert_equal(pam.odf.dtype, pam_single.odf.dtype)
              assert_equal(pam.odf.shape, pam_single.odf.shape)
              assert_array_almost_equal(pam.odf, pam_single.odf)
  
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 9 for calling a global function with example usage: test_peaksFromModelParallel() without return types