code: def test_params_to_btens():
      """
      Checks if `params_to_btens` generates the expected b-tensors from provided
      `bvals`, `bdeltas`, `b_etas`.
  
      """
      # Test parameters that should generate "baseline" b-tensors
      bvals = [1, 1, 1, 1]
      bdeltas = [0, -0.5, 0.5, 1]
      b_etas = [0, 0, 0, 0]
  
      expected_btens = [
          np.eye(3) / 3,
          np.array([[1, 0, 0], [0, 1, 0], [0, 0, 0]]) / 2,
          np.array([[0.5, 0, 0], [0, 0.5, 0], [0, 0, 2]]) / 3,
          np.array([[0, 0, 0], [0, 0, 0], [0, 0, 1]]),
      ]
  
      for i, (bval, bdelta, b_eta) in enumerate(
          zip(bvals, bdeltas, b_etas)
      ):
          btens = params_to_btens(bval, bdelta, b_eta)
          npt.assert_array_almost_equal(btens, expected_btens[i])
  
      # Additional tests
      bvals = [1.7, 0.4, 2.3]
      bdeltas = [0.6, -0.2, 0]
      b_etas = [0.3, 0.8, 0.7]
  
      expected_btens = [
          np.array(
              [
                  [0.12466667, 0, 0],
                  [0, 0.32866667, 0],
                  [0, 0, 1.24666667],
              ]
          ),
          np.array(
              [[0.18133333, 0, 0], [0, 0.13866667, 0], [0, 0, 0.08]]
          ),
          np.array(
              [
                  [0.76666667, 0, 0],
                  [0, 0.76666667, 0],
                  [0, 0, 0.76666667],
              ]
          ),
      ]
  
      for i, (bval, bdelta, b_eta) in enumerate(
          zip(bvals, bdeltas, b_etas)
      ):
          btens = params_to_btens(bval, bdelta, b_eta)
          npt.assert_array_almost_equal(btens, expected_btens[i])
  
      # Tests to trigger value errors
      # 1: wrong input type
      # 2: bval out of valid range
      # 3: bdelta out of valid range
      # 4: b_eta out of valid range
      bvals = [np.array([1]), -1, 1, 1]
      bdeltas = [0, 0, -1, 1]
      b_etas = [0, 0, 0, -1]
  
      for i, (bval, bdelta, b_eta) in enumerate(
          zip(bvals, bdeltas, b_etas)
      ):
          npt.assert_raises(
              ValueError, params_to_btens, bval, bdelta, b_eta
          )
  
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 23 for calling a global function with example usage: test_params_to_btens() without return types