code: def test_get_bval_indices():
      bvals = np.array(
          [1000, 1000, 1000, 1000, 2000, 2000, 2000, 2000, 0]
      )
      indices_gt = np.array([0, 1, 2, 3])
      indices = get_bval_indices(bvals, 1000)
      npt.assert_array_almost_equal(indices_gt, indices)
  
      # Testing the tolerance factor on many b-values that are within tol.
      bvals = np.array(
          [950, 980, 995, 1000, 1000, 1010, 1999, 2000, 2001, 0]
      )
      indices_gt = np.array([0])
      indices = get_bval_indices(bvals, 950, 20)
      npt.assert_array_almost_equal(indices_gt, indices)
      indices_gt = np.array([1, 2, 3, 4, 5])
      indices = get_bval_indices(bvals, 1000, 20)
      npt.assert_array_almost_equal(indices_gt, indices)
      indices_gt = np.array([6, 7, 8])
      indices = get_bval_indices(bvals, 2001, 20)
      npt.assert_array_almost_equal(indices_gt, indices)
  
      # All unique b-values indices are returned if tolerance is set to zero:
      bvals = np.array(
          [990, 990, 1000, 1000, 2000, 2000, 2050, 2050, 0]
      )
      indices_gt = np.array([2, 3])
      indices = get_bval_indices(bvals, 1000, 0)
      npt.assert_array_almost_equal(indices_gt, indices)
  
      # Case that b-values are in ms/um2
      bvals = np.array(
          [0.995, 0.995, 0.995, 0.995, 2.005, 2.005, 2.005, 2.005, 0]
      )
      indices_gt = np.array([0, 1, 2, 3])
      indices = get_bval_indices(bvals, 0.995, 0.5)
      npt.assert_array_almost_equal(indices_gt, indices)
  
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 19 for calling a global function with example usage: test_get_bval_indices() without return types