code: def test_extract_outlier_regressors(rng):
      """Check outlier regressors of different types."""
      # Create a fake confound dataframe
      n_scans = 50
      fake_confounds = pd.DataFrame(
          rng.random((n_scans, 1)), columns=["confound_regressor"]
      )
  
      # scrubbed volume one-hot, overlap with non-steady-state
      idx_scrubbed = [2, 4, 34, 44]
      scrub_vol = pd.DataFrame(
          np.eye(n_scans)[:, idx_scrubbed],
          columns=[
              f"motion_outlier{i:02d}" for i in range(len(idx_scrubbed))
          ],
      )
      # First three volumes are non-steady-state
      non_steady_vol = pd.DataFrame(
          np.eye(n_scans)[:, :3],
          columns=[
              f"non_steady_state_outlier{i:02d}" for i in range(3)
          ],
      )
  
      # non-steady only
      non_steady_conf = pd.concat(
          [fake_confounds, non_steady_vol], axis=1
      )
      sample_mask, confounds, outliers = extract_outlier_regressors(
          non_steady_conf
      )
      assert np.array_equal(sample_mask, np.arange(n_scans)[3:]) is True
      assert_frame_equal(outliers, non_steady_vol)
      assert_frame_equal(confounds, fake_confounds)
  
      # scrub only
      srub_conf = pd.concat([fake_confounds, scrub_vol], axis=1)
      make_mask = np.delete(np.arange(n_scans), idx_scrubbed)
      sample_mask, confounds, outliers = extract_outlier_regressors(
          srub_conf
      )
      assert np.array_equal(sample_mask, make_mask) is True
      assert_frame_equal(outliers, scrub_vol)
      assert_frame_equal(confounds, fake_confounds)
  
      # scrub and non-steady state
      all_conf = pd.concat(
          [fake_confounds, non_steady_vol, scrub_vol], axis=1
      )
      make_mask = np.delete(np.arange(n_scans), idx_scrubbed)[2:]
      make_outliers = pd.concat([non_steady_vol, scrub_vol], axis=1)
      make_outliers = make_outliers.reindex(
          sorted(make_outliers.columns), axis=1
      )
      make_outliers = make_outliers.drop(
          columns="non_steady_state_outlier02"
      )
  
      sample_mask, confounds, outliers = extract_outlier_regressors(
          all_conf
      )
      assert len(sample_mask) == 44
      assert np.array_equal(sample_mask, make_mask) is True
      assert_frame_equal(outliers, make_outliers)
      assert_frame_equal(confounds, fake_confounds)
  
file_path: nilearn/nilearn/interfaces/fmriprep/tests/test_load_confounds_scrub.py
imports: import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from nilearn.interfaces.fmriprep.load_confounds_scrub import _get_outlier_cols, extract_outlier_regressors, optimize_scrub
label_desc: Use image node_id 3 for calling a global function with example usage: test_extract_outlier_regressors(rng) without return types