code: def test_spoc():
      """Test SPoC."""
      X = np.random.randn(10, 10, 20)
      y = np.random.randn(10)
  
      spoc = SPoC(n_components=4)
      spoc.fit(X, y)
      Xt = spoc.transform(X)
      assert_array_equal(Xt.shape, [10, 4])
      spoc = SPoC(n_components=4, transform_into="csp_space")
      spoc.fit(X, y)
      Xt = spoc.transform(X)
      assert_array_equal(Xt.shape, [10, 4, 20])
      assert_array_equal(spoc.filters_.shape, [10, 10])
      assert_array_equal(spoc.patterns_.shape, [10, 10])
  
      # check y
      pytest.raises(ValueError, spoc.fit, X, y * 0)
  
      # Check that doesn't take CSP-spcific input
      pytest.raises(TypeError, SPoC, cov_est="epoch")
  
      # Check mixing matrix on simulated data
      rs = np.random.RandomState(42)
      y = rs.rand(100) * 50 + 1
      X, A = simulate_data(y)
  
      # fit spoc
      spoc = SPoC(n_components=1)
      spoc.fit(X, y)
  
      # check the first patterns match the mixing matrix
      corr = np.abs(np.corrcoef(spoc.patterns_[0, :].T, A[:, 0])[0, 1])
      assert np.abs(corr) > 0.99
  
      # check output
      out = spoc.transform(X)
      corr = np.abs(np.corrcoef(out[:, 0], y)[0, 1])
      assert np.abs(corr) > 0.85
  
file_path: mne-python/mne/decoding/tests/test_csp.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_equal
  from mne import Epochs, io, pick_types, read_events
  from mne.decoding.csp import CSP, SPoC, _ajd_pham
label_desc: Use image node_id 7 for calling a global function with example usage: test_spoc() without return types