code: def test_ica_full_data_recovery(method):
      """Test recovery of full data when no source is rejected."""
      # Most basic recovery
      _skip_check_picard(method)
      raw = read_raw_fif(raw_fname).crop(0.5, stop).load_data()
      with raw.info._unlock():
          raw.info["projs"] = []
      events = read_events(event_name)
      picks = pick_types(
          raw.info,
          meg=True,
          stim=False,
          ecg=False,
          eog=False,
          exclude="bads",
      )[:10]
      epochs = Epochs(
          raw,
          events[:4],
          event_id,
          tmin,
          tmax,
          picks=picks,
          baseline=None,
          preload=True,
      )
      evoked = epochs.average()
      n_channels = 5
      data = raw._data[:n_channels].copy()
      data_epochs = epochs.get_data(copy=True)
      data_evoked = evoked.data
      raw.set_annotations(Annotations([0.5], [0.5], ["BAD"]))
      methods = [method]
      for method in methods:
          stuff = [(2, n_channels, True), (2, n_channels // 2, False)]
          for n_components, n_pca_components, ok in stuff:
              ica = ICA(
                  n_components=n_components,
                  random_state=0,
                  method=method,
                  max_iter=1,
              )
              kwargs = dict(
                  exclude=[], n_pca_components=n_pca_components
              )
              picks = list(range(n_channels))
              with pytest.warns(
                  UserWarning, match=None
              ):  # sometimes warns
                  ica.fit(raw, picks=picks)
              _assert_ica_attributes(ica, raw.get_data(picks))
              raw2 = ica.apply(raw.copy(), **kwargs)
              if ok:
                  assert_allclose(
                      data[:n_channels],
                      raw2._data[:n_channels],
                      rtol=1e-10,
                      atol=1e-15,
                  )
              else:
                  diff = np.abs(
                      data[:n_channels] - raw2._data[:n_channels]
                  )
                  assert np.max(diff) > 1e-14
  
              ica = ICA(
                  n_components=n_components,
                  method=method,
                  random_state=0,
              )
              with _record_warnings():  # sometimes warns
                  ica.fit(epochs, picks=picks)
              _assert_ica_attributes(ica, epochs.get_data(picks))
              epochs2 = ica.apply(epochs.copy(), **kwargs)
              data2 = epochs2.get_data(picks=slice(0, n_channels))
              if ok:
                  assert_allclose(
                      data_epochs[:, :n_channels],
                      data2,
                      rtol=1e-10,
                      atol=1e-15,
                  )
              else:
                  diff = np.abs(data_epochs[:, :n_channels] - data2)
                  assert np.max(diff) > 1e-14
  
              evoked2 = ica.apply(evoked.copy(), **kwargs)
              data2 = evoked2.data[:n_channels]
              if ok:
                  assert_allclose(
                      data_evoked[:n_channels],
                      data2,
                      rtol=1e-10,
                      atol=1e-15,
                  )
              else:
                  diff = np.abs(evoked.data[:n_channels] - data2)
                  assert np.max(diff) > 1e-14
      with pytest.raises(ValueError, match="Invalid value"):
          ICA(method="pizza-decomposision")
  
imports: import os
  import shutil
  from contextlib import nullcontext
  from pathlib import Path
  import matplotlib.pyplot
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import linalg, stats
  from scipy.io import loadmat, savemat
  from mne import Annotations, Epochs, EpochsArray, EvokedArray, Info, create_info, make_ad_hoc_cov, pick_channels_regexp, pick_types, read_events
  from mne._fiff.pick import _DATA_CH_TYPES_SPLIT, get_channel_type_constants
  from mne.cov import read_cov
  from mne.datasets import testing
  from mne.event import make_fixed_length_events
  from mne.io import RawArray, read_raw_ctf, read_raw_eeglab, read_raw_fif
  from mne.io.eeglab.eeglab import _check_load_mat
  from mne.preprocessing import ICA
  from mne.preprocessing import ica_find_ecg_events, ica_find_eog_events, read_ica
  from mne.preprocessing.ica import _ica_explained_variance, _sort_components, corrmap, get_score_funcs, read_ica_eeglab
  from mne.rank import _compute_rank_int
  from mne.utils import _record_warnings, catch_logging, check_version
label_desc: Use image node_id 3 for calling a global function with example usage: test_ica_full_data_recovery(method) without return types