code: def test_disperse_charges():
      charges = np.array([[1.0, 0, 0], [0, 1.0, 0], [0, 0, 1.0]])
      d_sphere, pot = disperse_charges(HemiSphere(xyz=charges), 10)
      nt.assert_array_almost_equal(charges, d_sphere.vertices)
  
      charges = np.array([[3.0 / 5, 4.0 / 5, 0], [4.0 / 5, 3.0 / 5, 0]])
      expected_charges = np.array([[0, 1.0, 0], [1.0, 0, 0]])
      d_sphere, pot = disperse_charges(
          HemiSphere(xyz=charges), 1000, 0.2
      )
      nt.assert_array_almost_equal(expected_charges, d_sphere.vertices)
      for ii in range(1, len(pot)):
          # check that the potential of the system is going down
          nt.assert_(pot[ii] - pot[ii - 1] <= 0)
  
      # Check that the disperse_charges does not blow up with a large constant
      d_sphere, pot = disperse_charges(
          HemiSphere(xyz=charges), 1000, 20.0
      )
      nt.assert_array_almost_equal(expected_charges, d_sphere.vertices)
      for ii in range(1, len(pot)):
          # check that the potential of the system is going down
          nt.assert_(pot[ii] - pot[ii - 1] <= 0)
  
      # check that the function seems to work with a larger number of charges
      charges = np.arange(21).reshape(7, 3)
      norms = np.sqrt((charges * charges).sum(-1))
      charges = charges / norms[:, None]
      d_sphere, pot = disperse_charges(
          HemiSphere(xyz=charges), 1000, 0.05
      )
      for ii in range(1, len(pot)):
          # check that the potential of the system is going down
          nt.assert_(pot[ii] - pot[ii - 1] <= 0)
      # check that the resulting charges all lie on the unit sphere
      d_charges = d_sphere.vertices
      norms = np.sqrt((d_charges * d_charges).sum(-1))
      nt.assert_array_almost_equal(norms, 1)
  
imports: import numpy
  import numpy.testing
  import pytest
  import warnings
  from dipy.core.sphere import Sphere, HemiSphere, unique_edges, unique_sets, faces_from_sphere_vertices, disperse_charges, fibonacci_sphere, disperse_charges_alt, _get_forces, _get_forces_alt, unit_octahedron, unit_icosahedron, hemi_icosahedron
  from dipy.core.geometry import cart2sphere, vector_norm
  from dipy.core.sphere_stats import random_uniform_on_sphere
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 20 for calling a global function with example usage: test_disperse_charges() without return types