code: def reduce_data(imgs, atlas, n_jobs=1, low_ram=False, temp_dir=None):
      """Reduce data using given atlas.
      Work done in parallel across subjects.
  
      Parameters
      ----------
  
      imgs : array of str, shape=[n_subjects, n_sessions]
          Element i, j of the array is a path to the data of subject i
          collected during session j.
          Data are loaded with numpy.load and expected shape is
          [n_timeframes, n_voxels]
          n_timeframes and n_voxels are assumed to be the same across subjects
          n_timeframes can vary across sessions
          Each voxel's timecourse is assumed to have mean 0 and variance 1
  
          imgs can also be a list of list of arrays where element i, j of
          the array is a numpy array of shape [n_voxels, n_timeframes] that
          contains the data of subject i collected during session j.
  
          imgs can also be a list of arrays where element i of the array is
          a numpy array of shape [n_voxels, n_timeframes] that contains the
          data of subject i (number of sessions is implicitly 1)
  
      atlas :  array, shape=[n_supervoxels, n_voxels] or array, shape=[n_voxels]
          or None
          Probabilistic or deterministic atlas on which to project the data
          Deterministic atlas is an array of shape [n_voxels,] where values
          range from 1 to n_supervoxels. Voxels labelled 0 will be ignored.
  
      n_jobs : integer, optional, default=1
          The number of CPUs to use to do the computation.
           -1 means all CPUs, -2 all CPUs but one, and so on.
  
      temp_dir : str or None
          path to dir where temporary results are stored
          if None temporary results will be stored in memory. This
          can results in memory errors when the number of subjects
          and / or sessions is large
  
      low_ram : bool
          if True and temp_dir is not None, reduced_data will be saved on disk
          this increases the number of IO but reduces memory complexity when
           the number of subject and/or sessions is large
  
      Returns
      -------
  
      reduced_data_list : array of str, shape=[n_subjects, n_sessions]
      or array, shape=[n_subjects, n_sessions, n_timeframes, n_supervoxels]
          Element i, j of the array is a path to the data of subject i collected
           during session j.
          Data are loaded with numpy.load and expected shape is
          [n_timeframes, n_supervoxels]
          or Element i, j of the array is the data in array of
          shape=[n_timeframes, n_supervoxels]
          n_timeframes and n_supervoxels
           are assumed to be the same across subjects
          n_timeframes can vary across sessions
          Each voxel's timecourse is assumed to have mean 0 and variance 1
      """
      if atlas is None:
          A = None
          A_inv = None
      else:
          loaded_atlas = safe_load(atlas)
          if len(loaded_atlas.shape) == 2:
              A = None
              A_inv = loaded_atlas.T.dot(
                  np.linalg.inv(loaded_atlas.dot(loaded_atlas.T))
              )
          else:
              A = loaded_atlas
              A_inv = None
  
      n_subjects = len(imgs)
      n_sessions = len(imgs[0])
  
      reduced_data_list = Parallel(n_jobs=n_jobs)(
          delayed(reduce_data_single)(
              i,
              j,
              imgs[i][j],
              atlas=A,
              inv_atlas=A_inv,
              low_ram=low_ram,
              temp_dir=temp_dir,
          )
          for i in range(n_subjects)
          for j in range(n_sessions)
      )
  
      if low_ram:
          reduced_data_list = np.reshape(
              reduced_data_list, (n_subjects, n_sessions)
          )
      else:
          if len(np.array(reduced_data_list).shape) == 1:
              reduced_data_list = np.reshape(
                  reduced_data_list, (n_subjects, n_sessions)
              )
          else:
              n_timeframes, n_supervoxels = np.array(
                  reduced_data_list
              ).shape[1:]
              reduced_data_list = np.reshape(
                  reduced_data_list,
                  (n_subjects, n_sessions, n_timeframes, n_supervoxels),
              )
  
      return reduced_data_list
  
imports: import hashlib
  import logging
  import os
  import numpy
  import scipy
  from joblib import Parallel, delayed
  from brainiak.funcalign.srm import DetSRM
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.exceptions import NotFittedError
  import uuid
label_desc: Use image node_id 24 for calling a global function with example usage: reduce_data(imgs, atlas, n_jobs, low_ram, temp_dir) and returns: reduced_data_list