code: def test_fwdti_errors():
      # 1st error - if a unknown fit method is given to the FWTM
      assert_raises(
          ValueError,
          fwdti.FreeWaterTensorModel,
          gtab_2s,
          fit_method="pKT",
      )
      # 2nd error - if incorrect mask is given
      fwdtiM = fwdti.FreeWaterTensorModel(gtab_2s)
      incorrect_mask = np.array(
          [[True, True, False], [True, False, False]]
      )
      assert_raises(ValueError, fwdtiM.fit, DWI, mask=incorrect_mask)
  
      # 3rd error - if data with only one non zero b-value is given
      assert_raises(ValueError, fwdti.FreeWaterTensorModel, gtab)
  
      # Testing the correct usage
      fwdtiM = fwdti.FreeWaterTensorModel(gtab_2s, min_signal=1)
      correct_mask = np.zeros((2, 2, 2))
      correct_mask[0, :, :] = 1
      correct_mask = correct_mask > 0
      fwdtiF = fwdtiM.fit(DWI, mask=correct_mask)
      assert_array_almost_equal(fwdtiF.fa, FAref)
      assert_array_almost_equal(fwdtiF.f, GTF)
  
      # 4th error - if a sigma is selected by no value of sigma is given
      fwdm = fwdti.FreeWaterTensorModel(
          gtab_2s, "NLS", weighting="sigma"
      )
      assert_raises(ValueError, fwdm.fit, DWI)
  
imports: import numpy
  import dipy.reconst.dti
  import dipy.reconst.fwdti
  from dipy.reconst.fwdti import fwdti_prediction
  from numpy.testing import assert_array_almost_equal, assert_almost_equal, assert_raises
  from dipy.reconst.dti import from_lower_triangular, decompose_tensor, fractional_anisotropy
  from dipy.reconst.fwdti import lower_triangular_to_cholesky, cholesky_to_lower_triangular, nls_fit_tensor, wls_fit_tensor
  from dipy.sims.voxel import multi_tensor, single_tensor, all_tensor_evecs, multi_tensor_dki
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.core.gradients import gradient_table
  from dipy.data import get_fnames
label_desc: Use image node_id 6 for calling a global function with example usage: test_fwdti_errors() without return types