code: def test_q2bg():
      # Conversion of q vector to b value and unit vector
      for pos in range(3):
          q_vec = np.zeros((3,))
          q_vec[pos] = 10.0
          np_assert_equal(q2bg(q_vec), (10, q_vec / 10.0))
      # Also - check array-like
      q_vec = [0, 1e-6, 0]
      np_assert_equal(q2bg(q_vec), (0, 0))
      q_vec = [0, 1e-4, 0]
      b, g = q2bg(q_vec)
      assert_array_almost_equal(b, 1e-4)
      assert_array_almost_equal(g, [0, 1, 0])
      np_assert_equal(q2bg(q_vec, tol=5e-4), (0, 0))
  
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from numpy.testing import assert_equal
  from ..dwiparams import B2q, q2bg
label_desc: Use image node_id 2 for calling a global function with example usage: test_q2bg() without return types