code: def test_run(in_tmp_path, imp_img, kwargs):
      ar1_fname = "ar1_out.nii"
      f, _, cmatrices = example_formula()
  
      # Run OLS model
      outputs = []
      outputs.append(model.output_AR1(ar1_fname, imp_img))
      outputs.append(model.output_resid("resid_OLS_out.nii", imp_img))
      ols = model.OLS(imp_img, f, outputs, **kwargs)
      ols.execute()
      # Run AR1 model
      outputs = []
      outputs.append(
          model.output_T("T_out.nii", cmatrices["c"], imp_img)
      )
      outputs.append(
          model.output_F("F_out.nii", cmatrices["c2"], imp_img)
      )
      outputs.append(model.output_resid("resid_AR_out.nii", imp_img))
      rho = load_image(ar1_fname)
      ar = model.AR1(imp_img, f, rho, outputs, **kwargs)
      ar.execute()
      f_img = load_image("F_out.nii")
      assert f_img.shape == FUNC_IMG.shape[:-1]
      f_data = f_img.get_fdata()
      assert np.all((f_data >= 0) & (f_data < 30))
      resid_img = load_image("resid_AR_out.nii")
      assert resid_img.shape == FUNC_IMG.shape
      assert_array_almost_equal(np.mean(resid_img.get_fdata()), 0, 3)
      e_img = load_image("T_out_effect.nii")
      sd_img = load_image("T_out_sd.nii")
      t_img = load_image("T_out_t.nii")
      t_data = t_img.get_fdata()
      assert_array_almost_equal(
          t_data, e_img.get_fdata() / sd_img.get_fdata()
      )
      assert np.all(np.abs(t_data) < 6)
      # Need to delete to help windows delete temporary files
      del rho, resid_img, f_img, e_img, sd_img, t_img, f_data, t_data
  
file_path: nipy/nipy/modalities/fmri/fmristat/tests/test_model.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from nipy.algorithms.statistics.formula.formulae import Formula, Term, make_recarray
  from nipy.algorithms.statistics.models.regression import OLSModel, ar_bias_correct
  from nipy.core.image.image import rollimg
  from nipy.io.api import load_image
  from nipy.testing import anatfile, funcfile
  from ...api import FmriImageList
  from ..None import model
  from ..model import ModelOutputImage, estimateAR
label_desc: Use image node_id 4 for calling a global function with example usage: test_run(in_tmp_path, imp_img, kwargs) without return types