code: def test_afq_profile():
      data = np.ones((10, 10, 10))
      bundle = Streamlines()
      bundle.extend(
          np.array([[[0, 0.0, 0], [1, 0.0, 0.0], [2, 0.0, 0.0]]])
      )
      bundle.extend(
          np.array([[[0, 0.0, 0.0], [1, 0.0, 0], [2, 0, 0.0]]])
      )
  
      profile = afq_profile(data, bundle, np.eye(4))
      npt.assert_equal(profile, np.ones(100))
  
      profile = afq_profile(
          data, bundle, np.eye(4), n_points=10, weights=None
      )
      npt.assert_equal(profile, np.ones(10))
  
      profile = afq_profile(
          data,
          bundle,
          np.eye(4),
          weights=gaussian_weights,
          stat=np.median,
      )
  
      npt.assert_equal(profile, np.ones(100))
  
      profile = afq_profile(
          data,
          bundle,
          np.eye(4),
          orient_by=bundle[0],
          weights=gaussian_weights,
          stat=np.median,
      )
  
      npt.assert_equal(profile, np.ones(100))
  
      profile = afq_profile(
          data, bundle, np.eye(4), n_points=10, weights=None
      )
      npt.assert_equal(profile, np.ones(10))
  
      profile = afq_profile(
          data,
          bundle,
          np.eye(4),
          n_points=10,
          weights=np.ones((2, 10)) * 0.5,
      )
      npt.assert_equal(profile, np.ones(10))
  
      profile = afq_profile(
          data, bundle, np.eye(4), n_points=10, stat=np.median
      )
      npt.assert_equal(profile, np.ones(10))
  
      # Disallow setting weights that don't sum to 1 across fibers/nodes:
      npt.assert_raises(
          ValueError,
          afq_profile,
          data,
          bundle,
          np.eye(4),
          n_points=10,
          weights=np.ones((2, 10)) * 0.6,
      )
  
      # Test using an affine:
      affine = np.eye(4)
      affine[:, 3] = [-1, 100, -20, 1]
      # Transform the streamlines:
      bundle._data = bundle._data + affine[:3, 3]
      profile = afq_profile(
          data, bundle, affine, n_points=10, weights=None
      )
  
      npt.assert_equal(profile, np.ones(10))
  
      # Test for error-handling:
      empty_bundle = Streamlines([])
      npt.assert_raises(
          ValueError, afq_profile, data, empty_bundle, np.eye(4)
      )
  
imports: import numpy
  import numpy.testing
  from dipy.stats.analysis import gaussian_weights, afq_profile
  from dipy.tracking.streamline import Streamlines
label_desc: Use image node_id 2 for calling a global function with example usage: test_afq_profile() without return types