code: def test_spm_hrf():
      # Regression tests for spm hrf, time derivative and dispersion derivative
      # Check that absolute values don't change (much) with different dt, and that
      # max values are roughly the same and in the same place in time
      for dt in 0.1, 0.01, 0.001:
          t_vec = np.arange(0, 32, dt)
          hrf = spmt(t_vec)
          assert_almost_equal(np.max(hrf), 0.21053, 5)
          assert_almost_equal(t_vec[np.argmax(hrf)], 5, 2)
          dhrf = dspmt(t_vec)
          assert_almost_equal(np.max(dhrf), 0.08, 3)
          assert_almost_equal(t_vec[np.argmax(dhrf)], 3.3, 1)
          dhrf = ddspmt(t_vec)
          assert_almost_equal(np.max(dhrf), 0.10, 2)
          assert_almost_equal(t_vec[np.argmax(dhrf)], 5.7, 1)
      # Test reversed time vector to check that order of time values does not
      # affect result
      rt_vec = np.arange(0, 32, 0.01)
      rhrf = spmt(rt_vec)
      assert_almost_equal(np.max(rhrf), 0.21053, 5)
      assert_almost_equal(t_vec[np.argmax(hrf)], 5, 2)
  
file_path: nipy/nipy/modalities/fmri/tests/test_hrf.py
imports: from os.path import dirname
  from os.path import join
  import numpy
  import pytest
  import scipy.io
  from numpy.testing import assert_almost_equal
  from scipy.stats import gamma
  from ..hrf import ddspmt, dspmt, gamma_expr, gamma_params, lambdify_t, spm_hrf_compat, spmt
label_desc: Use image node_id 2 for calling a global function with example usage: test_spm_hrf() without return types