code: def test_mapmri_pdf_integral_unity(radial_order=6):
      gtab = get_gtab_taiwan_dsi()
      l1, l2, l3 = [0.0015, 0.0003, 0.0003]
      S, _ = generate_signal_crossing(gtab, l1, l2, l3)
      sphere = default_sphere
      # test MAPMRI fitting
  
      mapm = MapmriModel(
          gtab, radial_order=radial_order, laplacian_weighting=0.02
      )
      mapfit = mapm.fit(S)
      c_map = mapfit.mapmri_coeff
  
      # test if the analytical integral of the pdf is equal to one
      indices = mapmri_index_matrix(radial_order)
      integral = 0
      for i in range(indices.shape[0]):
          n1, n2, n3 = indices[i]
          integral += (
              c_map[i] * int_func(n1) * int_func(n2) * int_func(n3)
          )
  
      assert_almost_equal(integral, 1.0, 3)
  
      # test if numerical integral of odf is equal to one
      odf = mapfit.odf(sphere, s=0)
      odf_sum = odf.sum() / sphere.vertices.shape[0] * (4 * np.pi)
      assert_almost_equal(odf_sum, 1.0, 2)
  
      # do the same for isotropic implementation
      radius_max = 0.04  # 40 microns
      gridsize = 17
      r_points = mapmri.create_rspace(gridsize, radius_max)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          mapm = MapmriModel(
              gtab,
              radial_order=radial_order,
              laplacian_weighting=0.02,
              anisotropic_scaling=False,
          )
      mapfit = mapm.fit(S)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          pdf = mapfit.pdf(r_points)
      pdf[
          r_points[:, 2] == 0.0
      ] /= 2  # for antipodal symmetry on z-plane
  
      point_volume = (radius_max / (gridsize // 2)) ** 3
      integral = pdf.sum() * point_volume * 2
      assert_almost_equal(integral, 1.0, 3)
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          odf = mapfit.odf(sphere, s=0)
      odf_sum = odf.sum() / sphere.vertices.shape[0] * (4 * np.pi)
      assert_almost_equal(odf_sum, 1.0, 2)
  
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 11 for calling a global function with example usage: test_mapmri_pdf_integral_unity(radial_order) without return types