code: def test_rumba():
      # Test fODF results from ideal examples.
      sphere = default_sphere  # repulsion 724
      sphere2 = get_sphere("symmetric362")
  
      btable = np.loadtxt(get_fnames("dsi515btable"))
      bvals = btable[:, 0]
      bvecs = btable[:, 1:]
      gtab = gradient_table(bvals, bvecs)
      data, golden_directions = sticks_and_ball(
          gtab,
          d=0.0015,
          S0=100,
          angles=[(0, 0), (90, 0)],
          fractions=[50, 50],
          snr=None,
      )
  
      # Testing input validation
      msg = "b0_threshold .*"
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore", message=msg, category=UserWarning
          )
          gtab_broken = gradient_table(
              bvals[~gtab.b0s_mask], bvecs[~gtab.b0s_mask]
          )
  
      assert_raises(ValueError, RumbaSDModel, gtab_broken)
  
      with warnings.catch_warnings(record=True) as w:
          _ = RumbaSDModel(gtab, verbose=True)
          assert_equal(len(w), 1)
          assert_(w[0].category, UserWarning)
  
      assert_raises(ValueError, RumbaSDModel, gtab, use_tv=True)
      assert_raises(ValueError, RumbaSDModel, gtab, n_iter=0)
      rumba_broken = RumbaSDModel(gtab, recon_type="test")
      assert_raises(ValueError, rumba_broken.fit, data)
  
      # Models to validate
      rumba_smf = RumbaSDModel(
          gtab, n_iter=20, recon_type="smf", n_coils=1, sphere=sphere
      )
      rumba_sos = RumbaSDModel(
          gtab, n_iter=20, recon_type="sos", n_coils=32, sphere=sphere
      )
      model_list = [rumba_smf, rumba_sos]
  
      # Test on repulsion724 sphere
      for model in model_list:
          model_fit = model.fit(data)
  
          # Verify only works on original sphere
          assert_raises(ValueError, model_fit.odf, sphere2)
          odf = model_fit.odf(sphere)
  
          directions, _, _ = peak_directions(odf, sphere, 0.35, 25)
          assert_equal(len(directions), 2)
          assert_almost_equal(
              angular_similarity(directions, golden_directions), 2, 1
          )
  
      # Test on data with 1, 2, 3, or no peaks
      sb_dummies = sticks_and_ball_dummies(gtab)
      for model in model_list:
          for sbd in sb_dummies:
              data, golden_directions = sb_dummies[sbd]
              model_fit = model.fit(data)
              odf = model_fit.odf(sphere)
              directions, _, _ = peak_directions(odf, sphere, 0.35, 25)
              if len(directions) <= 3:
                  # Verify small isotropic fraction in anisotropic case
                  assert_equal(model_fit.f_iso < 0.1, True)
                  assert_equal(len(directions), len(golden_directions))
              if len(directions) > 3:
                  # Verify large isotropic fraction in isotropic case
                  assert_equal(model_fit.f_iso > 0.8, True)
  
imports: import warnings
  import numpy
  from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal, assert_allclose, assert_raises
  from numpy.testing import assert_
  from dipy.reconst.rumba import RumbaSDModel, generate_kernel
  from dipy.reconst.csdeconv import AxSymShResponse
  from dipy.data import get_fnames, dsi_voxels, default_sphere, get_sphere
  from dipy.core.gradients import gradient_table, unique_bvals_tolerance
  from dipy.core.geometry import cart2sphere
  from dipy.core.sphere_stats import angular_similarity
  from dipy.reconst.tests.test_dsi import sticks_and_ball_dummies
  from dipy.sims.voxel import sticks_and_ball, multi_tensor, single_tensor
  from dipy.direction.peaks import peak_directions
  from dipy.reconst.shm import descoteaux07_legacy_msg
label_desc: Use image node_id 1 for calling a global function with example usage: test_rumba() without return types