code: def test_both(data):
      k1 = 10
      k2 = 8
      ncomp = 5
      ntotal = k1
      X1 = np.random.standard_normal((data["nimages"], k1))
      X2 = np.random.standard_normal((data["nimages"], k2))
      p = pca(
          data["fmridata"],
          -1,
          ncomp=ncomp,
          design_resid=X2,
          design_keep=X1,
      )
      assert p["basis_vectors"].shape == (data["nimages"], ntotal)
      assert p["basis_projections"].shape == data["mask"].shape + (
          ncomp,
      )
      assert p["pcnt_var"].shape == (ntotal,)
      assert_almost_equal(p["pcnt_var"].sum(), 100.0)
  
imports: import numpy
  import pytest
  from nipy.io.api import load_image
  from nipy.testing import assert_almost_equal, assert_array_almost_equal, funcfile
  from ..pca import pca
label_desc: Use image node_id 18 for calling a global function with example usage: test_both(data) without return types