code: def test_check_directions():
      # Testing spherical angles for two principal coordinate axis
      angles = [(0, 0)]  # axis z
      sticks = _check_directions(angles)
      assert_array_almost_equal(sticks, [[0, 0, 1]])
      angles = [
          (0, 90)
      ]  # axis z again (phi can be anything it theta is zero)
      sticks = _check_directions(angles)
      assert_array_almost_equal(sticks, [[0, 0, 1]])
      angles = [(90, 0)]  # axis x
      sticks = _check_directions(angles)
      assert_array_almost_equal(sticks, [[1, 0, 0]])
      # Testing if directions are already given in cartesian coordinates
      angles = [(0, 0, 1)]
      sticks = _check_directions(angles)
      assert_array_almost_equal(sticks, [[0, 0, 1]])
      # Testing more than one direction simultaneously
      angles = np.array([[90, 0], [30, 0]])
      sticks = _check_directions(angles)
      ref_vec = [np.sin(np.pi * 30 / 180), 0, np.cos(np.pi * 30 / 180)]
      assert_array_almost_equal(sticks, [[1, 0, 0], ref_vec])
      # Testing directions not aligned to planes x = 0, y = 0, or z = 0
      the1 = 0
      phi1 = 90
      the2 = 30
      phi2 = 45
      angles = np.array([(the1, phi1), (the2, phi2)])
      sticks = _check_directions(angles)
      ref_vec1 = (
          np.sin(np.pi * the1 / 180) * np.cos(np.pi * phi1 / 180),
          np.sin(np.pi * the1 / 180) * np.sin(np.pi * phi1 / 180),
          np.cos(np.pi * the1 / 180),
      )
      ref_vec2 = (
          np.sin(np.pi * the2 / 180) * np.cos(np.pi * phi2 / 180),
          np.sin(np.pi * the2 / 180) * np.sin(np.pi * phi2 / 180),
          np.cos(np.pi * the2 / 180),
      )
      assert_array_almost_equal(sticks, [ref_vec1, ref_vec2])
  
file_path: dipy/dipy/sims/tests/test_voxel.py
imports: import numpy
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_, assert_almost_equal
  from dipy.sims.voxel import _check_directions, all_tensor_evecs, add_noise, single_tensor, sticks_and_ball, multi_tensor_dki, kurtosis_element, dki_signal, multi_tensor
  from dipy.data import get_fnames
  from dipy.core.gradients import gradient_table
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 2 for calling a global function with example usage: test_check_directions() without return types