code: def test_ajdc_get_src_expl_var(rndstate):
      n_subjects, n_conditions, n_channels, n_times = 2, 2, 3, 256
      X = rndstate.randn(n_subjects, n_conditions, n_channels, n_times)
      ajdc = AJDC(dim_red={"expl_var": 0.9}).fit(X)
      n_matrices = 4
      X_new = rndstate.randn(n_matrices, n_channels, n_times)
      v = ajdc.get_src_expl_var(X_new)
      assert v.shape == (n_matrices, ajdc.n_sources_)
      with pytest.raises(ValueError):  # not 3 dims
          ajdc.get_src_expl_var(X_new[0])
      with pytest.raises(ValueError):  # unequal # of chans
          ajdc.get_src_expl_var(
              rndstate.randn(n_matrices, n_channels + 1, 1)
          )
  
imports: from conftest import get_metrics
  import pytest
  import numpy
  from numpy.testing import assert_array_equal
  from pyriemann.spatialfilters import Xdawn, CSP, SPoC, BilinearFilter, AJDC
label_desc: Use image node_id 18 for calling a global function with example usage: test_ajdc_get_src_expl_var(rndstate) without return types