code: def _make_canica_test_data(
      rng=None, n_subjects=N_SUBJECTS, noisy=True
  ):
      if rng is None:
          # Use legacy generator for sklearn compatibility
          rng = np.random.RandomState(42)
      components = _make_canica_components(SHAPE)
      if noisy:  # Creating noisy non positive data
          components[
              rng.standard_normal(components.shape) > 0.8
          ] *= -2.0
  
      for mp in components:
          assert mp.max() <= -mp.min()  # Goal met ?
  
      # Create a "multi-subject" dataset
      data = _make_data_from_components(
          components,
          _affine_eye(),
          SHAPE,
          rng=rng,
          n_subjects=n_subjects,
      )
  
      return data, components, rng
  
imports: import numpy
  import pytest
  from nibabel import Nifti1Image
  from numpy.testing import assert_array_almost_equal
  from nilearn._utils.testing import write_imgs_to_path
  from nilearn.conftest import _affine_eye, _rng
  from nilearn.decomposition.canica import CanICA
  from nilearn.image import get_data, iter_img
  from nilearn.maskers import MultiNiftiMasker
label_desc: Use image node_id 3 for calling a global function with example usage: _make_canica_test_data(rng, n_subjects, noisy) and returns: data,  components,  rng