code: def test_reduce_data_outputshapes():
      n_jobs = 1
      with tempfile.TemporaryDirectory() as datadir:
          for n_timeframes in ([25, 24], [25, 25]):
              # We authorize different timeframes for different sessions
              # but they should be the same across subject
              n_voxels = 10
              n_subjects = 2
              n_components = (
                  3  # number of components used for SRM model
              )
              n_supervoxels = 5  # number of components of the atlas
              n_sessions = len(n_timeframes)
  
              np.random.seed(0)
              paths, _, _ = generate_data(
                  n_voxels,
                  n_timeframes,
                  n_subjects,
                  n_components,
                  datadir,
              )
  
              # Test if reduced data has the good shape
              # probabilistic atlas
              atlas = np.random.rand(n_supervoxels, n_voxels)
              data = reduce_data(
                  paths,
                  atlas=atlas,
                  n_jobs=n_jobs,
                  low_ram=False,
                  temp_dir=None,
              )
  
              for subject in range(n_subjects):
                  for session in range(n_sessions):
                      assert data[subject, session].shape == (
                          n_timeframes[session],
                          n_supervoxels,
                      )
  
              # deterministic atlas
              det_atlas = np.round(
                  np.random.rand(n_voxels) * n_supervoxels
              )
              n_unique = len(np.unique(det_atlas)[1:])
              while n_unique != n_supervoxels:
                  det_atlas = np.round(
                      np.random.rand(n_voxels) * n_supervoxels
                  )
                  n_unique = len(np.unique(det_atlas)[1:])
  
              data = reduce_data(
                  paths,
                  atlas=det_atlas,
                  n_jobs=n_jobs,
                  low_ram=True,
                  temp_dir=datadir,
              )
  
              for subject in range(n_subjects):
                  for session in range(n_sessions):
                      assert np.load(data[subject, session]).shape == (
                          n_timeframes[session],
                          n_supervoxels,
                      )
  
imports: import os
  import tempfile
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  from sklearn.exceptions import NotFittedError
  from brainiak.funcalign.fastsrm import FastSRM, _compute_and_save_corr_mat, _compute_and_save_subject_basis, _compute_basis_subject_online, _reduced_space_compute_shared_response, check_atlas, check_imgs, check_shared_response, create_temp_dir, fast_srm, reduce_data, safe_load
  from brainiak.funcalign.srm import DetSRM
label_desc: Use image node_id 9 for calling a global function with example usage: test_reduce_data_outputshapes() without return types