code: def test_multib0_dsi():
      data, gtab = dsi_voxels()
      # Create a new data-set with a b0 measurement:
      new_data = np.concatenate([data, data[..., 0, None]], -1)
      new_bvecs = np.concatenate([gtab.bvecs, np.zeros((1, 3))])
      new_bvals = np.concatenate([gtab.bvals, [0]])
      new_gtab = gradient_table(new_bvals, new_bvecs)
      ds = DiffusionSpectrumModel(new_gtab)
      dsfit = ds.fit(new_data)
      pdf = dsfit.pdf()
      dsfit.odf(default_sphere)
      assert_equal(new_data.shape[:-1] + (17, 17, 17), pdf.shape)
      assert_equal(np.all(np.isreal(pdf)), True)
  
      # And again, with one more b0 measurement (two in total):
      new_data = np.concatenate([data, data[..., 0, None]], -1)
      new_bvecs = np.concatenate([gtab.bvecs, np.zeros((1, 3))])
      new_bvals = np.concatenate([gtab.bvals, [0]])
      new_gtab = gradient_table(new_bvals, new_bvecs)
      ds = DiffusionSpectrumModel(new_gtab)
      dsfit = ds.fit(new_data)
      pdf = dsfit.pdf()
      dsfit.odf(default_sphere)
      assert_equal(new_data.shape[:-1] + (17, 17, 17), pdf.shape)
      assert_equal(np.all(np.isreal(pdf)), True)
  
file_path: dipy/dipy/reconst/tests/test_dsi.py
imports: import numpy
  from numpy.testing import assert_equal, assert_almost_equal, assert_raises
  from dipy.data import get_fnames, dsi_voxels, default_sphere
  from dipy.reconst.dsi import DiffusionSpectrumModel
  from dipy.reconst.odf import gfa
  from dipy.direction.peaks import peak_directions
  from dipy.sims.voxel import sticks_and_ball
  from dipy.core.gradients import gradient_table
  from dipy.core.subdivide_octahedron import create_unit_sphere
  from dipy.core.sphere_stats import angular_similarity
label_desc: Use image node_id 3 for calling a global function with example usage: test_multib0_dsi() without return types