code: def test_anisotropic_isotropic_equivalence(
      radial_order=4, time_order=2
  ):
      # generate qt-scheme and arbitrary synthetic crossing data.
      gtab_4d = generate_gtab4D()
      l1, l2, l3 = [0.0015, 0.0003, 0.0003]
      S = generate_signal_crossing(gtab_4d, l1, l2, l3)
  
      # initialize both cartesian and spherical models without any kind of
      # regularization
      qtdmri_mod_aniso = qtdmri.QtdmriModel(
          gtab_4d,
          radial_order=radial_order,
          time_order=time_order,
          cartesian=True,
          anisotropic_scaling=False,
      )
      qtdmri_mod_iso = qtdmri.QtdmriModel(
          gtab_4d,
          radial_order=radial_order,
          time_order=time_order,
          cartesian=False,
          anisotropic_scaling=False,
      )
  
      # both implementations fit the same signal
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          qtdmri_fit_cart = qtdmri_mod_aniso.fit(S)
          qtdmri_fit_sphere = qtdmri_mod_iso.fit(S)
  
      # same signal fit
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          assert_array_almost_equal(
              qtdmri_fit_cart.fitted_signal(),
              qtdmri_fit_sphere.fitted_signal(),
          )
  
      # same PDF reconstruction
      rt_grid = qtdmri.create_rt_space_grid(5, 20e-3, 5, 0.02, 0.05)
      pdf_aniso = qtdmri_fit_cart.pdf(rt_grid)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          pdf_iso = qtdmri_fit_sphere.pdf(rt_grid)
      assert_array_almost_equal(
          pdf_aniso / pdf_aniso.max(), pdf_iso / pdf_aniso.max()
      )
  
      # same norm of the Laplacian
      norm_laplacian_aniso = qtdmri_fit_cart.norm_of_laplacian_signal()
      norm_laplacian_iso = qtdmri_fit_sphere.norm_of_laplacian_signal()
      assert_almost_equal(
          norm_laplacian_aniso / norm_laplacian_aniso,
          norm_laplacian_iso / norm_laplacian_aniso,
      )
  
      # all q-space index is the same for arbitrary tau
      tau = 0.02
      assert_almost_equal(
          qtdmri_fit_cart.rtop(tau), qtdmri_fit_sphere.rtop(tau)
      )
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          assert_almost_equal(
              qtdmri_fit_cart.rtap(tau), qtdmri_fit_sphere.rtap(tau)
          )
          assert_almost_equal(
              qtdmri_fit_cart.rtpp(tau), qtdmri_fit_sphere.rtpp(tau)
          )
      assert_almost_equal(
          qtdmri_fit_cart.msd(tau), qtdmri_fit_sphere.msd(tau)
      )
      assert_almost_equal(
          qtdmri_fit_cart.qiv(tau), qtdmri_fit_sphere.qiv(tau)
      )
  
      # ODF estimation is the same
      sphere = get_sphere()
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          assert_array_almost_equal(
              qtdmri_fit_cart.odf(sphere, tau, s=0),
              qtdmri_fit_sphere.odf(sphere, tau, s=0),
          )
  
imports: import warnings
  import numpy
  import scipy.integrate
  from numpy.testing import assert_, assert_almost_equal, assert_array_almost_equal, assert_equal, assert_raises
  import pytest
  from dipy.core.gradients import gradient_table_from_qvals_bvecs
  from dipy.data import get_gtab_taiwan_dsi, get_sphere
  from dipy.reconst import qtdmri, mapmri
  from dipy.reconst.shm import descoteaux07_legacy_msg
  from dipy.sims.voxel import multi_tensor, add_noise
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 6 for calling a global function with example usage: test_anisotropic_isotropic_equivalence(radial_order, time_order) without return types