code: def test_csdeconv():
      SNR = 100
      S0 = 1
  
      _, fbvals, fbvecs = get_fnames("small_64D")
  
      bvals, bvecs = read_bvals_bvecs(fbvals, fbvecs)
      gtab = gradient_table(bvals, bvecs, b0_threshold=0)
      mevals = np.array(
          ([0.0015, 0.0003, 0.0003], [0.0015, 0.0003, 0.0003])
      )
  
      angles = [(0, 0), (60, 0)]
  
      S, sticks = multi_tensor(
          gtab, mevals, S0, angles=angles, fractions=[50, 50], snr=SNR
      )
  
      sphere = get_sphere("symmetric362")
      odf_gt = multi_tensor_odf(
          sphere.vertices, mevals, angles, [50, 50]
      )
      response = (np.array([0.0015, 0.0003, 0.0003]), S0)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          csd = ConstrainedSphericalDeconvModel(gtab, response)
      csd_fit = csd.fit(S)
      assert_equal(csd_fit.shm_coeff[0] > 0, True)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fodf = csd_fit.odf(sphere)
  
      directions, _, _ = peak_directions(odf_gt, sphere)
      directions2, _, _ = peak_directions(fodf, sphere)
  
      ang_sim = angular_similarity(directions, directions2)
  
      assert_equal(ang_sim > 1.9, True)
      assert_equal(directions.shape[0], 2)
      assert_equal(directions2.shape[0], 2)
  
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always", category=UserWarning)
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          _ = ConstrainedSphericalDeconvModel(
              gtab, response, sh_order=10
          )
          assert_greater(
              len(
                  [
                      lw
                      for lw in w
                      if issubclass(lw.category, UserWarning)
                  ]
              ),
              0,
          )
  
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always", category=UserWarning)
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          ConstrainedSphericalDeconvModel(gtab, response, sh_order=8)
          assert_equal(
              len(
                  [
                      lw
                      for lw in w
                      if issubclass(lw.category, UserWarning)
                  ]
              ),
              0,
          )
  
      mevecs = []
      for s in sticks:
          mevecs += [all_tensor_evecs(s).T]
  
      S2 = single_tensor(gtab, 100, mevals[0], mevecs[0], snr=None)
      big_S = np.zeros((10, 10, 10, len(S2)))
      big_S[:] = S2
  
      aresponse, aratio = auto_response_ssst(
          gtab, big_S, roi_center=(5, 5, 4), roi_radii=3, fa_thr=0.5
      )
      assert_array_almost_equal(aresponse[0], response[0])
      assert_almost_equal(aresponse[1], 100)
      assert_almost_equal(aratio, response[0][1] / response[0][0])
  
      auto_response_ssst(gtab, big_S, roi_radii=3, fa_thr=0.5)
      assert_array_almost_equal(aresponse[0], response[0])
  
imports: import warnings
  import numpy
  import numpy.testing
  from numpy.testing import assert_, assert_equal, assert_almost_equal, assert_array_almost_equal, assert_array_equal
  from dipy.testing import assert_greater, assert_greater_equal
  from dipy.data import get_sphere, get_fnames, default_sphere, small_sphere
  from dipy.sims.voxel import multi_tensor, single_tensor, multi_tensor_odf, all_tensor_evecs, single_tensor_odf
  from dipy.core.gradients import gradient_table
  from dipy.core.sphere import Sphere, HemiSphere
  from dipy.core.sphere_stats import angular_similarity
  from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel, ConstrainedSDTModel, forward_sdeconv_mat, odf_deconv, odf_sh_to_sharp, mask_for_response_ssst, response_from_mask_ssst, response_from_mask, auto_response_ssst, auto_response, recursive_response
  from dipy.direction.peaks import peak_directions
  from dipy.reconst.dti import TensorModel, fractional_anisotropy
  from dipy.reconst.shm import descoteaux07_legacy_msg, QballModel, sf_to_sh, sh_to_sf, real_sh_descoteaux, sph_harm_ind_list
  from dipy.reconst.shm import lazy_index
  from dipy.utils.deprecator import ExpiredDeprecationError
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 9 for calling a global function with example usage: test_csdeconv() without return types