code: def test_qti_signal():
      """Test QTI signal generation."""
  
      # Input validation
      bvals = np.ones(6)
      phi = (1 + np.sqrt(5)) / 2
      bvecs = np.array(
          [
              [0, 1, phi],
              [0, 1, -phi],
              [1, phi, 0],
              [1, -phi, 0],
              [phi, 0, 1],
              [phi, 0, -1],
          ]
      ) / np.linalg.norm([0, 1, phi])
      gtab = gradient_table(bvals, bvecs)
      npt.assert_raises(
          ValueError, qti.qti_signal, gtab, np.eye(3), np.eye(6)
      )
      gtab = gradient_table(bvals, bvecs, btens="LTE")
      npt.assert_raises(
          ValueError, qti.qti_signal, gtab, np.eye(2), np.eye(6)
      )
      npt.assert_raises(
          ValueError, qti.qti_signal, gtab, np.eye(3), np.eye(5)
      )
      npt.assert_raises(
          ValueError,
          qti.qti_signal,
          gtab,
          np.stack((np.eye(3), np.eye(3))),
          np.eye(5),
      )
      npt.assert_raises(
          ValueError,
          qti.qti_signal,
          gtab,
          np.eye(3)[np.newaxis, :],
          np.eye(6),
      )
      npt.assert_raises(
          ValueError,
          qti.qti_signal,
          gtab,
          np.eye(3),
          np.eye(6),
          np.ones(2),
      )
      qti.qti_signal(
          gradient_table(bvals, bvecs, btens="LTE"),
          np.zeros((5, 6)),
          np.zeros((5, 21)),
      )
  
      # Isotropic diffusion and no 2nd order effects
      D = np.eye(3)
      C = np.zeros((6, 6))
      npt.assert_almost_equal(
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="LTE"), D, C
          ),
          np.ones(6) * np.exp(-1),
      )
      npt.assert_almost_equal(
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="LTE"), D, C
          ),
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="PTE"), D, C
          ),
      )
      npt.assert_almost_equal(
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="LTE"), D, C
          ),
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="STE"), D, C
          ),
      )
  
      # Anisotropic sticks aligned with the bvecs
      DTD = _anisotropic_DTD()
      D = np.mean(DTD, axis=0)
      C = qti.dtd_covariance(DTD)
      npt.assert_almost_equal(
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="LTE"), D, C
          ),
          np.ones(6) * 0.7490954,
      )
      npt.assert_almost_equal(
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="PTE"), D, C
          ),
          np.ones(6) * 0.72453716,
      )
      npt.assert_almost_equal(
          qti.qti_signal(
              gradient_table(bvals, bvecs, btens="STE"), D, C
          ),
          np.ones(6) * 0.71653131,
      )
  
imports: import numpy
  import numpy.testing
  import dipy.reconst.qti
  from dipy.core.gradients import gradient_table
  from dipy.sims.voxel import vec2vec_rotmat
  from dipy.core.sphere import disperse_charges, HemiSphere
  from dipy.reconst.dti import fractional_anisotropy
  from dipy.testing.decorators import set_random_number_generator
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 11 for calling a global function with example usage: test_qti_signal() without return types