code: def test_sphere_distance():
      # make a circle, go around...
      radius = 3.2
      n = 5000
      n2 = n // 2
      # pi at point n2 in array
      angles = np.linspace(0, np.pi * 2, n, endpoint=False)
      x = np.sin(angles) * radius
      y = np.cos(angles) * radius
      # dists around half circle, including pi
      half_x = x[: n2 + 1]
      half_y = y[: n2 + 1]
      half_dists = np.sqrt(np.diff(half_x) ** 2 + np.diff(half_y) ** 2)
      # approximate distances from 0 to pi (not including 0)
      csums = np.cumsum(half_dists)
      # concatenated with distances from pi to 0 again
      cdists = np.r_[0, csums, csums[-2::-1]]
      # check approximation close to calculated
      sph_d = sphere_distance([0, radius], np.c_[x, y])
      assert_array_almost_equal(cdists, sph_d)
      # Now check with passed radius
      sph_d = sphere_distance([0, radius], np.c_[x, y], radius=radius)
      assert_array_almost_equal(cdists, sph_d)
      # Check points not on surface raises error when asked for
      assert_raises(ValueError, sphere_distance, [1, 0], [0, 2])
      # Not when check is disabled
      sphere_distance([1, 0], [0, 2], None, False)
      # Error when radii don't match passed radius
      assert_raises(ValueError, sphere_distance, [1, 0], [0, 1], 2.0)
  
imports: import numpy
  import random
  from dipy.core.geometry import sphere2cart, cart2sphere, nearest_pos_semi_def, sphere_distance, cart_distance, vector_cosine, lambert_equal_area_projection_polar, circumradius, vec2vec_rotmat, vector_norm, compose_transformations, compose_matrix, decompose_matrix, perpendicular_directions, dist_to_corner, is_hemispherical
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_equal, assert_raises, assert_almost_equal
  from dipy.testing.spherepoints import sphere_points
  from dipy.testing.decorators import set_random_number_generator
  from dipy.core.sphere_stats import random_uniform_on_sphere
  from itertools import permutations
label_desc: Use image node_id 6 for calling a global function with example usage: test_sphere_distance() without return types