code: def test_btable_prepare():
      sq2 = np.sqrt(2) / 2.0
      bvals = 1500 * np.ones(7)
      bvals[0] = 0
      bvecs = np.array(
          [
              [0, 0, 0],
              [1, 0, 0],
              [0, 1, 0],
              [0, 0, 1],
              [sq2, sq2, 0],
              [sq2, 0, sq2],
              [0, sq2, sq2],
          ]
      )
      bt = gradient_table(bvals, bvecs)
      npt.assert_array_equal(bt.bvecs, bvecs)
      # bt.info
      fimg, fbvals, fbvecs = get_fnames("small_64D")
      bvals, bvecs = read_bvals_bvecs(fbvals, fbvecs)
      bvecs = np.where(np.isnan(bvecs), 0, bvecs)
      bt = gradient_table(bvals, bvecs)
      npt.assert_array_equal(bt.bvecs, bvecs)
      bt2 = gradient_table(bvals, bvecs.T)
      npt.assert_array_equal(bt2.bvecs, bvecs)
      btab = np.concatenate((bvals[:, None], bvecs), axis=1)
      bt3 = gradient_table(btab)
      npt.assert_array_equal(bt3.bvecs, bvecs)
      npt.assert_array_equal(bt3.bvals, bvals)
      bt4 = gradient_table(btab.T)
      npt.assert_array_equal(bt4.bvecs, bvecs)
      npt.assert_array_equal(bt4.bvals, bvals)
      # Test for proper inputs (expects either bvals/bvecs or 4 by n):
      npt.assert_raises(ValueError, gradient_table, bvecs)
  
imports: import warnings
  import numpy
  import numpy.testing
  import pytest
  from dipy.data import get_fnames
  from dipy.core.gradients import b0_threshold_empty_gradient_message, b0_threshold_update_slicing_message, gradient_table, GradientTable, gradient_table_from_bvals_bvecs, gradient_table_from_qvals_bvecs, gradient_table_from_gradient_strength_bvecs, WATER_GYROMAGNETIC_RATIO, mask_non_weighted_bvals, orientation_to_string, reorient_bvecs, generate_bvecs, check_multi_b, round_bvals, get_bval_indices, unique_bvals_magnitude, unique_bvals_tolerance, unique_bvals, params_to_btens, btens_to_params, orientation_from_string, reorient_vectors
  from dipy.core.geometry import vec2vec_rotmat, vector_norm
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.utils.deprecator import ExpiredDeprecationError
  from dipy.testing import clear_and_catch_warnings
  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_btable_prepare() without return types