code: def test_forecast_odf():
      # check FORECAST fODF at different SH order
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fm = ForecastModel(
              data.gtab, sh_order=4, dec_alg="CSD", sphere=data.sphere
          )
      f_fit = fm.fit(data.S)
      sphere = default_sphere
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fodf = f_fit.odf(sphere)
      directions, _, _ = peak_directions(fodf, sphere, 0.35, 25)
      assert_equal(len(directions), 2)
      assert_almost_equal(
          angular_similarity(directions, data.sticks), 2, 1
      )
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fm = ForecastModel(
              data.gtab, sh_order=6, dec_alg="CSD", sphere=data.sphere
          )
      f_fit = fm.fit(data.S)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fodf = f_fit.odf(sphere)
      directions, _, _ = peak_directions(fodf, sphere, 0.35, 25)
      assert_equal(len(directions), 2)
      assert_almost_equal(
          angular_similarity(directions, data.sticks), 2, 1
      )
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fm = ForecastModel(
              data.gtab, sh_order=8, dec_alg="CSD", sphere=data.sphere
          )
      f_fit = fm.fit(data.S)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fodf = f_fit.odf(sphere)
      directions, _, _ = peak_directions(fodf, sphere, 0.35, 25)
      assert_equal(len(directions), 2)
      assert_almost_equal(
          angular_similarity(directions, data.sticks), 2, 1
      )
  
      # stronger regularization is required for high order SH
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fm = ForecastModel(
              data.gtab,
              sh_order=10,
              dec_alg="CSD",
              sphere=sphere.vertices,
          )
      f_fit = fm.fit(data.S)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fodf = f_fit.odf(sphere)
      directions, _, _ = peak_directions(fodf, sphere, 0.35, 25)
      assert_equal(len(directions), 2)
      assert_almost_equal(
          angular_similarity(directions, data.sticks), 2, 1
      )
  
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fm = ForecastModel(
              data.gtab,
              sh_order=12,
              dec_alg="CSD",
              sphere=sphere.vertices,
          )
      f_fit = fm.fit(data.S)
      with warnings.catch_warnings():
          warnings.filterwarnings(
              "ignore",
              message=descoteaux07_legacy_msg,
              category=PendingDeprecationWarning,
          )
          fodf = f_fit.odf(sphere)
      directions, _, _ = peak_directions(fodf, sphere, 0.35, 25)
      assert_equal(len(directions), 2)
      assert_almost_equal(
          angular_similarity(directions, data.sticks), 2, 1
      )
  
file_path: dipy/dipy/reconst/tests/test_forecast.py
imports: import warnings
  import numpy
  from dipy.data import get_sphere, default_sphere, get_3shell_gtab
  from dipy.reconst.forecast import ForecastModel
  from dipy.reconst.shm import descoteaux07_legacy_msg
  from dipy.sims.voxel import multi_tensor
  from numpy.testing import assert_almost_equal, assert_equal
  import pytest
  from dipy.direction.peaks import peak_directions
  from dipy.core.sphere_stats import angular_similarity
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 4 for calling a global function with example usage: test_forecast_odf() without return types