code: def test_sanity():
      import nipy.modalities.fmri.fmristat.hrf as fshrf
      from nipy.algorithms.statistics import formula
      from nipy.modalities.fmri import design, hrf
      from nipy.modalities.fmri.fmristat.tests import FIACdesigns
      from nipy.modalities.fmri.fmristat.tests.test_FIAC import matchcol
  
      """
      Single subject fitting of FIAC model
      """
  
      # Based on file
      # subj3_evt_fonc1.txt
      # subj3_bloc_fonc3.txt
  
      for subj, run, design_type in [(3, 1, "event"), (3, 3, "block")]:
          nvol = 191
          TR = 2.5
          Tstart = 1.25
  
          volume_times = np.arange(nvol) * TR + Tstart
          volume_times_rec = formula.make_recarray(volume_times, "t")
  
          path_dict = {"subj": subj, "run": run}
          if exists(
              pjoin(
                  DATADIR,
                  "fiac_%(subj)02d",
                  "block",
                  "initial_%(run)02d.csv",
              )
              % path_dict
          ):
              path_dict["design"] = "block"
          else:
              path_dict["design"] = "event"
  
          experiment = csv2rec(
              pjoin(
                  DATADIR,
                  "fiac_%(subj)02d",
                  "%(design)s",
                  "experiment_%(run)02d.csv",
              )
              % path_dict
          )
          initial = csv2rec(
              pjoin(
                  DATADIR,
                  "fiac_%(subj)02d",
                  "%(design)s",
                  "initial_%(run)02d.csv",
              )
              % path_dict
          )
  
          X_exper, cons_exper = design.event_design(
              experiment, volume_times_rec, hrfs=fshrf.spectral
          )
          X_initial, _ = design.event_design(
              initial, volume_times_rec, hrfs=[hrf.glover]
          )
          X, cons = design.stack_designs(
              (X_exper, cons_exper), (X_initial, {})
          )
  
          # Get original fmristat design
          Xf = FIACdesigns.fmristat[design_type]
          # Check our new design can be closely matched to the original
          for i in range(X.shape[1]):
              # Columns can be very well correlated negatively or positively
              assert abs(matchcol(X[:, i], Xf)[1]) > 0.999
  
imports: import csv
  import os
  from io import StringIO
  from os import listdir, makedirs
  from os.path import abspath, exists, isdir, splitext
  from os.path import join
  import numpy
  import pandas
  from nipy.io.api import load_image
label_desc: Use image node_id 12 for calling a global function with example usage: test_sanity() without return types