class_docstr: Wraps nitime.analysis.CoherenceAnalyzer: Coherence/y
class_docstr_tok: ["Wraps","nitime.analysis.CoherenceAnalyzer",":","Coherence\/y"]
code: def _run_interface(self, runtime):
      import nitime.analysis as nta
  
      lb, ub = self.inputs.frequency_range
  
      if self.inputs.in_TS is Undefined:
          # get TS form csv and inputs.TR
          TS = self._csv2ts()
  
      else:
          # get TS from inputs.in_TS
          TS = self.inputs.in_TS
  
      # deal with creating or storing ROI names:
      if "ROIs" not in TS.metadata:
          self.ROIs = ["roi_%d" % x for x, _ in enumerate(TS.data)]
      else:
          self.ROIs = TS.metadata["ROIs"]
  
      A = nta.CoherenceAnalyzer(
          TS,
          method=dict(
              this_method="welch",
              NFFT=self.inputs.NFFT,
              n_overlap=self.inputs.n_overlap,
          ),
      )
  
      freq_idx = np.where(
          (A.frequencies > self.inputs.frequency_range[0])
          * (A.frequencies < self.inputs.frequency_range[1])
      )[0]
  
      # Get the coherence matrix from the analyzer, averaging on the last
      # (frequency) dimension: (roi X roi array)
      self.coherence = np.mean(A.coherence[:, :, freq_idx], -1)
      # Get the time delay from analyzer, (roi X roi array)
      self.delay = np.mean(A.delay[:, :, freq_idx], -1)
      return runtime
  
file_path: nipype/nipype/interfaces/nitime/analysis.py
imports: import numpy
  import tempfile
  from ...utils.misc import package_check
  from ...utils.filemanip import fname_presuffix
  from .base import NitimeBaseInterface
  from ..base import TraitedSpec, File, Undefined, traits, isdefined, BaseInterfaceInputSpec
label_desc: Use image node_id 3 for calling the CoherenceAnalyzer obj's underlying member method code with example usage: obj._run_interface(runtime) and returns: runtime