code: def test_fastsrm_class():
      n_jobs = 1
      with tempfile.TemporaryDirectory() as datadir:
          np.random.seed(0)
  
          # We authorize different timeframes for different sessions
          # but they should be the same across subject
          n_voxels = 10
          n_timeframes = [25, 24]
          n_subjects = 5
          n_components = 3  # number of components used for SRM model
  
          np.random.seed(0)
          paths, W, S = generate_data(
              n_voxels,
              n_timeframes,
              n_subjects,
              n_components,
              datadir,
              0,
          )
  
          atlas = np.arange(1, n_voxels + 1)
          srm = FastSRM(
              atlas=atlas,
              n_components=n_components,
              n_iter=10,
              temp_dir=datadir,
              low_ram=True,
              verbose=True,
              n_jobs=n_jobs,
          )
  
          # Raises an error because model is not fitted yet
          with pytest.raises(NotFittedError):
              srm.transform(paths)
  
          srm.fit(paths)
          # An error can occur if temporary directory already exists
          with pytest.raises(
              ValueError,
              match=(
                  "Path %s already exists. When a model "
                  "is used, filesystem should be "
                  r"cleaned by using the .clean\(\) "
                  "method" % srm.temp_dir
              ),
          ):
              # Error can occur if the filesystem is uncleaned
              create_temp_dir(srm.temp_dir)
              create_temp_dir(srm.temp_dir)
  
          shared_response = srm.transform(paths)
  
          # Raise error when wrong index
          with pytest.raises(
              ValueError,
              match=(
                  "subjects_indexes should be either "
                  "a list, an array or None but "
                  "received type <class 'int'>"
              ),
          ):
              srm.transform(paths, subjects_indexes=1000)
  
          with pytest.raises(
              ValueError,
              match=(
                  "subjects_indexes should be either "
                  "a list, an array or None but "
                  "received type <class 'int'>"
              ),
          ):
              srm.inverse_transform(
                  shared_response, subjects_indexes=1000
              )
  
          with pytest.raises(
              ValueError,
              match=(
                  "sessions_indexes should be either "
                  "a list, an array or None but "
                  "received type <class 'int'>"
              ),
          ):
              srm.inverse_transform(
                  shared_response, sessions_indexes=1000
              )
  
          with pytest.raises(
              ValueError,
              match=(
                  "Input data imgs has len 5 whereas "
                  "subject_indexes has len 1. "
                  "The number of basis used to compute "
                  "the shared response should be equal to "
                  "the number of subjects in imgs"
              ),
          ):
              srm.transform(paths, subjects_indexes=[0])
  
          with pytest.raises(
              ValueError,
              match=(
                  "Index 1 of subjects_indexes has value 8 "
                  "whereas value should be between 0 and 4"
              ),
          ):
              srm.transform(paths[:2], subjects_indexes=[0, 8])
  
          with pytest.raises(
              ValueError,
              match=(
                  "Index 1 of sessions_indexes has value 8 "
                  "whereas value should be between 0 and 1"
              ),
          ):
              srm.inverse_transform(
                  shared_response, sessions_indexes=[0, 8]
              )
  
          # Check behavior of .clean
          assert os.path.exists(srm.temp_dir)
          srm.clean()
          assert not os.path.exists(srm.temp_dir)
  
imports: import os
  import tempfile
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from sklearn.exceptions import NotFittedError
  from brainiak.funcalign.fastsrm import FastSRM, _compute_and_save_corr_mat, _compute_and_save_subject_basis, _compute_basis_subject_online, _reduced_space_compute_shared_response, check_atlas, check_imgs, check_shared_response, create_temp_dir, fast_srm, reduce_data, safe_load
  from brainiak.funcalign.srm import DetSRM
label_desc: Use image node_id 12 for calling a global function with example usage: test_fastsrm_class() without return types