code: def correlated_timeseries(
      n_subjects, n_TRs, noise=0, random_state=None
  ):
      prng = np.random.RandomState(random_state)
      signal = prng.randn(n_TRs)
      correlated = True
      while correlated:
          uncorrelated = np.random.randn(n_TRs, n_subjects)[
              :, np.newaxis, :
          ]
          unc_max = np.amax(
              squareform(
                  np.corrcoef(uncorrelated[:, 0, :].T), checks=False
              )
          )
          unc_mean = np.mean(
              squareform(
                  np.corrcoef(uncorrelated[:, 0, :].T), checks=False
              )
          )
          if unc_max < 0.25 and np.abs(unc_mean) < 0.001:
              correlated = False
      data = np.repeat(
          np.column_stack((signal, signal))[..., np.newaxis],
          n_subjects,
          axis=2,
      )
      data = np.concatenate((data, uncorrelated), axis=1)
      data = data + np.random.randn(n_TRs, 3, n_subjects) * noise
      return data
  
file_path: brainiak/tests/isc/test_isc.py
imports: import numpy
  import logging
  import pytest
  from brainiak.isc import isc, isfc, bootstrap_isc, permutation_isc, squareform_isfc, timeshift_isc, phaseshift_isc
  from scipy.spatial.distance import squareform
label_desc: Use image node_id 2 for calling a global function with example usage: correlated_timeseries(n_subjects, n_TRs, noise, random_state) and returns: data