code: def test_dct_ii_basis():
      # Test DCT-II basis
      for N in (5, 10, 100):
          spm_fname = pjoin(HERE, f"dct_{N}.txt")
          spm_mtx = np.loadtxt(spm_fname)
          vol_times = np.arange(N) * 15.0 + 3.2
          our_dct = dct_ii_basis(vol_times)
          # Check dot products of columns
          sq_col_lengths = np.ones(N) * N / 2.0
          sq_col_lengths[0] = N
          assert_almost_equal(
              our_dct.T.dot(our_dct), np.diag(sq_col_lengths)
          )
          col_lengths = np.sqrt(sq_col_lengths)
          assert_almost_equal(our_dct / col_lengths, spm_mtx)
          # Normalize length
          our_normed_dct = dct_ii_basis(vol_times, normcols=True)
          assert_almost_equal(our_normed_dct, spm_mtx)
          assert_almost_equal(
              our_normed_dct.T.dot(our_normed_dct), np.eye(N)
          )
          for i in range(N):
              assert_almost_equal(
                  dct_ii_basis(vol_times, i) / col_lengths[:i],
                  spm_mtx[:, :i],
              )
              assert_almost_equal(
                  dct_ii_basis(vol_times, i, True), spm_mtx[:, :i]
              )
      vol_times[0] += 0.1
      pytest.raises(ValueError, dct_ii_basis, vol_times)
  
file_path: nipy/nipy/modalities/fmri/tests/test_realfuncs.py
imports: from itertools import product
  from os.path import dirname
  from os.path import join
  import numpy
  import pytest
  from numpy.testing import assert_almost_equal, assert_array_equal
  from ..realfuncs import dct_ii_basis, dct_ii_cut_basis
label_desc: Use image node_id 1 for calling a global function with example usage: test_dct_ii_basis() without return types