class_docstr: SRM decomposition using a very low amount of memory and computational power thanks to the use of an atlas as described in [Richard2019]_.
  
  Given multi-subject data, factorize it as a shared response S among all subjects and an orthogonal transform (basis) W per subject:
  
  .. math:: X_i \approx W_i S, \forall i=1 \dots N
  
  Parameters
  ----------
  
  atlas :  array, shape=[n_supervoxels, n_voxels] or array,shape=[n_voxels] or str or None, default=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. If atlas is a str the corresponding array is loaded with numpy.load and expected shape is (n_voxels,) for a deterministic atlas and (n_supervoxels, n_voxels) for a probabilistic atlas.
  
  n_components : int
      Number of timecourses of the shared coordinates
  
  n_iter : int
      Number of iterations to perform
  
  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
  
  seed : int
      Seed used for random sampling.
  
  n_jobs : int, 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.
  
  verbose : bool or "warn"
      If True, logs are enabled. If False, logs are disabled. If "warn" only warnings are printed.
  
  aggregate: str or None, default="mean"
      If "mean", shared_response is the mean shared response from all subjects. If None, shared_response contains all subject-specific responses in shared space
  
  Attributes
  ----------
  
  `basis_list`: list of array, element i has shape=[n_components, n_voxels] or list of str
      - if basis is a list of array, element i is the basis of subject i
      - if basis is a list of str, element i is the path to the basis of subject i that is loaded with np.load yielding an array of shape [n_components, n_voxels].
  
      Note that any call to the clean method erases this attribute
  
  Note
  -----
  
      **References:**
      H. Richard, L. Martin, A. Pinho, J. Pillow, B. Thirion, 2019: Fast shared response model for fMRI data (https://arxiv.org/pdf/1909.12537.pdf)
docstr: Computes basis across subjects from input imgs
  
  Parameters
  ----------
  imgs : array of str, shape=[n_subjects, n_sessions] or list of list of arrays or list of arrays
      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_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
  
      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)
  
  Returns
  -------
  self : object
     Returns the instance itself. Contains attributes listed at the object level.
docstr_tok: ["Computes","basis","across","subjects","from","input","imgs","Parameters","--","--","--","--","--","imgs",":","array","of","str",",","shape=","[","n_subjects",",","n_sessions","]","or","list","of","list","of","arrays","or","list","of","arrays","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_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","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",")","Returns","--","--","--","-","self",":","object","Returns","the","instance","itself",".","Contains","attributes","listed","at","the","object","level","."]
code: def fit(self, imgs):
      """Computes basis across subjects from input imgs
  
          Parameters
          ----------
          imgs : array of str, shape=[n_subjects, n_sessions] or \
  list of list of arrays or list of arrays
              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_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
  
              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)
  
          Returns
          -------
          self : object
             Returns the instance itself. Contains attributes listed \
  at the object level.
          """
      atlas_shape = check_atlas(self.atlas, self.n_components)
      reshaped_input, imgs, shapes = check_imgs(
          imgs, n_components=self.n_components, atlas_shape=atlas_shape
      )
      self.clean()
      create_temp_dir(self.temp_dir)
  
      if self.verbose is True:
          logger.info("[FastSRM.fit] Reducing data")
  
      reduced_data = reduce_data(
          imgs,
          atlas=self.atlas,
          n_jobs=self.n_jobs,
          low_ram=self.low_ram,
          temp_dir=self.temp_dir,
      )
  
      if self.verbose is True:
          logger.info(
              "[FastSRM.fit] Finds shared "
              "response using reduced data"
          )
      shared_response_list = fast_srm(
          reduced_data,
          n_iter=self.n_iter,
          n_components=self.n_components,
          low_ram=self.low_ram,
          seed=self.seed,
      )
      if self.verbose is True:
          logger.info(
              "[FastSRM.fit] Finds basis using "
              "full data and shared response"
          )
  
      if self.n_jobs == 1:
          basis = []
          for i, sessions in enumerate(imgs):
              basis_i = _compute_basis_subject_online(
                  sessions, shared_response_list
              )
              if self.temp_dir is None:
                  basis.append(basis_i)
              else:
                  path = os.path.join(self.temp_dir, "basis_%i" % i)
                  np.save(path, basis_i)
                  basis.append(path + ".npy")
              del basis_i
      else:
          if self.temp_dir is None:
              basis = Parallel(n_jobs=self.n_jobs)(
                  delayed(_compute_basis_subject_online)(
                      sessions, shared_response_list
                  )
                  for sessions in imgs
              )
          else:
              Parallel(n_jobs=self.n_jobs)(
                  delayed(_compute_and_save_corr_mat)(
                      imgs[i][j], shared_response_list[j], self.temp_dir
                  )
                  for j in range(len(imgs[0]))
                  for i in range(len(imgs))
              )
  
              basis = Parallel(n_jobs=self.n_jobs)(
                  delayed(_compute_and_save_subject_basis)(
                      i, sessions, self.temp_dir
                  )
                  for i, sessions in enumerate(imgs)
              )
  
      self.basis_list = basis
      return self
  
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 3 for calling the FastSRM obj's underlying member method code with example usage: obj.fit(imgs) and returns: self