code: def test_peak_directions():
      model = SimpleOdfModel(_gtab)
      fit = model.fit(None)
      odf = fit.odf()
  
      argmax = odf.argmax()
      mx = odf.max()
      sphere = fit.model.sphere
  
      # Only one peak
      direction, val, ind = peak_directions(odf, sphere, 0.5, 45)
      dir_e = sphere.vertices[[argmax]]
      assert_array_equal(ind, [argmax])
      assert_array_equal(val, odf[ind])
      assert_array_equal(direction, dir_e)
  
      odf[0] = mx * 0.9
      # Two peaks, relative_threshold
      direction, val, ind = peak_directions(odf, sphere, 1.0, 0)
      dir_e = sphere.vertices[[argmax]]
      assert_array_equal(direction, dir_e)
      assert_array_equal(ind, [argmax])
      assert_array_equal(val, odf[ind])
      direction, val, ind = peak_directions(odf, sphere, 0.8, 0)
      dir_e = sphere.vertices[[argmax, 0]]
      assert_array_equal(direction, dir_e)
      assert_array_equal(ind, [argmax, 0])
      assert_array_equal(val, odf[ind])
  
      # Two peaks, angle_sep
      direction, val, ind = peak_directions(odf, sphere, 0.0, 90)
      dir_e = sphere.vertices[[argmax]]
      assert_array_equal(direction, dir_e)
      assert_array_equal(ind, [argmax])
      assert_array_equal(val, odf[ind])
      direction, val, ind = peak_directions(odf, sphere, 0.0, 0)
      dir_e = sphere.vertices[[argmax, 0]]
      assert_array_equal(direction, dir_e)
      assert_array_equal(ind, [argmax, 0])
      assert_array_equal(val, odf[ind])
  
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 3 for calling a global function with example usage: test_peak_directions() without return types