code: def test_orthogonality_basis_functions():
      # numerical integration parameters
      diffusivity = 0.0015
      qmin = 0
      qmax = 1000
  
      int1 = integrate.quad(
          lambda x: np.real(mapmri.mapmri_phi_1d(0, x, diffusivity))
          * np.real(mapmri.mapmri_phi_1d(2, x, diffusivity)),
          qmin,
          qmax,
      )[0]
      int2 = integrate.quad(
          lambda x: np.real(mapmri.mapmri_phi_1d(2, x, diffusivity))
          * np.real(mapmri.mapmri_phi_1d(4, x, diffusivity)),
          qmin,
          qmax,
      )[0]
      int3 = integrate.quad(
          lambda x: np.real(mapmri.mapmri_phi_1d(4, x, diffusivity))
          * np.real(mapmri.mapmri_phi_1d(6, x, diffusivity)),
          qmin,
          qmax,
      )[0]
      int4 = integrate.quad(
          lambda x: np.real(mapmri.mapmri_phi_1d(6, x, diffusivity))
          * np.real(mapmri.mapmri_phi_1d(8, x, diffusivity)),
          qmin,
          qmax,
      )[0]
  
      # checking for first 5 basis functions if they are indeed orthogonal
      assert_almost_equal(int1, 0.0)
      assert_almost_equal(int2, 0.0)
      assert_almost_equal(int3, 0.0)
      assert_almost_equal(int4, 0.0)
  
      # do the same for the isotropic mapmri basis functions
      # we already know the spherical harmonics are orthonormal
      # only check j>0, l=0 basis functions
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore", category=integrate.IntegrationWarning
          )
          int1 = integrate.quad(
              lambda q: mapmri.mapmri_isotropic_radial_signal_basis(
                  1, 0, diffusivity, q
              )
              * mapmri.mapmri_isotropic_radial_signal_basis(
                  2, 0, diffusivity, q
              )
              * q**2,
              qmin,
              qmax,
          )[0]
          int2 = integrate.quad(
              lambda q: mapmri.mapmri_isotropic_radial_signal_basis(
                  2, 0, diffusivity, q
              )
              * mapmri.mapmri_isotropic_radial_signal_basis(
                  3, 0, diffusivity, q
              )
              * q**2,
              qmin,
              qmax,
          )[0]
          int3 = integrate.quad(
              lambda q: mapmri.mapmri_isotropic_radial_signal_basis(
                  3, 0, diffusivity, q
              )
              * mapmri.mapmri_isotropic_radial_signal_basis(
                  4, 0, diffusivity, q
              )
              * q**2,
              qmin,
              qmax,
          )[0]
          int4 = integrate.quad(
              lambda q: mapmri.mapmri_isotropic_radial_signal_basis(
                  4, 0, diffusivity, q
              )
              * mapmri.mapmri_isotropic_radial_signal_basis(
                  5, 0, diffusivity, q
              )
              * q**2,
              qmin,
              qmax,
          )[0]
  
      # checking for first 5 basis functions if they are indeed orthogonal
      assert_almost_equal(int1, 0.0)
      assert_almost_equal(int2, 0.0)
      assert_almost_equal(int3, 0.0)
      assert_almost_equal(int4, 0.0)
  
imports: import platform
  import time
  from math import factorial
  from scipy.special import gamma
  import scipy.integrate
  import warnings
  import numpy
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_equal, assert_, assert_raises
  import pytest
  from dipy.core.sphere_stats import angular_similarity
  from dipy.core.subdivide_octahedron import create_unit_sphere
  from dipy.data import get_gtab_taiwan_dsi, default_sphere
  from dipy.direction.peaks import peak_directions
  from dipy.reconst.mapmri import MapmriModel, mapmri_index_matrix
  from dipy.reconst import dti, mapmri
  from dipy.reconst.odf import gfa
  from dipy.reconst.tests.test_dsi import sticks_and_ball_dummies
  from dipy.reconst.shm import sh_to_sf, descoteaux07_legacy_msg
  from dipy.sims.voxel import multi_tensor, multi_tensor_pdf, add_noise, single_tensor, cylinders_and_ball_soderman
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 3 for calling a global function with example usage: test_orthogonality_basis_functions() without return types