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: Core routine for determining stimulus correlation
docstr_tok: ["Core","routine","for","determining","stimulus","correlation"]
code: def _stimcorr_core(
      self, motionfile, intensityfile, designmatrix, cwd=None
  ):
      """
      Core routine for determining stimulus correlation
  
      """
      if not cwd:
          cwd = os.getcwd()
      # read in motion parameters
      mc_in = np.loadtxt(motionfile)
      g_in = np.loadtxt(intensityfile)
      g_in.shape = g_in.shape[0], 1
      dcol = designmatrix.shape[1]
      mccol = mc_in.shape[1]
      concat_matrix = np.hstack(
          (np.hstack((designmatrix, mc_in)), g_in)
      )
      cm = np.corrcoef(concat_matrix, rowvar=0)
      corrfile = self._get_output_filenames(motionfile, cwd)
      # write output to outputfile
      file = open(corrfile, "w")
      file.write("Stats for:\n")
      file.write("Stimulus correlated motion:\n%s\n" % motionfile)
      for i in range(dcol):
          file.write("SCM.%d:" % i)
          for v in cm[i, dcol + np.arange(mccol)]:
              file.write(" %.2f" % v)
          file.write("\n")
      file.write("Stimulus correlated intensity:\n%s\n" % intensityfile)
      for i in range(dcol):
          file.write("SCI.%d: %.2f\n" % (i, cm[i, -1]))
      file.close()
  
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 2 for calling the StimulusCorrelation obj's underlying member method code with example usage: obj._stimcorr_core(motionfile, intensityfile, designmatrix, cwd) without return types