class_docstr: Determines if stimuli are correlated with motion or intensity
  parameters.
  
  Currently this class supports an SPM generated design matrix and requires
  intensity parameters. This implies that one must run
  :ref:`ArtifactDetect <nipype.algorithms.rapidart.ArtifactDetect>`
  and :ref:`Level1Design <nipype.interfaces.spm.model.Level1Design>` prior to
  running this or provide an SPM.mat file and intensity parameters through
  some other means.
  
  Examples
  --------
  
  >>> sc = StimulusCorrelation()
  >>> sc.inputs.realignment_parameters = 'functional.par'
  >>> sc.inputs.intensity_values = 'functional.rms'
  >>> sc.inputs.spm_mat_file = 'SPM.mat'
  >>> sc.inputs.concatenated_design = False
  >>> sc.run() # doctest: +SKIP
class_docstr_tok: ["Determines","if","stimuli","are","correlated","with","motion","or","intensity","parameters",".","Currently","this","class","supports","an","SPM","generated","design","matrix","and","requires","intensity","parameters",".","This","implies","that","one","must","run",":","ref",":","`","ArtifactDetect","<","nipype.algorithms.rapidart.ArtifactDetect",">","`","and",":","ref",":","`","Level1Design","<","nipype.interfaces.spm.model.Level1Design",">","`","prior","to","running","this","or","provide","an","SPM.mat","file","and","intensity","parameters","through","some","other","means",".","Examples","--","--","--","--",">",">",">","sc","=","StimulusCorrelation","(",")",">",">",">","sc.inputs.realignment_parameters","=","'functional.par'",">",">",">","sc.inputs.intensity_values","=","'functional.rms'",">",">",">","sc.inputs.spm_mat_file","=","'SPM.mat'",">",">",">","sc.inputs.concatenated_design","=","False",">",">",">","sc.run","(",")","#","doctest",":","+SKIP"]
docstr: Parameters
  ----------
  spmmat: scipy matlab object
      full SPM.mat file loaded into a scipy object
  sessidx: int
      index to session that needs to be extracted.
docstr_tok: ["Parameters","--","--","--","--","--","spmmat",":","scipy","matlab","object","full","SPM.mat","file","loaded","into","a","scipy","object","sessidx",":","int","index","to","session","that","needs","to","be","extracted","."]
code: def _get_spm_submatrix(self, spmmat, sessidx, rows=None):
      """
      Parameters
      ----------
      spmmat: scipy matlab object
          full SPM.mat file loaded into a scipy object
      sessidx: int
          index to session that needs to be extracted.
      """
      designmatrix = spmmat["SPM"][0][0].xX[0][0].X
      U = spmmat["SPM"][0][0].Sess[0][sessidx].U[0]
      if rows is None:
          rows = spmmat["SPM"][0][0].Sess[0][sessidx].row[0] - 1
      cols = (
          spmmat["SPM"][0][0]
          .Sess[0][sessidx]
          .col[0][list(range(len(U)))]
          - 1
      )
      outmatrix = designmatrix.take(rows.tolist(), axis=0).take(
          cols.tolist(), axis=1
      )
      return outmatrix
  
imports: import os
  from copy import deepcopy
  from nibabel import load, funcs, Nifti1Image
  import numpy
  from ..interfaces.base import BaseInterface, traits, InputMultiPath, OutputMultiPath, TraitedSpec, File, BaseInterfaceInputSpec, isdefined
  from ..utils.filemanip import ensure_list, save_json, split_filename
  from ..utils.misc import find_indices, normalize_mc_params
  from ..None import logging, config
label_desc: Use image node_id 3 for calling the StimulusCorrelation obj's underlying member method code with example usage: obj._get_spm_submatrix(spmmat, sessidx, rows) and returns: outmatrix