code: def reduce_data_single(
      subject_index,
      session_index,
      img,
      atlas=None,
      inv_atlas=None,
      low_ram=False,
      temp_dir=None,
  ):
      """Reduce data using given atlas
  
      Parameters
      ----------
      subject_index : int
  
      session_index : int
  
      img : str or array
          path to data.
          Data are loaded with numpy.load and expected shape is
           (n_voxels, n_timeframes)
          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
  
          img can also be an array of shape (n_voxels, n_timeframes)
  
      atlas :  array, shape=[n_supervoxels, n_voxels] or [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.
  
      inv_atlas : array, shape=[n_voxels, n_supervoxels] or None
          Pseudo inverse of the atlas (only for probabilistic atlases)
  
      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 number of sessions are large
  
      Returns
      -------
  
      reduced_data : array, shape=[n_timeframes, n_supervoxels]
          reduced data
      """
      # Here we return to the conventions of the paper
      data = safe_load(img).T
  
      n_timeframes, n_voxels = data.shape
  
      # Here we check that input is normalized
      if (
          np.max(np.abs(np.mean(data, axis=0))) > 1e-6
          or np.max(np.abs(np.var(data, axis=0) - 1))
      ) > 1e-6:
          ValueError(
              "Data in imgs[%i, %i] does not have 0 mean and unit \
          variance. If you are using NiftiMasker to mask your data \
          (nilearn) please use standardize=True."
              % (subject_index, session_index)
          )
  
      if inv_atlas is None and atlas is not None:
          atlas_values = np.unique(atlas)
          if 0 in atlas_values:
              atlas_values = atlas_values[1:]
  
          reduced_data = np.array(
              [
                  np.mean(data[:, atlas == c], axis=1)
                  for c in atlas_values
              ]
          ).T
      elif inv_atlas is not None and atlas is None:
          # this means that it is a probabilistic atlas
          reduced_data = data.dot(inv_atlas)
      else:
          reduced_data = data
  
      if low_ram:
          name = safe_encode(img)
          path = os.path.join(temp_dir, "reduced_data_" + name)
          np.save(path, reduced_data)
          return path + ".npy"
      else:
          return reduced_data
  
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 23 for calling a global function with example usage: reduce_data_single(subject_index, session_index, img, atlas, inv_atlas, low_ram, temp_dir) and returns: unknown, reduced_data