code: def generate_epochs_info(epoch_list):
      """use epoch_list to generate epoch_info defined below
  
      Parameters
      ----------
      epoch_list: list of 3D (binary) array in shape [condition, nEpochs, nTRs]
          Contains specification of epochs and conditions, assuming
          1. all subjects have the same number of epochs;
          2. len(epoch_list) equals the number of subjects;
          3. an epoch is always a continuous time course.
  
      Returns
      -------
      epoch_info: list of tuple (label, sid, start, end).
          label is the condition labels of the epochs;
          sid is the subject id, corresponding to the index of raw_data;
          start is the start TR of an epoch (inclusive);
          end is the end TR of an epoch(exclusive).
          Assuming len(labels) labels equals the number of epochs and
          the epochs of the same sid are adjacent in epoch_info
      """
      time1 = time.time()
      epoch_info = []
      for sid, epoch in enumerate(epoch_list):
          for cond in range(epoch.shape[0]):
              sub_epoch = epoch[cond, :, :]
              for eid in range(epoch.shape[1]):
                  r = np.sum(sub_epoch[eid, :])
                  if r > 0:  # there is an epoch in this condition
                      start = np.nonzero(sub_epoch[eid, :])[0][0]
                      epoch_info.append((cond, sid, start, start + r))
      time2 = time.time()
      logger.debug(
          "epoch separation done, takes %.2f s" % (time2 - time1)
      )
      return epoch_info
  
file_path: brainiak/brainiak/fcma/preprocessing.py
imports: import math
  import time
  import numpy
  import logging
  from scipy.stats.mstats import zscore
  from mpi4py import MPI
  from enum import Enum
  from ..image import mask_images, multimask_images
label_desc: Use image node_id 5 for calling a global function with example usage: generate_epochs_info(epoch_list) and returns: epoch_info