code: def test_GradientTable():
      gradients = np.array(
          [[0, 0, 0], [1, 0, 0], [0, 0, 1], [3, 4, 0], [5, 0, 12]],
          "float",
      )
  
      expected_bvals = np.array([0, 1, 1, 5, 13])
      expected_b0s_mask = expected_bvals == 0
      expected_bvecs = (
          gradients / (expected_bvals + expected_b0s_mask)[:, None]
      )
  
      gt = GradientTable(gradients, b0_threshold=0)
      npt.assert_("B-values shape (5,)" in gt.__str__())
      npt.assert_array_almost_equal(gt.bvals, expected_bvals)
      npt.assert_array_equal(gt.b0s_mask, expected_b0s_mask)
      npt.assert_array_almost_equal(gt.bvecs, expected_bvecs)
      npt.assert_array_almost_equal(gt.gradients, gradients)
  
      gt = GradientTable(gradients, b0_threshold=1)
      npt.assert_array_equal(gt.b0s_mask, [1, 1, 1, 0, 0])
      npt.assert_array_equal(gt.bvals, expected_bvals)
      npt.assert_array_equal(gt.bvecs, expected_bvecs)
  
      # checks negative values in gtab
      npt.assert_raises(ValueError, GradientTable, -1)
      npt.assert_raises(ValueError, GradientTable, np.ones((6, 2)))
      npt.assert_raises(ValueError, GradientTable, np.ones((6,)))
  
      with warnings.catch_warnings(record=True) as l_warns:
          bad_gt = gradient_table(
              expected_bvals, expected_bvecs, b0_threshold=200
          )
  
          # Select only UserWarning
          selected_w = [
              w for w in l_warns if issubclass(w.category, UserWarning)
          ]
          assert len(selected_w) >= 1
          msg = [str(m.message) for m in selected_w]
          npt.assert_equal(
              "b0_threshold has a value > 199" in msg, True
          )
  
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 4 for calling a global function with example usage: test_GradientTable() without return types